Sie sind auf Seite 1von 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
head-arm-dsc21.S
main.c

arch/armnommu/kernel
init/

.
.
.
.
http://network.hanbat.ac.kr

Embedded Linux

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

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

kernel

(not completed)
* (.text.init)
x16

.init

x 4096

* (.proc .info)
* (.arc h.info)

_stext, __init_begin
__proc_info_begin
__proc_info_end, __arch_info_begin

* (.data.init)

__arch_info_end

* (.setup.init)

__setup_start

* (.initc all.init)
* (.text)

__setup_end, __initcall_start
_text

...
.text

* (__ex_table)
* (__ksymtab)
* (__kallsyms)
* (.got)

http://network.hanbat.ac.kr

Embedded Linux

__start___ex_table
__stop___ex_table, __start___ksymtab
__stop___ksymtab, __start___kallsyms
__stop___kallsyms,
_etext

boot/compressed/vmlinux

boot/zImage

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

head.o
misc.o

,
in ...boot/c ompressed/
head-armv.S
or
head-arm-dsc21.S
main.c

.
.
.

y
objcop
gzip, ld

http://network.hanbat.ac.kr

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

y
objcop

zImage

kernel
(piggy.o)

Embedded Linux

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

text

*(.start)
*(.text)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.*)
*(.glue_7)
*(.glue_7t)
piggy.o

data
bss
stack

http://network.hanbat.ac.kr

*(.data)
*(.bss)
*(.stack)

Embedded Linux

LOAD_ADDR, _load_addr,
TEXT_START, _text, _start

input_data
input_data_end, _etext
_edata, BSS_START, __bss_start
_end
user_stack, sp (initially)
7

Flash Image

...boot/bootp/bootp
(Flash
)

init.o
zImage

ld

kernel.o

flash
kernel.o initrd.o
RAM
,
kernel.o
in .../boot/bootp/

initrd.o
ld

initrd

http://network.hanbat.ac.kr

Embedded Linux

Overall Flash Image

,
in .. .boot/ c ompressed/

init.o
head.o
misc.o

head-armv.S
or
head-arm-dsc21.S
main.c

.
.
.

http://network.hanbat.ac.kr

flash
kernel.o initrd.o
RAM
,
kernel.o
in .../ boot/bootp/

kernel.o

kernel
( piggy.o)
initrd.o

Embedded Linux

Booting Scenario (1)

,
in ...boot /c ompressed/

Flash
init.o
head.o
misc.o

flash kernel.o
initrd.o
RAM
,
kernel.o
in .../boot/bootp/

kernel.o

(1)

kernel
( piggy.o)

http://network.hanbat.ac.kr

head-armv.S
or
head-arm-dsc21.S
main.c

.
.
.

initrd.o

boot
block

RAM

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

Embedded Linux

10

Booting Scenario (2)

,
in ... boot/ c ompressed/

Flash
init.o
head.o
misc.o

(2 )

kernel.o

kernel
( piggy.o)

.
.
.
(2) Flash

http://network.hanbat.ac.kr

head-armv.S
or
head-arm-dsc21.S
main.c

initrd.o

boot
block

RAM
head.o
misc.o

initrd.o
,

Embedded Linux

kernel
( piggy.o)
initrd.o

init.o
, kernel.o
RAM
kernel.o
.
11

Booting Scenario (3)

,
in . ..boot/c ompressed/

Flash
init.o
head.o
misc.o

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

kernel
( piggy.o)

main.c

kernel
( piggy.o)

.
.
.

http://network.hanbat.ac.kr

(3)

initrd.o

initrd.o

boot
block

RAM
head.o
misc.o

(3) head.o
.

kernel

Embedded Linux

12

Das könnte Ihnen auch gefallen