some question about / adding commandline files from rootfs

Mike Montour mail at
Fri Aug 29 08:22:18 CEST 2008

Werner Almesberger wrote:
> - there has to be a (small) configuration file parser
> - it would create a shared configuration resource, i.e., first
>   and second partition would share the same file, even though
>   they are otherwise independent from each other. (LILO and GRUB
>   have that issue as well and nobody seems to be overly bothered
>   by it, so perhaps this isn't such a big problem.)

A possibility here would be to write Qi configuration into the first 
sector ("MBR") of the SD card. According to Wikipedia there are 440 
bytes available for boot code (which will never be used on a Freerunner) 
before the partition table. This should be enough to store a few boot 
entries, each one specifying the location of a kernel and an optional 
file holding a commandline for that kernel.

User editing could be done with a small userspace program that would 
dump the sector to a temporary text file, allow the user to edit it, and 
then convert it back to the binary format (after validating it). This 
program could also have a quick mode to change which of the possible 
entries would be booted by default, to make it easy to switch between 
partitions in a multi-boot environment (e.g. "qi-conf -b 3" to set entry 
#3 as the default).

If Qi detected an invalid structure in the MBR (or if the user pressed 
some button to request recovery mode) then it would ignore the SD card 
and load a kernel + recovery rootfs from NAND.

More information about the openmoko-kernel mailing list