/StartUp & Shutdown

StartUp & Shutdown

We will begin with linux startup flow.

1- power on ….

2- Bios : a small program in EEPROM (Electrical Erasable Programmable Read Only Memory.

Bios function

  1. check memory
  2. check for the availabiltity aboot devices
  3. loads Master Boot Record (MBR) of the first availale boot device .

MBR (master boot record) : it’s size 512 bytes

 

  1. 446 bytes for boot loaer .
  2. 64 bytes for partition table .
  3. 2 bytes magic number .


3- Boot Loader : after loades MBR , boot loader make its function .

 

function : check partition table and looks for a partition that is marked “active”.

 

Examples of boot loader : grub and lilo ,the most common now is grub (grand unified boot loader). Boot loader stored in MBR.

grub stages

  1. called stage 1 , is usually stored in your MBR.
  2. called stage 1.5 , This stage is used to add filesystem capabilities to GRUB, so that GRUB is able to use regular filename references when loading configuration files, kernels and such, instead of disk block locations.
  3. called stage 2 , This gives a menu interface which allows you to boot your predefined operating systems, or enter commands to boot a non-predefined operating system.

 

kernal : When the user selects a Linux operating system in the boot loader, then the boot loader will

load the Linux kernel.

Kernal function :

  1. it detects all hardware .
  2. switches the cpu to multitasking and multiuser mode.

For more informations about kernal back to this topic linux kernal .

 

5- Init : started by the kernal , it decide runlevel mode .

runlevels

  • 0: halt
  • 1: single user mode
  • 2: multiuser without NFS
  • 3: full multiuser mode
  • 4: unused
  • 5: multiuser with graphical login
  • 6: reboot

 

 

we can moves from runlevel to another by runlevel command.

runlevel +runlevelnum

 

Example

runlevel 6 the system will reboot.