Bubble runtime architecture
From Bubble
Contents |
Kernel
The development is based on the latest 2.4.
See Linux kernel for more details.
Boot process
High level description
- Load kernel (including initrd)
- Get configuration file
- Create ramdisk
- Copy base system from initrd to ramdisk
- Load packages into ramdisk as specified in the configuration file
- switchroot and start the system from ramdisk
Boot media
Bubble supports the following boot media:
- Network boot
- CD-ROM (Using ISOLinux)
- SysLinux boot: boot from a FAT filesystem (Using SysLinux)
It allows too boot from:- A floppy disk
- A compact Flash (Via an IDE/CF bridge)
The boot media contains:
- Kernel image
- Initrd image (bundled with the kernel in case of a network boot)
- The Bubble configuration file
- The packages
Initrd
The kernel is booted through an initial ram disk.
There is no alternative since:
- We need to be able to load the right network module in case of network boot or exotic hardware
- The root fs is a ramdisk which is generated at run time
About ramdisk
It took me some time to realize that the ramdisk_size kernel parameter is just there to set an upper bound to the ramdisks.
It does not mean that this amount of memory is allocated when a ramdisk is created.
In DiskLess we are setting the ramdisk_size to the size of the initrd ramdisk. This is not wrong, but it actually limits the size of all ramdisks!
In Bubble, we want a small initrd, so we cannot do this anymore!
We just set the ramdisk_size to an arbitrary high value -- this does not matter too much.
Pivot Root
When the new ramdisk is ready, we need to swap the root devices. This is done by the `pivot_root` command.
I had to experiment a bit to get it right:
- BusyBox will not start init if does not have pid 1.
The workaround is to launch the linuxrc applet - As consequence of #1, linuxrc need to be enabled in BusyBox. This makes that at install time, BusyBox will overwrite the linuxrc of the initrd, which is not what we need.
To circumvent this, we will simply copy our linuxrc scripts in the fixups...
For reference, the snipped of CVS:buildroot/sources/target_skeleton/linuxrc.sh which does the trick:
echo "---------- Pivot Root --------------------------------------------------" /bin/umount /proc cd $ROOT /sbin/pivot_root . initrd echo "---------- Stating init ------------------------------------------------" ln -s sbin/init linuxrc exec chroot . ./linuxrc <dev/console >dev/console 2>&1 echo "---------- Init could not be started!!! --------------------------------"
Boot Device identification
Another difficulty is to identify the boot device!
This information is just not available as such.
We need this information to load our configuration file and the packages that need to be installed
There are several possibilities:
- Try all the possible combinations (based on /proc/devices and /proc/filesystems)
This is not bullet proof, a wrong device can match... - Scan the PCI bus to find a network card
Again here, we may get a wrong one! - Pass the information on the command line
The last one may require manual configuration, but it will work as-is most of the time:
- Network boot: We are doing a new DHCP request to get all the information from the DHCP server (no configuration required).
IP can be passed on the command line, but unfortunately this does not help too much, since we are missing information about the BootP server. Therefore we have to re-query the DHCP server. The following information is given for reference, but is not used in Bubble. - Floppy/CD-Rom/CF: all are SysLinux -- we add the device in the configuration file (`APPEND` parameter).

