linux booting how does it work?. first the bootloader the first step is for the bootloader to run...

10
Linux booting How does it work?

Upload: shauna-cole

Post on 21-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

Linux booting

How does it work?

Page 2: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

First the bootloader

• The first step is for the bootloader to run

• BIOS indicates what devices to examine

• Bootstrap program looks on each of the devices indicated for a boot loader– Lilo– Grub

• Configuration files for booting in /boot

Page 3: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

Bootloader

• Kernel image is in /boot

• Reconfiguring lilo requires running the lilo command in order to rewrite the boot info. (similarly for grub)

• Mounts file system

Page 4: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

Mounting file system

• /etc/fstab

• Contains configuration to tell loader how to mount the file systems– What device– What directory to mount to– Type of file system

/dev/hdb8/varext3

/dev/hdb1 / ext3 defaults 1 1/dev/hdb8 /var ext3 defaults 1 2…

Page 5: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

init (the first process)• Executed after mounting file systems

• Configures itself by /etc/inittab• Run level -> which scripts to run at startup

# 3 - Full multiuser mode# 4 - unused# 5 - X11# 6 - reboot (Do NOT set initdefault to this)# id:3:initdefault:

Page 6: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

First rc script – rc.sysinit

• Executes some of the scripts in /etc/sysconfig including network– Defines relevant environment variables

• Lots of other scripts

• Messages seen during boot process

Page 7: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

Next rc scripts

• /etc/rc.d/rc 3– To run at level 3

• Does things like checking for the existence of the run files for that level

• Invokes the right ones

• “rc 3” -> run scripts in /etc/rc.d/rc3.d

Page 8: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

rc3.d scriptsK09dm@ S15gpm@ S26ypxfrd@ S56xinetd@ S85numlock@ S92lisa@K90mysql@ S16ypserv@ S31upsmon@ S60cups@ S85proftpd@ S95kheader@S08ipvsadm@ S17alsa@ S40atd@ S60nfs@ S89internet@ S99devfsd@S10network@ S18sound@ S40saslauthd@ S60rwhod@ S90crond@ S99linuxconf@S11portmap@ S20random@ S55named@ S66yppasswdd@ S90postgresql@ S99local@S12syslog@ S20xfs@ S55ntpd@ S75keytable@ S90squid@ S99mysql@S13partmon@ S25netfs@ S55sshd@ S80postfix@ S90webmin@S14nfslock@ S26apmd@ S56rawdevices@ S85httpd@ S91smb@

lrwxr-xr-x 1 root root 17 Oct 23 2002 S10network -> ../init.d/network*

•All scripts are actually in /etc/rc.d/init.d and linked to these.•K is used when killing•S is used as a startup script•Numerical value says order in which to run•Example: S10network says to run /etc/rc.d/init.d/network when starting up the system immediately after launching ipvsadm

Page 9: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

Example script network…case “$1” in start) … restart)

… stop) …

/etc/rc.d/init.d/network

[root@testmachine] init.d% ./network restart

Runs the scripts with restart option

Page 10: Linux booting How does it work?. First the bootloader The first step is for the bootloader to run BIOS indicates what devices to examine Bootstrap program

dmesgdmesgLinux version 2.4.19-16mdk ([email protected]) (gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk)) #1 Fri Sep 20 18:15:05BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 0000000000080000 (usable) BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved) BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 0000000005fec000 (usable) BIOS-e820: 0000000005fec000 - 0000000005fef000 (ACPI data) BIOS-e820: 0000000005fef000 - 0000000005fff000 (reserved) BIOS-e820: 0000000005fff000 - 0000000006000000 (ACPI NVS) BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved) BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved) BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)95MB LOWMEM available.Advanced speculative caching feature not presentOn node 0 totalpages: 24556zone(0): 4096 pages.zone(1): 20460 pages.zone(2): 0 pages.Kernel command line: BOOT_IMAGE=linux ro root=341 quiet devfs=mountFound and enabled local APIC!Initializing CPU#0Detected 929.225 MHz processor.Console: colour dummy device 80x25…