The Most pending activity finally started two days before. Activities involved in porting are - Getting the First Printk for showing "Uncompressing Kernel"
- Getting early Printk to to show any error messages before our start_kernel gets called.
- Memory mapping all the peripherals
- Putting things in place for proper interrupt handling.
- Getting the clock i/f up.
- Bringup timer for ticking jiffies.
- Getting actual printk working.
Things to understand: - Memory Map of Linux kernel
- How Kernel expands.(w.r.t memory regions)
Boot Up Sequence for ARM(compressed image like zImage/uImage): - Bootloader like uboot should pass the information to kernel using registers r0 to r2 and will consider the below settings
CPU register settings o r0 = 0. o r1 = machine type number discovered in (3) above. o r2 = physical address of tagged list in system RAM. CPU mode o All forms of interrupts must be disabled (IRQs and FIQs.) o The CPU must be in SVC mode. (A special exception exists for Angel.) Caches, MMUs o The MMU must be off. o Instruction cache may be on or off. o Data cache must be off and must not contain any stale data. Devices o DMA to/from devices should be quiesced. The boot loader is expected to call the kernel image by jumping directly to the first instruction of the kernel image. - First function of arm boot up is start() function from arch/arm/boot/compressed/head.S
- The start() function will call decompress_kernel from arch/arm/boot/compressed/misc.c this is where first life of kernel is seen on UART, this function dumps the below string
- Uncompressing Linux...................................................done, booting the kernel.
- The above string on UART is seen using two helper functions arch_decomp_setup() and putc() functions which are internally called by decompress_kernel and should be implemented in include/asm/arch/uncompress.h
Here ends the first Part of the Story............................................... and Begin of PART-2 - there is a magic number 0x016f2818 which helps the loader
Some Interesting things: - U-boot starts the kernel at different address than the load address.
- printks executed before console_init are cached and shows up only after console_init is called.
- Using printascii after enabling CONFIG_DEBUG_LL in any part of the kernel
Pending Activities: - Bringup Actual printk.
- document all the process.
|
|