Вы находитесь на странице: 1из 6

Boot sequence summary

 BIOS
 Master Boot Record (MBR)
 Kernel
 init

BIOS
Load boot sector from one of:

 Floppy
 CDROM
 SCSI drive
 IDE drive

Master Boot Record


 MBR (loaded from /dev/hda or /dev/sda) contains:
o lilo
 load kernel (image=), or
 load partition boot sector (other=)
o DOS
 load "bootable" partition boot sector (set with fdisk)
 partition boot sector (eg /dev/hda2) contains:
o DOS
 loadlin
o lilo
 kernel

LILO
One minute guide to installing a new kernel
 edit /etc/lilo.conf
o duplicate image= section, eg:
o image=/bzImage-2.2.12

o label=12

o read-only

o man lilo.conf for details


 run /sbin/lilo
 (copy modules)
 reboot to test

Kernel
 initialise devices
 (optionally loads initrd, see below)
 mount root FS
o specified by lilo or loadin
o kernel prints:
 VFS: Mounted root (ext2 filesystem) readonly.
 run /sbin/init, PID 1
o can be changed with boot=
o init prints:
 INIT: version 2.76 booting

initrd
Allows setup to be performed before root FS is mounted

 lilo or loadlin loads ram disk image


 kernel runs /linuxrc
o load modules
o initialise devices
o /linuxrc exits
 "real" root is mounted
 kernel runs /sbin/init
Details in /usr/src/linux/Documentation/initrd.txt

/sbin/init
 reads /etc/inittab
 runs script defined by this line:
o si::sysinit:/etc/init.d/rcS
 switches to runlevel defined by
o id:3:initdefault:

sysinit
 debian: /etc/init.d/rcS which runs
o /etc/rcS.d/S* scripts
 symlinks to /etc/init.d/*
o /etc/rc.boot/* (depreciated)
 redhat: /etc/rc.d/rc.sysinit script which
o load modules
o check root FS and mount RW
o mount local FS
o setup network
o mount remote FS

Example Debian /etc/rcS.d/ directory


README

S05keymaps-lct.sh -> ../init.d/keymaps-lct.sh

S10checkroot.sh -> ../init.d/checkroot.sh

S20modutils -> ../init.d/modutils

S30checkfs.sh -> ../init.d/checkfs.sh

S35devpts.sh -> ../init.d/devpts.sh


S35mountall.sh -> ../init.d/mountall.sh

S35umsdos -> ../init.d/umsdos

S40hostname.sh -> ../init.d/hostname.sh

S40network -> ../init.d/network

S41ipmasq -> ../init.d/ipmasq

S45mountnfs.sh -> ../init.d/mountnfs.sh

S48console-screen.sh -> ../init.d/console-screen.sh

S50hwclock.sh -> ../init.d/hwclock.sh

S55bootmisc.sh -> ../init.d/bootmisc.sh

S55urandom -> ../init.d/urandom

Run Levels
 0 halt
 1 single user
 2-4 user defined
 5 X11
 6 Reboot
 Default in /etc/inittab, eg
o id:3:initdefault:
 Change using /sbin/telinit

Run Level programs


 Run programs for specified run level
 /etc/inittab lines:
o 1:2345:respawn:/sbin/getty 9600 tty1
 Always running in runlevels 2, 3, 4, or 5
 Displays login on console (tty1)
o 2:234:respawn:/sbin/getty 9600 tty2
 Always running in runlevels 2, 3, or 4
 Displays login on console (tty2)
o l3:3:wait:/etc/init.d/rc 3
 Run once when switching to runlevel 3.
 Uses scripts stored in /etc/rc3.d/
o ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 Run when control-alt-delete is pressed

Typical /etc/rc3.d/ directory


When changing runlevels /etc/init.d/rc 3:
 Kills K##scripts
 Starts S##scripts

K25nfs-server -< ../init.d/nfs-server

K99xdm -< ../init.d/xdm

S10sysklogd -< ../init.d/sysklogd

S12kerneld -< ../init.d/kerneld

S15netstd_init -< ../init.d/netstd_init

S18netbase -< ../init.d/netbase

S20acct -< ../init.d/acct

S20anacron -< ../init.d/anacron

S20gpm -< ../init.d/gpm

S20postfix -< ../init.d/postfix

S20ppp -< ../init.d/ppp

S20ssh -< ../init.d/ssh

S20xfs -< ../init.d/xfs

S20xfstt -< ../init.d/xfstt

S20xntp3 -< ../init.d/xntp3

S89atd -< ../init.d/atd

S89cron -< ../init.d/cron


S99rmnologin -< ../init.d/rmnologin

Boot Summary
 lilo
o /etc/lilo.conf
 debian runs
o /etc/rcS.d/S* and /etc/rc.boot/
o /etc/rc3.d/S* scripts
 redhat runs
o /etc/rc.d/rc.sysinit
o /etc/rc.d/rc3.d/S* scripts

Вам также может понравиться