0% found this document useful (0 votes)
271 views12 pages

Embedded Linux: Kernel Make (Compressed With Boot)

The document describes the process of building and booting an embedded Linux kernel on ARM architecture. It discusses: 1) How to build the kernel using make, which produces vmlinux. It then explains the file structure and contents of the kernel. 2) The process of creating a compressed kernel image (zImage) by combining object files using objcopy and gzip. 3) How this zImage, along with an initrd, is placed in flash memory to boot the system. 4) The step-by-step booting process which begins with a boot block loading the kernel from flash into RAM, where it initializes and loads the initrd.

Uploaded by

rammohan2b
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
271 views12 pages

Embedded Linux: Kernel Make (Compressed With Boot)

The document describes the process of building and booting an embedded Linux kernel on ARM architecture. It discusses: 1) How to build the kernel using make, which produces vmlinux. It then explains the file structure and contents of the kernel. 2) The process of creating a compressed kernel image (zImage) by combining object files using objcopy and gzip. 3) How this zImage, along with an initrd, is placed in flash memory to boot the system. 4) The step-by-step booting process which begins with a boot block loading the kernel from flash into RAM, where it initializes and loads the initrd.

Uploaded by

rammohan2b
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 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 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

You might also like