Linux Boot Process – Kernel

Home / Linux Boot Process – Kernel

Linux Boot Process – Kernel

December 9, 2015 | Article | No Comments

In order for a computer to successfully boot into device we know, a computer should pass some process which we refer as boot process. The BIOS, operating system, and harware components must all be working properly. Failure of any of these three elemens will likely result in a failed boot sequence.

After a boot loader does it jobs (load the kernel) it will terminate itself and the control will be passed to the kernel.

When a Linux kernel is loaded and ran, it is actually running two process for completely load kernel to memory. First one is bootstrapping, and second one is the process in the kernel itself.

In earlier phase kernel will use a bootstrap which is assembly code added to the image. When bzImge is loaded , the code of bootstrap starts executing. The tasks of bootstrap are,

  1. Forcing cpu to go into protected mode. In protected mode we have 4 GB of virtual address space or virtual addressing enabled.
  2. Enabling the MMU (Memory Management Unit) . MMU has got address translation ability , mapping between virtual addresses and physical addresses. CPU contains MMU instruction set.
  3. Decompressing the linux kernel. You can see “Decompressing Linux….” Messages on console at this point.
  4. Calling “start_kernel” function after that. start_kernel is similar to main function. kernel image starts running and initializes all the devices , schedulers, console etc. . You can see lot of text flying on the screen related to this. kernel boots up from here.

When bootstrapping done, the kernel take the process. Kernel does:

  1. Kernel initialize CPU and performs the “Bogo MIPS” calculation. Though BIOS has already intialized CPU but kernel does not depend upon BIOS initialization. It will re-initialize the CPU again. It will create one structure and stores all the CPU details in it. After that it performs “Bogo MIPS”calculation. Using “Bogo MIPS” calculation kernel estimates the cpu speed. At bootup time, you can see the message ” Bogo MIPS is …..” .
  2. Kernel re-initializes parallel ports, serial ports and all the on-board controllers like USB, IDE, SCSI, Serial, parallel, timers, RTC etc. These startup drivers are also called BSP drivers or Board Support Drivers.
  3. Interrupts will be enabled. All the data structures required to hold the interrupts including interrupt descriptor table will be setup , i.e. which device is using which interrupt, IRQ details will be filled.

  4. File system required to read from this disk, /boot , /root , /etc , /home etc. is initialized. File system must be loaded now so that can now start using disk.

  5. After this loader will be started. Loader starts a process that is registered in the PCB with PID ‘0’ . Name of this process is swapper.

  6. “swapper” will start a thread called “init” thread. “init” is a kernel thread. “init” kernel thread will look into /bin and look for a program whose name is “init”. This kernel thread is told for where to look for init process via boot parameter in bootloader configuration file. If kernel thread doesn’t find init there , it becomes a reason for kernel panic and the booting stops there. This may also happen if file system is not initialized . “init” thread looks into /bin and starts executing init process. init’s parent is “init” thread. /bin/init is registered as PID 1 and this is the first user space process.

Kernel has loaded, but the booting process has not stopped yet.


About Author

about author


A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial