Kernel Internals
From wikiPodLinux
| Table of contents |
[edit]
About
This page gives information about how the Kernel starts up and works, specific to iPodLinux
[edit]
Kernel Startup
[edit]
Overview
For general startup information in Linux kernels, see these:
- http://www.faqs.org/docs/Linux-HOWTO/Linux-Init-HOWTO.html
- http://www.faqs.org/docs/Linux-HOWTO/KernelAnalysis-HOWTO.html#s4
The configuration for bulding the kernel is stored in the file .config at the root of the linux directory tree.
Here's a list of resulting defines when the kernel gets built for iPL:
- PROCESSOR = armv
- MACHINE = ipod
- TEXTADDR = 0x00008000 -- entry offset for the kernel initialization
Directories and files of interest:
- arch/armnommu/mach-ipod/
- arch/armnommu/mm/
- include/asm-armnommu/arch-ipod/
- arch/armnommu/kernel/head-arm-ipod.S -- kernel initialization starts here
- arch/armnommu/kernel/entry-armv.S -- entry code for hardware interrupt calls
- arch/armnommu/kernel/entry-common.S -- entry code for software interrupt calls
[edit]
Initialization sequence
- The bootloader loads the kernel file into SDRAM at either 0x2800000 (PP5002) or 0x10000000 (PP502x) and jumps to offset 0x8000 in it.
- Inside arch/armnommu/kernel/head-arm-ipod.S:
- A small part of the code (between install_reloc_start and install_reloc_end) is copied to IRAM at 0x40010000,
- a few registers are prepared for modifying the Memory Controller,
- the moved code is executed, in which the memory controller registers are set, mapping the SDRAM to start at address 0 now.
- The Coprocessor is put to sleep (post_reloc_start).
- The Stack Pointer is set (8KB in size), BSS gets cleared (that's the memory area for global variables), then calls the following subroutines (all inside arch/armnommu/mach-ipod/hardware.c):
- ipod_set_sys_info -- sets up the sysinfo_t struct
- ipod_init_cache -- appears to enable the CPU's internal and/or 2nd level caches
- ipod_set_cpu_speed -- appears to set the CPU's speed to 75 MHz
- Finally, it jumps to start_kernel.
- Inside init/main.c, function start_kernel():
- Invokes setup_arch(), which is inside arch/armnommu/kernel/setup.c and which, amoung other operations, can fetch arguments (command line) that may be passed from Loader 2.
To Be Continued...
[edit]
Kernel Drivers
iPod specific kernel drivers
