I am playing with linux booting for educationl purposes.
Here is my micromalistic init
program:
#include <stdio.h>
int main () {
printf ("hello\n");
while (1) { }
return 0;
}
Compiled with gcc -static init.c -o initrd/init
ramdisk:
cd initrd
find .|cpio --quiet -H newc -o | gzip -9 -n > ../myinitrd.gz
As you can see /init
is the only file in ram disc.
qemu-system-x86_64 -m 2G -accel kvm -kernel bzImage -append "init=/init" -initrd myinitrd.gz
Last lines I see in VM output:
[ 0.803476] Run /init as init process
[ 0.804003] init (70) used greatest stack depth: 14696 bytes left
It seems init loaded, but printf()
message does not het through. Why?