ARM Linux boot sequenceThe following traces the Linux boot sequence for ARM-based systems in the 2.6.18 kernel. it looks at just the earliest stages of the boot process, until the generic non-processor-specific start_kernel function is called. the line numbers of each statement are in parenthese at the end of the line; the kernel source itself can be conveniently browsed on the Linux cross-reference website.
Zimage Decompression
- ARCH/ARM/boot/compressed/head. S: Start (108)
- First code executed, jumped to by the bootloader, at label "start" (108)
- Save contents of registers R1 and R2 in R7 and R8 to save off architecture ID and atags pointer passed in by bootloader (118)
- Execute arch-specific code (inserted at 146)
- ARCH/ARM/boot/compressed/head-xscale.S or other arch-specific code file
- Added to build in arch/ARM/boot/compressed/makefile
- Linked into head. s by linker section Declaration:. Section "START"
- Flush cache, turn off cache and MMU
- Load registers with stored parameters (152)
- SP = Stack pointer for decompression code (152)
- R4 = zreladdr = kernel entry point physical address
- Check if running at link address, and fix up global offset table if not (196)
- Zero decompression BSS (205)
- Call cache_on to turn on cache (218)
- Defined at ARCH/ARM/boot/compressed/head. S (320)
- Call call_cache_fn to turn on Cache as appropriate for processor Variant
- Defined at ARCH/ARM/boot/compressed/head. S (505)
- Walk through proc_types list (530) until find corresponding Processor
- Call cache-on Function in list item corresponding to processor (511)
- For armv5tej core, cache_on function is _ armv4_mmu_cache_on (417)
- Call setup_mmu to set up initial page tables since MMU must be on for cache to be on (419)
- Turn on Cache and MMU (426)
- Check to make sure won 'toverwrite image during decompression; assume not for this trace (232)
- Call decompress_kernel to decompress kernel to Ram (277)
- Branch to call_kernel (278)
- Call cache_clean_flush to flush cache contents to Ram (484)
- Call cache_off to turn cache off as expected by kernel initialization routines (485)
- Jump to start of kernel in RAM (489)
- Jump to address in r4 = zreladdr from previous load
- Zreladdr = zreladdr-y
- Zreladdr-y specified in arch/ARM/mach-vx115/makefile. boot
Arm-specific kernel code
- ARCH/ARM/kernel/head. S: stext (72)
- Call _ lookup_processor_type (76)
- Defined in arch/ARM/kernel/head-common.S (146)
- Search list of supported processor types _ proc_info_begin (176)
- Kernel may be built to support more than one processor type
- List of proc_info_list structs
- Defined in arch/ARM/MM/proc-arm926.S (467) and other corresponding proc-*. s files
- Linked into list by section Declaration:. Section ".proc.info. init"
- Return pointer to proc_info_list struct corresponding to processor if found, or loop in error if not
- Call _ lookup_machine_type (79)
- Defined in arch/ARM/kernel/head-common.S (194)
- Search list of supported machines (boards)
- Kernel may be built to support more than one board
- List of machine_desc structs
- Machine_desc struct for boards defined in board-specific file vx115_vep.c
- Linked into list by section declaration that's part of machine_desc macro
- Return pointer to machine_desc struct corresponding to machine (Board)
- Call _ create_page_tables to set up initial MMU tables (82)
- Set lr to _ enable_mmu, R13 to address of _ switch_data (91, 93)
- LR and R13 used for jumps after the following cballs
- _ Switch_data defined in arch/ARM/kernel/head-common.S (15)
- Call the _ cpu_flush function pointer in the previusly returned proc_info_list struct (94)
- Offset is # procinfo_initfunc into struct
- This function is _ arm926_setup for the arm 926ej-s, defined in arch/ARM/MM/proc-arm926.S (392)
- Initialize caches, writebuffer
- Jump to LR, previously set to address of _ enable_mmu
- _ Enable_mmu (147)
- Set page table pointer (TTB) in MMU hardware so it knows where to start page-Table walks (167)
- Enable MMU so running with virtual addresses (185)
- Jump to R13, previously set to address of _ switch_data, whose first field is address of _ mmap_switched
- _ Switch_data defined in arch/ARM/kernel/head-common.S (15)
- ARCH/ARM/kernel/head-common.S: _ mmap_switched (35)
- Copy Data Segment to Ram (39)
- Zero BSS (45)
- Branch to start_kernel (55)
Processor-independent kernel code
- Init/Main. C: start_kernel (456)