With newer (2.6) kernels a 'rootfs', which is an un-unmountable ramfs/tmpfs, is created to be used as the initial ramfs. After the content has been loaded into rootfs, an 'init' executable is called that can setup the rest of the system, including switching over to a new root.
Anyway, I setup a new cpio initramfs as according to gentoo wiki. But when I rebooted the machine, I just got a kernel panic and little clue as to what went wrong[2]. Luckily, I had a second computer with a serial connector so I could capture all the kernel output, as well as being able to google for answers. After an afternoon of trying, I finally figured out[3] how to get it to work:
I'd decided *not* to put my 'init' script in the root of my rootfs, since I didn't want it cluttering my root, so I named it 'linuxrc' and put it in /sbin. I'd used "init=/sbin/linuxrc" in grub, as an argument to the 'initrd' command at first, and then as an argument to 'kernel' when I figured it was actually a kernel option; This was wrong, it should be "rdinit=/sbin/linuxrc". I'm not really sure where I was supposed to look for this, the grub manual seems short of information, as do many grub tutorials. Maybe the grub2 docs are better?
footnotes:
[1]: PITA name, btw, since google just brings up results where 'rootfs' is used as slang for the root filesystem!
go back
[2]: The output wasn't verbose enough, I didn't get any explicit "init script not found" messages, and the final error seems nothing to do with the actual error, as I found here:
> But the board hangs with messagego back
> VFS: Cannot open root device "" or unknown-block(0,0)
> Please append a correct "root=" boot option
> Kernel panic - not syncing: VFS: Unable to mount root fs on
> unknown-block(0,0)
That means it fell through to the legacy root filesystem mounting code, which came up empty.
> My guess is it does not find /init file in the rootfs although its
> present there and points to busybox.
Yup. That's why it fell through.
[3]: I got my solution after looking here and noticing the 'rdinit' parameter, which I'd never seen before.
go back