================================
Author: taoyuetao
Email:
[email protected]
Blog:
http://www.eetop.cn/blog/?11145
2006-11-06
================================
kernel/arch/arm/boot/compressed,
vmlinux、head.o、misc.o、head-xscale.o、piggy.o ,
head.o , ;
misc.o , head.o ;
head-xscale.o Xscale , head.o ;
piggy.o , (kernel/vmlinux), ;
vmlinux ( --lw:zImage ) , piggy.o、head.o、misc.o、head-xscale.o 。
BootLoader Linux , bootLinux(),
kernel 。 kernel , 。
kernel , , kernel 。
kernel arch/arm/boot/compressed/head.S。
decompress_kernel(), arch/arm/boot/compressed/misc.c ,
decompress_kernel() proc_decomp_setup(),arch_decomp_setup() ,
“Uncompressing Linux...” , gunzip()。 。
head.S :
(1) Arm CPU DEBUG , 。
(2) kernel , architecture ID。
(3) ARM2 CPU , , , 。
(4) LC0 delta offset, (r0 , r0 )。
, arch/arm/boot/Makefile、arch/arm/boot/compressed/Makefile
arch/arm/boot/compressed/vmlinux.lds.in , vmlinux.lds.in ,
LOAD_ADDR(_load_addr)=0xA0008000, TEXT_START(_text、_start) 0,BSS_START(__bss_start)=ALIGN(4)。
, , , (RAM) FLASH ,
, BOOTLOADER (zImage) RAM 0xA0008000 , (RAM) 0xA0008000 ,
r0 (0xA0008000)。 , 。
(5) , r0 BSS region GOT table 。
(6) bss r2-r3。
(7) C , 64K 。
(8) r2 ,r4 kernel ,r5 kernel 。 。
r5 r2, decompress kernel 64K 。
(9) misc.c decompress_kernel(), (r2 )。 :
r0 kernel
r4 kernel
r5 kernel
r6 CPU (processor ID)
r7 (architecture ID)
(10) reloc_start kernel (r5 r0 ), , reloc_start。
(11)reloc_start r5 kernel r4 。
(12) cache , cache, r7 architecture ID r1, r4 kernel 。
, decompress_kernel :
kernel/lib/inflate.c,inflate.c gzip 。 。
。gzip 32K ,
32K , window[WSIZE]。inflate.c get_byte() ,
。 inptr,inflate.c 。inflate.c flush_window()
window , outcnt 。 flush_window() ,
CRC crc 。 gunzip() , makecrc() CRC 。
gunzip() 0 。
:
Uncompressing Linux...done, booting the kernel.
decompress_kernel , puts() ,
puts kernel/include/asm-arm/arch-pxa/uncompress.h 。
, head.S , :
call_kernel: bl cache_clean_flush
bl cache_off
mov r0, #0
mov r1, r7 @ restore architecture number
mov pc, r4 @ call kernel
。