|PDF Format||Stage 1|
|How the usual linux boot process works ?|
- When you turn on the machine as part of the boot process the BIOS looks for a bootable media and loads the bootloader from a special area in the disk called the MBR (Master Boot Record). The bootloader in the case of linux will usually be LILO or GRUB.
- LILO (or GRUB) will attempt to load the kernel and an initial RAM disk (initrd) if that was defined in the config file (/etc/lilo.conf).
- Control is passed to the kernel, which will decompress the initrd and mount it as root device. You have to enable INITRD and Ram disk support in the kernel to have this happen.
- The kernel executes /linuxrc if it exists in the root device which will perform various pre-boot tasks such as the loading of additional drivers.
- Once linuxrc exits control is passed back to the kernel which will then mount the real root device as the root file system (like /dev/hda1). The real root device of the kernel can either be hard coded to the kernel using the rdev command or passed an argument from lilo (root=/dev/hda1)
- /sbin/init from the real root system is executed which uses /etc/inittab configuration to boot rest of the system. The important thing to note here is that /etc/inittab defines the default runlevel (usually 3 or 5) and as part of the boot process all scripts in /etc/rcX.d/ are executed.
|How the LiveCD boot process works ?|
- The El Torrito bootable cdrom format using the syslinux boot loading process uses floppy emulation to boot. The emulation process uses the boot.img as the filesystem image of a floppy disk. This info is given to the mkisofs program during the building of the iso image for burning to the cdrom. During the boot process, the boot.img is used as if it were from a floppy drive.
Note: In case of ISOLINUX the BIOS finds a bootable CDROM and loads the bootloader(ISOLINUX). Before the ISOLINUX bootloader was available, you needed to create a special bootable floppy image called an El Torito image. ISOLINUX will load the initrd and the kernel image and transfer control to the kernel.
- Located on that image is the ldlinux.sys driver which gets executed. The syslinux.cfg is a text file that is configuration for ldlinux.sys. It specifies files to display with various key-presses, and kernel files to load with their parameters such as ramdisk images. At this point in the booting, a user will have screen with different boot choices from which to pick.
- With the Knoppix cd, when the user picks one of those choices, either by waiting for the timeout period to expire or by typing in a selection such as 'knoppix lang=us', the kernel image and initrd image as specified by that entry in the syslinux.cfg configuration file, will be loaded into memory and the kernel (vmlinuz) is executed. The kernel will use the initrd as the initial root file- system. This root filessystem will be the miniroot.gz file on the boot.img file with Knoppix.
- Now, linuxrc is a script located in miniroot.gz that the kernel will execute as the first process. It does a number of things. For Eg. It is the linuxrc script, which gives the following message on the screen... Welcome to KNOPPIX live-linux CD. It first loads the cloop.o driver module and then searches cdroms and harddisk for the KNOPPIX image(/KNOPPIX/KNOPPIX).It finds the total RAM capacity. linuxrc mounts the KNOPPIX image, then builds a root in the initial ramdisk. Then it builds writable directories and symlinks on ramdisk.
Note: "cloop" is a "loop" with (de)compression (Compressed Loopback Device). Cloop is a Linux kernel module that enables compressed loopback filesystem support. With it you can mount a compressed filesystem like a block device and seamlessly decompress its data while accessing it. Compressed filesystems are slower, because each file has to be uncompressed again in each read, while cloop keeps the uncompressed blocks in the normal block layer filesystem cache.
- When the linuxrc script finishes, /etc/init is run.
- /etc/init is another very important process, which brings GUI on the screen. Init examines /etc/inittab before entering any multi-user runlevel, where it runs /etc/init.d/rcS(inittab sysinit line). /etc/init.d/rcS runs all the scripts in /etc/init.d/rcS.d. The essential script, which runs here is S00knoppix-autoconfig. S00knoppix-autoconfig does many things, some of which are listed here...
- Here language and keyboard specification and setting is done.
- Desktop will be set appropriately.
- All the settings are inserted into /etc/sysconfig and /etc/sysconfig/KNOPPIX.
- It finds and prints CPU information. It detects APM BIOS, PCMCIA bus, USB and firewall. It enables hotplug manager. It searches & configures the supported hardware and checks for options relevant to hardware setup. It configures mouse, sound card, AGP Bridge, Video, Monitor, etc. It scans harddisk partitions and puts it into /etc/fstab. It uses the swap space, if it is already created. It mounts certain devices automatically such as floppy,cdroms etc.
- init keeps looking at /etc/inittab and sees that it has to enter runlevel 5 by default(inittab default line). But before it goes to runlevel 5, it has to execute /etc/init.d/rc with the argument 5. /etc/init.d/rc 5 runs the scripts in /etc/rc5.d. Since /etc/rc5.d is empty, so nothing is done.
- init looks again at /etc/inittab and sees that the next thing to do for entering runlevel 5 is to run /bin/sleep with argument 2(i.e. wait for 2 seconds). After this it executes /etc/init.d/xsession with the argument start. /etc/init.d/xsession initially determines the runlevel, it has to enter. /etc/X11/Xsession checks various conditions such as whether tty is running? or the memory is enough to start X, then it generates X configuration.(Finally it starts X).
- /etc/init.d/xsession executes as user knoppix the script /etc/X11/xinit/xinitrc. This script in turn invokes script /etc/X11/Xsession, which is a Global session file. It is used by display managers and xinit(startx). /etc/X11/Xsession performs some sanity checks. After this it executes all the scripts in /etc/X11/xsession.d. Purpose of individual scripts within this directory is detailed here...
- /etc/X11/Xsession.d/20xfree86-common_process-args is called without args, so does nothing.
- /etc/Xsession.d/30xfree86-common_xresources loads X resources in /etc/X11/Xresources.
- /etc/X11/Xsession.d/45xsession sources various files created during knoppix-autoconfig containing hardware and locale configuration. It copies specific directories and files from /etc/skel/ (i.e. not whatever happens to be there at the moment). If the username is "knoppix", it also copies specific directories from /usr/share/knoppix/profile. It sets language for mozilla and netscape, and moves the $HOME/.mozilla/*/*/chrome/chrome.rdf.$LANGUAGE to $HOME/mozilla/*/*chrome/chrome.rdf. It creates automatic desktop icons and Kde is startup. Entire process is indicated by a GUI indicator, which is present in ksplash file.
- Finally GUI screen is up. By default KDE desktop is there in front of you,where you can work.
- When /etc/init.d/xsession ends and system is shut down.
|Current Status: dated March 16, 2005|
- Basic CD being prepared.
- We are trying to minimize the RAM requirement to run the CD...
- How to prevent modules from loading unnecessarily.
- How to determine the minimum recommended requirements for the CD being prepared.
|Plan for Final Stage|
- Making a GUI for the software
- Minimizing the hardware requirements
- Software should be able to prepare different versions of the CD having differnt softwares