Embedded Linux: Kernel Make (compressed with boot)
kernel
in $(TOPDIR)
% make -- $(TOPDIR) linux ( vmlinux) . % file linux ELF 32-bit LSB executable, Advanced RISC Machines ARM, version 1, statically linked, not stripped
kernel
: File sequence
head-armv.S or head-arm-dsc21.S main.c
arch/armnommu/kernel init/
. . . .
http://network.hanbat.ac.kr Embedded Linux 2
arch/arm/kernel/head-armv.S
Set
bl __lookup_processor_type
r0 = 0, r1= unique architecture number, MMU = off, I-cache = on/off, D-cache = off mode to supervisor, all IRQs to disable
bl __lookup_architecture_type goto __mmap_switched
goto __arm720_setup (in file proc-arm720.S) goto SYMBOL_NAME(start_kernel)
http://network.hanbat.ac.kr
Embedded Linux
Linux architecture-independent initialization
Refer
http://www.linuxdoc.org/HOWTO/Linux-Init-HOWTO-5.html setup_arch()
main.c/start_kernel()
trap_init(), init_IRQ() /* initialize IRQ handler */ sched_init() softirq_init() time_init(); /* initialize timer */ console_init() init_modules() kmem_cache_init(), mem_init(), mount initrd (maybe) cpu_idle();
Embedded Linux
setup_processor() setup_architecture(machine_arch_type) init_bootmem_node(), free_bootmem(), paging_init(),
http://network.hanbat.ac.kr
kernel
(not completed)
* (.text.init)
x16
_stext, __init_begin __proc_info_begin __proc_info_end, __arch_info_begin __arch_info_end __setup_start __setup_end, __initcall_start _text
* (.proc .info) * (.arc h.info) * (.data.init) * (.setup.init) * (.initc all.init) * (.text) ...
.init
x 4096
.text
* (__ex_table) * (__ksymtab) * (__kallsyms) * (.got)
__start___ex_table __stop___ex_table, __start___ksymtab __stop___ksymtab, __start___kallsyms __stop___kallsyms, _etext
http://network.hanbat.ac.kr
Embedded Linux
boot/compressed/vmlinux
boot/zImage
$(TOPDIR)/arch/ armnommu/boot/ compressed/vmlinux
, in ...boot/c ompressed/ head-armv.S or head-arm-dsc21.S main.c
$(TOPDIR)/arch/ armnommu/boot/ zImage
head.o misc.o kernel (piggy.o)
y objcop
zImage
. . .
y objcop gzip, ld
http://network.hanbat.ac.kr
Embedded Linux
$(TOPDIR)/arch/armnommu/boot/compressed/vmlinux
*(.start) *(.text) *(.fixup) *(.gnu.warning) *(.rodata) *(.rodata.*) *(.glue_7) *(.glue_7t) piggy.o data bss stack *(.data) *(.bss) *(.stack) LOAD_ADDR, _load_addr, TEXT_START, _text, _start
text
input_data input_data_end, _etext _edata, BSS_START, __bss_start _end user_stack, sp (initially)
7
http://network.hanbat.ac.kr
Embedded Linux
Flash Image
...boot/bootp/bootp (Flash )
init.o zImage
ld
kernel.o initrd.o
flash kernel.o initrd.o RAM , kernel.o in .../boot/bootp/
ld
initrd
Embedded Linux
http://network.hanbat.ac.kr
Overall Flash Image
, in .. .boot/ c ompressed/ head-armv.S or head-arm-dsc21.S main.c
init.o head.o misc.o kernel ( piggy.o) initrd.o
flash kernel.o initrd.o RAM , kernel.o in .../ boot/bootp/
kernel.o
. . .
http://network.hanbat.ac.kr
Embedded Linux
Booting Scenario (1)
Flash init.o head.o misc.o kernel ( piggy.o) initrd.o
flash kernel.o initrd.o RAM , kernel.o in .../boot/bootp/
RAM
, in ...boot /c ompressed/
kernel.o
head-armv.S or head-arm-dsc21.S main.c
(1)
. . .
(1) power-on boot block pc flash init.o . (pc r0=0, r1="unique architecture #, MMU off, D-cache off . head-armv.S .)
boot block
http://network.hanbat.ac.kr
Embedded Linux
10
Booting Scenario (2)
Flash init.o head.o misc.o
kernel.o
(2 )
, in ... boot/ c ompressed/
RAM head.o misc.o kernel ( piggy.o) initrd.o
head-armv.S or head-arm-dsc21.S main.c
kernel ( piggy.o) initrd.o
(2) Flash
. . . init.o , kernel.o RAM kernel.o .
boot block
http://network.hanbat.ac.kr
initrd.o ,
Embedded Linux
11
Booting Scenario (3)
Flash init.o head.o misc.o
kernel.o
, in . ..boot/c ompressed/
head-armv.S or head-arm-dsc21.S main.c
RAM head.o misc.o kernel ( piggy.o) initrd.o
kernel ( piggy.o) initrd.o
(3) head.o . ,
. . .
(3)
boot block
http://network.hanbat.ac.kr
kernel
Embedded Linux
12