What exactly happens when u boot!

In the case of Linux, the following steps are performed to boot the kernel:

1) The boot loader program (e.g. lilo or grub) starts by loading the vmlinuz from disk into memory, then starts the code executing.
2) After the kernel image is decompressed, the actual kernel is started. This part of the code was produced from assembler source; it is totally machine specific. Technically at this point the kernel is running. This is the first process (0) and is called swapper. Swapper does some low level checks on the processor, memory and FPU availability, then places the system into protected mode. Paging is enabled.
3) Interrupts are disabled (every one) though the interrupt table is set up for later use. The entire kernel is realigned in memory (post paging) and some of the basic memory management structures are created.
4) At this point, a function called start_kernel is called. start_kernel is physically located in /usr/src/linux-2.4.18-27.7.x/init/main.c and is really the core kernel function - really the equivalent of the void main(void). main.c itself is virtually the root file for all other source and header files.
5) start_kernel sets up the memory, interrupts and scheduling. In effect, the kernel has now has multi-tasking enabled. The console already has had several messages displayed to it.
6) The kernel command line options are parsed (those passed in by the boot loader) and all embedded device driver modules are initialized.
7) Further memory initializations occur, socket/networking is started and further bug checks are performed.
8) The final action performed by swapper is the first process creation with fork whereby the init program is launched. Swapper now enters an infinite idle loop.

It is interesting to note that as a linear program, the kernel has finished running! The timer interrupts are now set so that the scheduler can step in and pre-empt the running process. However, sections of the kernel will be periodically executed by other processes.


This is the boot sequence from a kernel point of view. For a more comprehensive Boot Sequence explanation... you can view my friend's blog HERE.




Page copy protected against web site content infringement by Copyscape

2 comments:

Kevin said...

point 56789 are amazing ..was nice marauding work to it especially the main.c u mentiond..

i will delete main.c in my rivals PC...hhehehehe

Kevin said...

i want to know more about point 2.
actual kernel....waz d difference where is it located..the actual kernel which gets started after decompression of kernel....


i really had gud time visiting ur blog..keep this shooting high..