0% found this document useful (0 votes)
306 views

Linux Boot Process

The Linux boot process begins when the CPU executes code stored in the BIOS located on the motherboard. The BIOS performs initial checks and loads the master boot record (MBR) from the boot disk, which loads the boot loader. The boot loader then loads the Linux kernel into memory and passes control to it. The kernel initializes devices and loads the init process. Init reads the /etc/inittab file to determine the default runlevel and starts programs needed for that runlevel, such as login services.

Uploaded by

mezgani ali
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
306 views

Linux Boot Process

The Linux boot process begins when the CPU executes code stored in the BIOS located on the motherboard. The BIOS performs initial checks and loads the master boot record (MBR) from the boot disk, which loads the boot loader. The boot loader then loads the Linux kernel into memory and passes control to it. The kernel initializes devices and loads the init process. Init reads the /etc/inittab file to determine the default runlevel and starts programs needed for that runlevel, such as login services.

Uploaded by

mezgani ali
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

The Linux Boot Process

Ali MEZGANI
[email protected]

May 19, 2008

1 / 14
Summary

BIOS (basic input/output system)


Master Boot Record (MBR)
Boot loader
Kernel
Init
Run Levels
The login process

2 / 14
Boot process

3 / 14
BIOS

On boot, the CPU initialize it self


Most registers in the CPU have well-defined
values after power up
CPU execute a code at address 0xFFFF0
This location is a jump to the BIOS which
reside in ROM on the motherboard.

4 / 14
BIOS

Power-on Self Test (POST) and check material


(graphic card, processor, memory, ...)
After the POST is complete, POST related code
is flushed out of memory.
Load boot sector from one of : Floppy,
CDROM, Hard drive, Network, usb
The boot order can be changed from within the
BIOS.

5 / 14
Master Boot Record (MBR)

BIOS load and execute the first 512 bytes of the disk
(sector 0), and returns control to MBR
Standard DOS MBR will look for a primary partition
(/dev/hda1..4) marked bootable
Load and execute first 512 bytes of this partition
Can be restored with fdisk /mbr from DOS
Load the boot loader (lilo, grub ...)

6 / 14
Boot loader

Load kernel and the initial ram disk to memory


Pass the control to the kernel image
Lilo : doesn’t understand filesystem
Grub : understand filesystem

7 / 14
Kernel

Initialize Stack and BSS


Decompress kernel image
initialize devices
Initramfs or initrd find the location of the
filesystem and pass that to the kernel as its root
filesystem.
The kernel read its root filesystem
Execute init process, run /sbin/init pid=1

8 / 14
Init

Kernel read /etc/inittab


Run boot scripts in /etc/init.d/
On debian: run /etc/init.d/rcS which runs:
/etc/rcS.d/S* scripts
Run programs specified in /etc/inittab

9 / 14
Run levels

0 halt
1 single user
2 full Multi-User mode (default)
3-5 same as 2
6 reboot

10 / 14
Run level programs

Scripts prefixed with S will be started when the


runlevel is entered, eg /etc/rc5.d/S99xdm
Scripts prefixed with K will be killed when the
runlevel is entered, eg /etc/rc6.d/K20apache
X11 login screen is typically started by one of
S99xdm, S99kdm, S99gdm or S99jwm
1:2345:respawn:/sbin/getty 9600 tty1

11 / 14
Run level programs

After the init process executes all the commands,


files and scripts, the last few processes are the
/sbin/mingetty ones, which shows the banner and
log-in message of the distribution you have installed.
The system is loaded and prepared so the user could
log in.

12 / 14
Additional Resources

http://www.debianadmin.com/the-lniux-boot-process-explained.html
http://www.ibm.com/developerworks/linux/library/l-linuxboot/
http://duartes.org/gustavo/blog/post/how-computers-boot-up
http://www.pixelbeat.org/docs/disk/

13 / 14
Colophon

Presentation produced using the Beamer class in


LATEX using the Kile editor on Debian 5.0.

14 / 14

You might also like