加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ZTEXTADDR和ZRELADDR

发布时间:2020-12-15 18:45:38 所属栏目:百科 来源:网络整理
导读:例子:*** 30008000 zImage 是zImage内存中的地址 ==ZRELADDR 解压后的内核运行地址 30800000 ramdisk 在内存中地址 ZTEXTADDR following symbol definitions rely on you knowing the translation that __virt_to_phys() does for your machine.?? This macr


例子:***

30008000 zImage 是zImage内存中的地址 ==ZRELADDR 解压后的内核运行地址

30800000 ramdisk 在内存中地址

ZTEXTADDR

following symbol definitions rely on you knowing the translation that

__virt_to_phys() does for your machine.?? This macro converts the passed

virtual address to a physical address.?? Normally,it is simply:

phys = virt - PAGE_OFFSET + PHYS_OFFSET

Decompressor Symbols

--------------------

ZTEXTADDR

Start address of decompressor.?? There's no point in talking about

virtual or physical addresses here,since the MMU will be off at

the time when you call the decompressor code.?? You normally call

the kernel at this address to start it booting.?? This doesn't have

to be located in RAM,it can be in flash or other read-only or

read-write addressable medium.

ZBSSADDR

Start address of zero-initialised work area for the decompressor.

This must be pointing at RAM.?? The decompressor will zero initialise

this for you.?? Again,the MMU will be off.

ZRELADDR

This is the address where the decompressed kernel will be written,

and eventually executed.?? The following constraint must be valid:

__virt_to_phys(TEXTADDR) == ZRELADDR

The initial part of the kernel is carefully coded to be position

independent.

INITRD_PHYS

Physical address to place the initial RAM disk.?? Only relevant if

you are using the bootpImage stuff (which only works on the old

struct param_struct).

INITRD_VIRT

Virtual address of the initial RAM disk.?? The following?? constraint

must be valid:

__virt_to_phys(INITRD_VIRT) == INITRD_PHYS

PARAMS_PHYS

Physical address of the struct param_struct or tag list,giving the

kernel various parameters about its execution environment.

Kernel Symbols

--------------

PHYS_OFFSET

Physical start address of the first bank of RAM.

PAGE_OFFSET

Virtual start address of the first bank of RAM.?? During the kernel

boot phase,virtual address PAGE_OFFSET will be mapped to physical

address PHYS_OFFSET,along with any other mappings you supply.

This should be the same value as TASK_SIZE.

TASK_SIZE

The maximum size of a user process in bytes.?? Since user space

always starts at zero,this is the maximum address that a user

process can access+1.?? The user space stack grows down from this

address.

Any virtual address below TASK_SIZE is deemed to be user process

area,and therefore managed dynamically on a process by process

basis by the kernel.?? I'll call this the user segment.

Anything above TASK_SIZE is common to all processes.?? I'll call

this the kernel segment.

(In other words,you can't put IO mappings below TASK_SIZE,and

hence PAGE_OFFSET).

TEXTADDR

Virtual start address of kernel,normally PAGE_OFFSET + 0x8000.

This is where the kernel image ends up.?? With the latest kernels,

it must be located at 32768 bytes into a 128MB region.?? Previous

kernels placed a restriction of 256MB here.

DATAADDR

Virtual address for the kernel data segment.?? Must not be defined

when using the decompressor.

VMALLOC_START

VMALLOC_END

Virtual addresses bounding the vmalloc() area.?? There must not be

any static mappings in this area; vmalloc will overwrite them.

The addresses must also be in the kernel segment (see above).

Normally,the vmalloc() area starts VMALLOC_OFFSET bytes above the

last virtual RAM address (found using variable high_memory).

VMALLOC_OFFSET

Offset normally incorporated into VMALLOC_START to provide a hole

between virtual RAM and the vmalloc area.?? We do this to allow

out of bounds memory accesses (eg,something writing off the end

of the mapped memory map) to be caught.?? Normally set to 8MB.

Architecture Specific Macros

----------------------------

BOOT_MEM(pram,pio,vio)

`pram' specifies the physical start address of RAM.?? Must always

be present,and should be the same as PHYS_OFFSET.

`pio' is the physical address of an 8MB region containing IO for

use with the debugging macros in arch/arm/kernel/debug-armv.S.

`vio' is the virtual address of the 8MB debugging region.

It is expected that the debugging region will be re-initialised

by the architecture specific code later in the code (via the

MAPIO function).

BOOT_PARAMS

Same as,and see PARAMS_PHYS.

FIXUP(func)

Machine specific fixups,run before memory subsystems have been

initialised.

MAPIO(func)

Machine specific function to map IO areas (including the debug

region above).

INITIRQ(func)

Machine specific function to initialise interrupts.

zImage是位置无关的,解压之后的内核的物理启动地址是ZRELADDR,

而如果是在flash中运行,也就是运行解压操作的话

# We now have a PIC decompressor implementation.?? Decompressors running
# from RAM should not define ZTEXTADDR.?? Decompressors running directly
# from ROM or Flash must define ZTEXTADDR (preferably via the config)
也就是说 如果需要从flash中启动还需要设置ZTEXTADDR地址

可以这样理解,如果bootloader是在flash运行之后,分nand和nor两种,nand的话,需要把bootloader的后半部分以及kernel都拷到ram里运行,这样bootloader执行完了之后会跳到压缩内核,然后执行zImage里的解压部分,zImage是位置无关的,解压之后的内核要放到指定位置ZRELADDR.如果是nor flash的话,则既可以在flash上运行完bootloader,然后把压缩内核拷到ram,这样不需要指定ZTEXTADDR,也可以一直运行到执行解压缩操作,然后把内核解压到ZRELADDR,这样需要指定ZTEXTADDR.

em86xx的bootloader是在nor执行,而且在bootloader里将内核解压到指定的地址,也就是下面的0x90090000

OUTPUT_ARCH(arm)
ENTRY(stext)
SECTIONS
{
. = 0x90090000;???//这个也就是LOAD_ADDR,也就是ZRELADDR,原因如下
.init : {??? /* Init code and data?? */
?? _stext = .;
?? __init_begin = .;
??? *(.text.init)
?? __proc_info_begin = .;
??? *(.proc.info)

一般的是这样

OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { ??? . = LOAD_ADDR; ??? _load_addr = .; ??? . = TEXT_START; ??? _text = .; ??? .text : { ????? _start = .; 在kernel/arch/arm/boot/compressed/Makefile文件有一行脚本: SEDFLAGS???? = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/ 使得TEXT_START = ZTEXTADDR,LOAD_ADDR = ZRELADDR。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读