First init
Let us create the process init. It will print "hello world" as you would normally do, that is, init is a user process printing "hello world" in user mode.
Let us make our ARM Linux runs this init process:
Do something like this:
Save what Shibata's team have done for future study:
~/Downloads/pcs3746-sistemas-operacionais/1/initramfs$ cp init.c init.c.1
edit init.c
I like emacs to edit files, but you may choose vim, nano, etc. Make init.c contains the code above.
~/Downloads/pcs3746-sistemas-operacionais/1/initramfs$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b18bb9eb0a2 tiagoshibata/pcs3746 "/entrypoint.sh /def…" 2 minutes ago Up 2 minutes cranky_lewin
jk@jk-desktop:~/Downloads/pcs3746-sistemas-operacionais/1/initramfs$ docker kill cranky_lewin
cranky_lewin
Let us make our ARM Linux runs this init process:
#include <stdio.h>
int main()
{
while (1) {
printf("Hello, World; from user!\n");
}
return 0;
}
Do something like this:
Save what Shibata's team have done for future study:
~/Downloads/pcs3746-sistemas-operacionais/1/initramfs$ cp init.c init.c.1
edit init.c
~/Downloads/pcs3746-sistemas-operacionais/1/initramfs$ emacs init.c
I like emacs to edit files, but you may choose vim, nano, etc. Make init.c contains the code above.
Now, just do:
~/Downloads/pcs3746-sistemas-operacionais/1$ ./run.sh
The Linux source code will be compiled if it has too, the init.c will be compiled and inserted into rootfs thanks to default_cmd.sh that will make everything automatically.
That's it! You got your init running with no hassles.
In order to stop it, you may kill the container.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b18bb9eb0a2 tiagoshibata/pcs3746 "/entrypoint.sh /def…" 2 minutes ago Up 2 minutes cranky_lewin
jk@jk-desktop:~/Downloads/pcs3746-sistemas-operacionais/1/initramfs$ docker kill cranky_lewin
cranky_lewin
Comentários
Postar um comentário