Bering-uClibc 6.x - User Guide - Appendices - Overview of the Startup Sequence
Appendices - Overview of the Startup Sequence | ||
---|---|---|
Prev | Bering-uClibc 6.x - User Guide | Next |
Contents
Step 1: BIOS and Boot Device
The BIOS is typically configured with an ordered list of devices which are checked in turn until a valid boot device is found. These devices can be:
- A hard disk drive (or a flash drive pretending to be a hard drive).
- An optical disk drive (such as a CD-ROM or DVD drive).
- A network interface card containing a network boot ROM.
Any of these can be used to boot Bering-uClibc 6.x.
Step 2: Boot Loader
Bering-uClibc 6.x uses one of SYSLINUX, ISOLINUX or PXELINUX as the boot loader, depending on the type of boot device being used.
For the most part these tools behave in the same way - there is a configuration file which defines what to load next:
-
syslinux/syslinux.cfg
on the SYSLINUX boot disk. -
isolinux/isolinux.cfg
on the ISOLINUX boot disk. -
pxelinux.cfg/default
(or similar) on the PXELINUX TFTP server.
Each of these file contains lines like the following:
DISPLAY syslinux.dpy TIMEOUT 0 APPEND reboot=bios VERBOSE=1 DEFAULT /syslinux/linux initrd=/initrd.lrp rw root=/dev/ram0 LEAFCFG=/dev/sda1:vfat
This example is for SYSLINUX but the others are very similar.
The "DISPLAY" line dumps the contents of the .dpy
file to the boot console.
This is what displays the LEAF Project "shield" logo shown below:
(Actually this screenshot was taken slightly later in the boot sequence, but you get the idea.)
The "TIMEOUT" line means that there is no delaying waiting in case there is any keyboard input.
The "APPEND" line defines some extra command-line arguments which are "appended" to the kernel command line.
The "DEFAULT" line is the important one:
- The text "/syslinux/linux" specifies the name of the kernel image file to boot.
- The text "initrd=/initrd.lrp" specifies the name of the INITial RAM Disk image file to load.
- The text "rw" specifies that the initrd file shall be mounted read-write (rather than read-only).
- The text "root=/dev/ram0" specifies that the first RAM disk shall be used as the "root" disk.
- The text "LEAFCFG=/dev/sda1:vfat" defines a value for kernel command-line argument "LEAFCFG" which is used later.
The boot loader (*LINUX) uncompresses the kernel file and loads it into memory, together with the initrd. It then passes control to the kernel.
Step 3: Linux kernel and initrd
The Linux kernel starts executing against the contents of the initrd disk image.
Any arguments specified on the kernel command-line which the kernel recognises are processed. (Some other arguments, like "LEAFCFG", are not recognised by the kernel itself but are used in later processing.)
Some initial initialization is performed and then Shell script /init
is executed.
Step 4: /init
Shell script /init
(actually a symbolic link to /var/lib/lrpkg/root.linuxrc
) is a critical file with a huge influence on the startup of a Bering-uClibc 6.x machine.
In summary, this script:
- Creates the
/proc/
directory and mounts the "proc" filesystem at that location. - Creates the
/sys/
directory and mounts the "sysfs" filesystem at that location. - Creates the symbolic links for all of the commands provided by the "busybox" executable.
- Loads the modules to access your harwdare devices and additional modules needed by Packages to access kernel functions.
- It mounts the disk device specified by kernel command-line argument "LEAFCFG". Device drivers and filesystem drivers, currently vfat, isofs and ext4, to access hard disks or CD-ROM devices are compiled into the kernel.
- This variable can be set to a list of entries. The first one in the list containing a file called
leaf.cfg
is used. - This behaviour permits a default
leaf.cfg
on read-only media (such as a CD-ROM) to be overridden by a modifed copy on read-write media (such as a floppy disk). - By default there is a 1-second "wait" before mounting the disk device, which allows some time for device drivers to load before proceeding. On some hardware this may not allow sufficient time for the drivers to fully load, in which case the symptom is that
leaf.cfg
cannot be found. The delay can be adjusted by specifying a value for kernel command-line argument "usb_wait". - Module loading is done almost automatically by mounting the squashfs file image
modules.sqfs
from the disk device and loading all modules and dependencies which implement device drivers for installed hardware. - Additional modules which are not related to hardware have to be specified in
/etc/modules
, e.g. the module to build tunnelstun.ko.gz
.
- "Sources" file
leaf.cfg
in the current shell, to set variables required by later processing. - Creates a standard set of empty directories
- For example
/mnt/
,/var/run/
.
- For example
- Mounts the disk device(s) specified by variable "PKGPATH".
- Variable "PKGPATH" is specified in
leaf.cfg
. - Like "LEAFCFG" this can specify a list of entries.
- Invalid entries are ignored but valid entries are used to populate file
/var/lib/lrpkg/pkgpath.disks
and modified Packages are saved to the first entry in that file.
- Variable "PKGPATH" is specified in
- Loads all of the Packages listed against variable "LRP", provided the corresponding
.lrp
file can be located in "PKGPATH".- Variable "LRP" is specified in
leaf.cfg
.
- Variable "LRP" is specified in
- Unmounts the devices for "LEAFCFG" and "PKGPATH".
- Mounts the "future" root filesystem (type "tmpfs") in a dummy directory.
- Mounts separate "tmpfs" file systems under directories
/tmp/
and/var/log/
. - Recursively copies the files and directories created earlier (e.g. by loading the Packages) across to the "future" root directory.
- Uses the "switch_root" utility to start using the "future" root directory in place of the original (initrd) one.
- If all went well it finally starts
/sbin/init
, the mini init implementation ofbusybox
, for the remaining boot-time system configuration/initialization.
Step 5: init
init
runs the initialization scripts located in /etc/rc*.d
and launches /sbin/getty
on terminals under the control of /etc/ttys
.
-
/etc/inittab
holds the configuration forinit
.
For users most important is to set the terminals settings especially for serial consoles accordingly. For console terminals it looks like
tty1::respawn:/sbin/getty 38400 tty1
For a serial console a line like
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
needs to be activated.
A complete reference for /etc/inittab
can be found on busybox.net
-
/etc/init.d/*
is the directory holding all shell scripts and daemons which should be started during boot to finish the boot process. Please note thatbusybox
implementation ofinit
does not support runlevels. Though for historic reasons, and to alleviate moving forward to a more feature-rich init implementation all scripts and daemons has links to run-levels (/etc/rc?.d/*
).
Prev | Up | Next |