[clug] Booting without a bootloader & alternatives to /init
Jeremy Kerr
jk at ozlabs.org
Thu May 21 08:32:03 GMT 2009
Daniel,
> > If you're booting with an initrd, the kernel will try to run
> > /linuxrc if it can. If you're using initramfs, it will run /init.
>
> No, it won't. Linux will run exactly the same set of things
> regardless of the root filesystem being a physical disk or a ramfs,
> and regardless of how it is populated.
init/main.c says otherwise. From my reading:
execute_command = "/init" (overridable with init=)
ramdisk_execute_command = "/init" (overridable with rdinit=)
kernel_init()
if there is no initramfs containing ramdisk_execute_command:
ramdisk_execute_command = NULL
-> prepare_namespace()
-> initrd_load()
-> handle_initrd()
if there is an initrd present, execute its /linuxrc and
wait for that to finish
-> init_post()
try to run init from ramdisk_execute_command
try to run init from execute_command
try to run init from /sbin/init
try to run init from /etc/init
try to run init from /bin/init
try to run init from /bin/sh
panic about not finding an init
Note that initramfs != initrd. Generally /linuxrc will set up the real
root fs, handing control back to the kernel to then run the real init.
But the OP can probably ignore all that - just set up a script in
/sbin/init to do the appropriate setup (eg, bring up network interfaces)
and then exec the wanted app.
Cheers,
Jeremy
More information about the linux
mailing list