2.Bootstrap code
head.o: Architecture specific initialization code. This is what is
executed by the bootloader.
1. Check the
architecture, processor and machine type.
2. Configure the
MMU, create page table entries and enable virtual memory.
3. Calls the start_kernel
function in init/main.c.
head-cpu.o (here head-xscale.o): CPU specific initialization code
decompress.o, misc.o: Decompression code
lib1funcs.o: Optimized ARM division routines (ARM only)
start_kernel main actions:
1. Calls setup_arch(&command_line)
(defined in arch/<arch>/kernel/setup.c),
copying the command line from where the bootloader left it. On arm, this
function calls setup_processor(in
which CPU information is displayed) and setup_machine(locating
the machine in the list of supported machines).
2. Initializes the console as early as
possible (to get error messages).
3. Initializes many subsystems (see the
code)
4. Eventually calls rest_init(Starting a
new kernel thread which will later become the init process).
kernel_init does
two main things:
1.Call do_basic_setup(Now
that kernel services are ready, start device initialization)
2.Call init_post(First
tries to open a console; Then tries to run the init process, effectively
turning the current kernel thread into the userspace init process.)
static void __init do_basic_setup(void)
{
cpuset_init_smp();
usermodehelper_init();
init_tmpfs();
driver_init();
init_irq_proc();
do_ctors();
do_initcalls();
}
usermodehelper_init();
init_tmpfs();
driver_init();
init_irq_proc();
do_ctors();
do_initcalls();
}
3.Kernel initialization graph
• The bootloader executes bootstrap code.
• Bootstrap code initializes the processor and board, and uncompresses the kernel code to RAM, and calls the kernel's start_kernel function.
• Copies the command line from the bootloader.
• Identifies the processor and machine.
• Initializes the console.
• Initializes kernel services (memory allocation, scheduling, file cache...)
• Creates a new kernel thread (future init process) and continues in the idle loop.
• Initializes devices and execute initcalls.
4.Kernel Image








No comments:
Post a Comment