Boot process; execution of init; initramfs
This is my first post, so please point me in the right direction if needed. My studies have focused on embedded systems and right now gaining a full understanding of the Linux boot process. I would like to be able to create a BusyBox environment mostly from scratch.
My understanding so far is that after the kernel loads, init is executed. The default location of init is /sbin/init. The BusyBox faq states that you should be able to statically compile a simple 'Hello World' program and use it in place of init to see the message displayed. 1. Is it true that a statically compiled Hello World program should execute at the end of the kernel loading if I simply place it in /sbin/init (or point to it with an init=/sbin/init boot parameter)? Because that hasn't worked for me yet. 2. In beginning to research this problem I've come across how-to documents showing the creation if an initramfs. I don't want to go down a deprecated path again; done that too many times. Is initramfs still relevant? Any additional sage advice would be super-appreciated. I've spent a week learning so much already, but could definitely have used guidance in avoiding some of the outdated materials I've found. |
Don't know if this qualifies as "sage advice", but the boot process works like this:
Initramfs is just a (compressed) cpio archive that gets copied to a tempfs file system in RAM and then used as a root file system. It's an alternative to the older initrd concept, where a (compressed) image file containing a file system is used. Since initramfs is the more recent of the two, it's not likely to be deprecated any time soon (but then neither is initrd). |
It does work! At least, as you described, for limited quantities of "work". I had been compiling on a 64-bit system, but booting x86. The kernel only complains that init couldn't be found and to try passing the init= parameter; not a mention about inability to run. Thank you - I had been questioning whether the file system was mounting, I was putting the file in the wrong place, everything - you helped narrow it down.
I'll have to look further into the differences between the two (initramfs and initrd) to evaluate which would be a better fit for the hardware I'm targeting. |
All times are GMT -5. The time now is 12:55 AM. |