140 likes | 438 Views
Booting the Linux Kernel. Dr. Michael L. Collard www.sdml.info/collard www.sdml.info/collard/linux collard@cs.kent.edu. Architecture. Core kernel Possibly with some device support built in Modules LKM (Loadable Kernel Module) – can be added/removed/replaced at run time
E N D
Booting the Linux Kernel Dr. Michael L. Collard www.sdml.info/collard www.sdml.info/collard/linux collard@cs.kent.edu
Architecture • Core kernel • Possibly with some device support built in • Modules • LKM (Loadable Kernel Module) – can be added/removed/replaced at run time • Provide device support: file system, usb, etc. • Note: LKM considered “derivative works” of the kernel. Binary-only modules “taint” the kernel
initrd • Modular kernel – modules added without rebooting • Problem: root filesystem is on a device whose driver is a module? • initrd – two stage kernel boot process • Mount temporary root filesystem (RAM disk) of essential modules, e.g., ext3, SCSI • Mount real file system
Boot Methods • Single boot • Boot directly into an operating system • Dual booting • Choose from 2 (or more) operating systems • Share hardware with multiple operating systems • Boot different versions of the same o.s. • Boot for specific purposes, i.e., memtest
Booting • Direct boot • Hard drive, CD ROM, USB • loadlin – MS-DOS program to boot Linux from DOS • LILO – LInux Loader • Simple boot into multiple operating systems • GRUB – GRand Unified Bootloader • GNU graphical boot loader
x86 Boot Process • Boot sector • 512 byte, first sector of a hard disk • Contains partition table • May contain code to boot the o.s. • MBR (Master Boot Record) • BIOS transfers control to boot loader code to start o.s. • Secondary boot loader – MBR transfers to boot loader on another partition
LILO (LInux LOader) • Text-based menu to select image to boot • Installed in MBR (or run as secondary boot loader) • Consists of: • configuration: /etc/lilo.conf • map file: /boot/map • MBR: code to choose image • lilo command: run to setup map and MBR
LILO (cont) • Partitions and devices: • /dev/hda, /dev/hda1, /dev/hdb, /dev/hdb2, /dev/sda, /dev/sda1 • After changing configuration file lilo.conf, must rerun lilo command (!)
GRUB • GRand Unified Boot Loader • GNU Project, Multiboot Specification • Graphical menu • Edit an entry • Command interface for recovery and manual booting • No need to reinstall MBR after a configuration change
GRUB Process • Stage 1: MBR • Transfers control to Stage 1.5 or Stage 2 • Stage 1.5: filesystem-specific code • E.g, e2fs_stage1_5, fat_stage1_5 • Stage 2: main part of code • Menu, selection, start
GRUB (cont) • Consists of: • GRUB directory: /boot/grub • Configuration: grub.conf, menu.lst (typically symbolic link) • Partitions and Devices • hd0, (hd0, 0), (hd1, 1) • No differences between IDE and SCSI
GRUB Menu • Countdown timer • Keys: • Enter – to boot • e – edit command line • a – modify kernel arguments • c – command line • esc – to get back
ELILO • Standard boot loader for EFI hardware • EFI • replacement for BIOS • Originally developed by Intel, now managed by United EFI • UEFI version 2.1 release January, 2007 • EFI is on Itanium 2, Intel motherboards (but may be in BIOS legacy mode), and Intel-based Macs