BeagleBox: kernel boots initrd, initramfs still doesn’t work


This weekend I buckled down and merged the BeagleBoard validation images kernel configuration into my beaglebox kernel configuration.  When I booted the resulting kernel with the validation images ramdisk image it worked.  Unfortunately, because there were a fair number of changes to merge in it isn't clear exactly which ones were necessary to get the kernel to boot the ramdisk.  When I get truly ambitious I'll dig into that by diff'ing the cvs versions of the kernel config (1.4 v 1.5) and trying to identify what enabled the ramdisk image.  I don't think it was enabling ramdisks in the kernel because I think that was already there.  It was something less obvious.

One nice thing about merging the BeagleBoard kernel config into my config is that it appears I enabled audio support along with a few other features that I didn't have.  I haven't dug into this yet but noticed different boot messages with the updated config, including information on the nand partitions.  So this is definitely meaningful progress.

Anyway, the kernel now boots that ramdisk.  So the next step was getting either an initrd or initramfs working.  Because the ramdisk acts more like an initrd than an initramfs I decided to focus on an initrd.  There was little extra work here once the kernel booted the validation ramdisk.  I just updated the inittab with some minor changes, including prompting if I wanted to start a shell, and then moved all the pivoting code to another script so I could run it manually.  The initrd boots and I can get to the shell from the serial port and run that script manually now.  What's left is to get the pivot stuff to work correctly.  I'm close to that, but need to test a few changes.

The initramfs is another story.  I changed the initrd targets to build either an initrd or an initramfs based on the setting of the INITRAMFS environment variable.  So the build produces nearly identical images with the exception that the initrd is a gzipped ext2 file system image while the initramfs is a gzipped cpio image.  It appears that having the bootloader load the initramfs.cpio.gz into memory and then telling the kernel about it by specifying that memory location in the initrd= command line option doesn't work.  At best, it just fails to see the image and falls through to a default boot option (booting from nfs, which I removed from the kernel config but still seems to occur and that worries me a bit).

Whatever the solution, it seems more and more like using an initramfs doesn't work well in this situation.  Since the initrd does work I'll stay focused on getting it to pivot to the real rootfs on the second partition of the sd card.  Once I get to that point things get easier and should move faster.  I'll have to make sure writes to the SD card are kept in a tmpfs, similar to how the validation image does it with its volatile.sh and volatile.cache files.  And then I can start focusing more on actually bringing up the UI and services.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.