ariane Boot Sequence
ariane boots in two stages. First runs the linuxrc script from the initial ramdisk which doesn't have anything to do with the ariane system itself. Only after this has succesfully done the work of installing ariane into a ramdisk, the ariane boot happens.
- linuxrc boot
-
This is where the whole thing starts. After the linux kernel and initial ramdisk is loaded the kernel mounts the initial ramdisk as root directory "/" and executes the script linuxrc in single process mode with root permissons. This script is required to do anything what the target system needs for it's boot.
- Read the kernel's boot prompt parameters and convert them into environment variables.
- Locate the source device (the device with the linux.tgz archive) by trying to mount the devices /dev/sda1, /dev/hda ... /dev/hdf in that order. The first device that can be mounted and has the directory bootcode in it's root directory is considered to be the source device.
- If the previous step didn't return a usable device wait for 5 seconds, then try again to access /dev/sda1. The delay of 5 seconds should give the kernel enough time to recognize a USB memory device as /dev/sda1 if it didn't already do this.
- If there's still no source device fail by starting an akanga shell.
- Otherwise accept linux.cgz or linux.tgz in the device's package directoy as target archive and call /sbin/ariane/loadimage to install it into /dev/ram7:
- Allocate 128MB of RAM for the ramdisk device /dev/ram7 which is formatted as ext2 filesystem.
- The target image is unpacked into the ramdisk either using tar or cpio.
- The target's system /etc/fstab is replaced by another one which uses /dev/ram7 as root device.
- The files /var/log/messages, /var/log/wtmp and /var/run/wtmp are created inside the installed target system.
- The kernel's boot prompt parameters are written to /var/adm/boot.conf.
- If the boot parameter ki (short for "keep initrd") is "yes" the directory /initrd is created inside the unpacked image to keep the ramdisk available after it's not longer used.
- If the just unpacked system conatins the script /sbin/linuxrc it's run inside the target system.
- If the kernel's boot parameter shell is "target" an interactive bash is started inside the target system.
- Finally /dev/ram7's device number is written to /proc/sys/kernel/real-root-dev.
- After the target system has been installed an akanga shell is started inside the initial ramdisk if the kernel's boot parameter shell is either "yes" or "debug".
- Read the kernel's boot prompt parameters and convert them into environment variables.
There are perhaps some things to notice here:
- The whole bootup sequence is based on giotto. This is old fashioned and while I was working on it I noticed some comments in the kernel documentation that this old style will be discontinued in the future. It does however still work, at least to boot ariane.
- The boot process till here doesn't know anything about ariane. It will unpack and start any linux.cgz or linux.tgz found on an IDE CD-ROM in the /bootcode directory as long as it fits into a ramdisk of 128MB.
- The shell boot parameter may be a comma spearated list of values, e.g. giving "
shell=debug,target" will give you the target's system shell (bash) and the debug shell.
The following things happen in the installed ariane system.
- /etc/init.d/boot
-
This is the main boot script. it's executed before init does anything else. The important things it does are
- Determine the system's root device (the device which is mounted as"/"). If this is not /dev/ram7 the script assumes that the root device is a real device like a harddisk (you can install ariane on a harddisk) and runs an fsck on it.
- The swap partitions (if any) are activated.
- The CD-ROM drive is located and linked to /dev/cdrom using the kernel's boot messages.
- /etc/keymap.gz is installed as the system's key map and /etc/ttyfont.gz is used for the character font. If you didn't already notice, ariane comes with a German keymap as default.
- The hostname option is read from /etc/options.conf and set as the system's hostname.
- If ariane boots in a ramdisk (see above) and it's not a hibernation boot, the script /etc/init.d/boot.ramdisk is called and finally (after boot.ramdisk has been done or not) /etc/init.d/boot.local and /etc/boot.local are executed if they exist.
- Determine the system's root device (the device which is mounted as"/"). If this is not /dev/ram7 the script assumes that the root device is a real device like a harddisk (you can install ariane on a harddisk) and runs an fsck on it.
- /etc/init.d/boot.ramdisk
-
This script is only executed if ariane runs inside a ramdisk (more precise: if it finds that it is running on the device /dev/ram7) and it's not a hibernation boot. It's called from /etc/init.d/boot.
The boot.ramdisk script determines if ariane was booted from PXE or a CD-ROM. This is done by checking if it finds either the ip or tftpserver parameter set. For the ip parameter is doesn't matter if it was supplied by pxelinux or by the user at the boot loader prompt.
- Assign /var/adm/boot.conf as configuration options file for this script.
- If it's not a PXE boot ariane tries to mount the devices /dev/sda1 (USB memory device if there are no other SCSI devices), /dev/fd0 and /dev/cdrom. For each device ariane checks if the device has the directory bootcode in it's root. The search stops with the first device matching this condition. If the boot device could be found ariane appends the file /bootcode/boot.conf to it's options file.
- Check again if the modified options file contains an ip parameter. If yes PXE boot is considered.
- If it's still not a PXE boot:
- Load any package files set with the install option from the boot devices /bootcode directory.
- Check if the config option is set. If it's "yes" then load configuration files from the boot devices /etc directory. Otherwise (and if the value is not "no") consider the config option's value as name of the directory which contains the configuration files to load.
- If the script /bootcode/boot.ramdisk exists, copy it to /var/adm/boot.ramdisk for later execution.
- If it's a PXE boot:
- If no ipnumber is assigned inside the ip parameter then ariane detects the available network cards, loads their drivers and tries to obtain an IP-number with DHCP.
- If an IP-number was neither set nor obtained in the previous step or no tftpserver was assigned boot.ramdisk terminates here with an error message.
- Check on which network card the IP-number was assigned by activating each card trying to ping the given tftpserver. The first interface that returns the ping packets becomes the PXE card and the first network card in /etc/module.conf. Again, if no card was found usable boot.ramdisk terminates with an error message.
- Fetch the file boot.conf from the TFTP server's root directory and append it to the boot options file.
- Fetch each package given in the install option the package is loaded from the TFTP server's root directory and installed when all packages have been retrieved.
- Check the config option, if it's "yes" the system's configurations files are loaded from the TFTP server's /etc directory. Otherwise (if the option's value is not "no") the config value is used as directory on the TFTP server from which the files should be loaded.
- Fetch the file boot.ramdisk from the TFTP server's root directory for later execution as /var/adm/boot.ramdisk.
- Check if the keymap option is set. If yes activate the keymap and modify the link to /etc/keymap.gz.
- Run network card autodetection and update the system's /etc/module.conf. The cardlist boot parameter can be set to "no" to disable autodetection or to a comma separated list of network modules in cases where the network cards can not be autodetected. In case of a PXE boot the PXE card remains eth0.
- Check if the dhcp option is set to either "yes" or the name of network card. If yes, then set DHCP in the system's option file (in case of "
dhcp=yes" DHCP is set on eth0). Otherwise the system's option file is not changed. - Check if the setip option is set to either "yes" or a static interface configuration in the form "ipnum/mask". If the value is "yes" and an IP configuration was obtained by either a kernel boot option, a boot.conf option or a PXE boot this IP-number is configured as eth0's static IP number in the target system's option file. If a static IP configuration is found this one is set.
- Run /var/adm/boot.ramdisk (fetched earlier from the installation source) if it exists.
- Assign /var/adm/boot.conf as configuration options file for this script.