Booting Linux: Chanik Park Cipark@postech - Edu
Booting Linux: Chanik Park Cipark@postech - Edu
2004
1/16
BIOS selects the boot device BIOS loads the bootsector from the boot device Linux bootsector (arch/i386/boot/bootsect.S) LILO (or other bootloaders) bootsector Bootsector loads setup, decompression routines and compressed kernel image The kernel is uncompressed in protected mode Low-level initialization is performed by asm code High-level C initialization
2004
2/16
2004
3/16
Boot Loaders
Operation
decide what to load (by prompting user). load kernel and possibly additional data, such as initrd or parameters for kernel (retrieved from firmware or boot command line). set up an execution environment suitable for kernel (e.g., put CPU in privileged mode). run kernel.
2004
4/16
Taxonomy
Specialized loaders : LinuxBIOS, syslinux, Netboot General loaders running under another operating system : LOADLIN, ArLo File system aware general loaders running on firmware : Shoelace (Minix FS), GRUB, SILO File system unaware general loaders running on firmware : LILO requires map installer (/sbin/lilo)
2004
5/16
time
2004
7/16
i386 Dependency
1024 cylinder limit (due to BIOS)
LILO uses BIOS for all disk operations EDD (Enhanced Disk Drive Spec) in 1995 Support for EDD added to LILO in 1999
2004
8/16
Loading bzImage
2004
9/16
So, changes in boot loaders are not likely to be feasible. Then, extensions of boot process within the kernel.
Be architecture-independent !
2004
10/16
Mount root file system Need to know where it is. Need driver to access the media. Run user-space programs Early days : a set of pre-compiled kernels containing only a small number of drivers each (due to conflicting drivers) load module chosen by user ? Now : let the boot loader load kernel modules Initial RAM disk called initrd : a single file to make the work of boot loader simple
11/16 CS 512 Advanced Operating System
2004
initrd
Usage either for regular root file system or as an intermediate environment before switching to real root file system : run /linuxrc before switching Main limitation Memory for initrd file, RAM disk, any other data kernel needs at that time, and kernel Thus, the size of compressed initrd ~ 1/3 of memory not occupied by kernel (see figure)
12/16 CS 512 Advanced Operating System
2004
Q : changing a carpet while standing on it ? A1 : jump up change_root A2 : roll out a new one next to the old one and walk over pivot_root other ?
2004
13/16
Kernel itself can access any resources. many file systems, RAID, TCP/IP, NFS, SMB, DHCP, HTTP, Whats missing ? A method to boot a Linux kernel from within Linux bootimg LOBOS Two Kernel Monte Etc. * Assignment #1 : report on bootimg, LOBOS, (1 week)
Linux boots stand-alone from floppy Shoelace is used to boot from Minix filesystem on hard disk 1992 LILO (from any) / BOOTLIN (from DOS) 1994 LOADLIN replaces BOOTLIN / SYSLINUX reads FAT floppies 1995 GRUB, a modern FS-aware boot loader 1991 root FS device can be set in kernel image 1995 NFS root mounts root FS from NFS server 1996 initial RAM disk support added to kernel / change_root mechanism 2000 pivot_root / union root mount / early freeing of initrd memory pages
15/16 CS 512 Advanced Operating System
1996 Netboot boots from Ethernet, using TFTP 1999 GRUB supports TFTP boot 2000 Linux boots Linux / LinuxBIOS
2004
16/16