Вы находитесь на странице: 1из 12

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
arch/armnommu/kernel
head-arm-dsc21.S
main.c init/

.
.
.
.

http://network.hanbat.ac.kr Embedded Linux 2


arch/arm/kernel/head-armv.S
 Set
 r0 = 0, r1= unique architecture number, MMU = off, I-cache =
on/off, D-cache = off
 mode to supervisor, all IRQs to disable
 bl __lookup_processor_type
 bl __lookup_architecture_type
 goto __arm720_setup (in file proc-arm720.S)
 goto __mmap_switched
 goto SYMBOL_NAME(start_kernel)

http://network.hanbat.ac.kr Embedded Linux 3


Linux architecture-independent initialization
 Refer
 http://www.linuxdoc.org/HOWTO/Linux-Init-HOWTO-5.html
 main.c/start_kernel()
 setup_arch()
 setup_processor()
 setup_architecture(machine_arch_type)
 init_bootmem_node(…), free_bootmem(…), paging_init(…),
 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();

http://network.hanbat.ac.kr Embedded Linux 4


kernel (not completed)
_stext, __init_begin
* (.text.init)
__proc_info_begin
x16 * (.proc .info)
__proc_info_end, __arch_info_begin
.init * (.arc h.info)
x 4096
__arch_info_end
* (.data.init)
__setup_start
* (.setup.init)
__setup_end, __initcall_start
* (.initc all.init)

_text
* (.text)

...
__start___ex_table
.text * (__ex_table)
__stop___ex_table, __start___ksymtab
* (__ksymtab)
__stop___ksymtab, __start___kallsyms
* (__kallsyms)
__stop___kallsyms,
* (.got)
_etext
http://network.hanbat.ac.kr Embedded Linux 5
boot/compressed/vmlinux boot/zImage

$(TOPDIR)/arch/ $(TOPDIR)/arch/
armnommu/boot/ armnommu/boot/
compressed/vmlinux zImage

, head.o
in ...boot/c ompressed/ misc.o zImage
y
objcop
head-armv.S or
head-arm-dsc21.S
y
objcop
main.c
gzip, ld kernel
. (piggy.o)
.
.

http://network.hanbat.ac.kr Embedded Linux 6


$(TOPDIR)/arch/armnommu/boot/compressed/vmlinux

LOAD_ADDR, _load_addr,
*(.start) TEXT_START, _text, _start
*(.text)
*(.fixup)
*(.gnu.warning)
*(.rodata)
text *(.rodata.*)
*(.glue_7)
*(.glue_7t)
input_data
piggy.o
input_data_end, _etext
data *(.data)
_edata, BSS_START, __bss_start
bss *(.bss)
_end
stack *(.stack)
user_stack, sp (initially)

http://network.hanbat.ac.kr Embedded Linux 7


Flash Image

...boot/bootp/bootp
(Flash )
flash kernel.o initrd.o
init.o RAM ,
kernel.o
in .../boot/bootp/
ld kernel.o
zImage

initrd.o
ld

initrd

http://network.hanbat.ac.kr Embedded Linux 8


Overall Flash Image

flash kernel.o initrd.o


init.o RAM
kernel.o
,

, head.o in .../ boot/bootp/

in .. .boot/ c ompressed/ misc.o


head-armv.S or kernel.o
head-arm-dsc21.S

main.c
kernel
. ( piggy.o)
.
.
initrd.o

http://network.hanbat.ac.kr Embedded Linux 9


Booting Scenario (1)

Flash RAM
flash kernel.o initrd.o
init.o RAM ,
kernel.o
, head.o in .../boot/bootp/

in ...boot /c ompressed/ misc.o


head-armv.S or
kernel.o
head-arm-dsc21.S

(1) kernel main.c

( piggy.o) .
.
.
initrd.o
(1) power-on boot block pc
flash init.o
.
boot (pc r0=0, r1="unique
architecture #, MMU off, D-cache
block off .
head-armv.S .)

http://network.hanbat.ac.kr Embedded Linux 10


Booting Scenario (2)

Flash RAM
init.o (2 ) head.o
, head.o misc.o
in ... boot/ c ompressed/ misc.o
head-armv.S or
kernel.o head-arm-dsc21.S
kernel
kernel main.c ( piggy.o)
( piggy.o) .
. initrd.o
.
initrd.o

(2) Flash init.o


, kernel.o
boot initrd.o RAM
block , kernel.o
.
http://network.hanbat.ac.kr Embedded Linux 11
Booting Scenario (3)

Flash RAM
init.o head.o
, head.o head-armv.S or misc.o
head-arm-dsc21.S
in . ..boot/c ompressed/ misc.o
main.c
kernel.o
. kernel
. ( piggy.o) (3)
kernel
.
( piggy.o)
initrd.o
initrd.o

(3) head.o ,
boot kernel
block ,
.

http://network.hanbat.ac.kr Embedded Linux 12

Вам также может понравиться