- 论坛徽章:
- 0
|
(网上资源,摘录整理)
linux 内核启动地址的确定
内核编译链接过程是依靠 vmlinux.lds 文件,以 arm 为例 vmlinux.lds 文件位于 kernel/arch/arm/vmlinux.lds,
vmlinux-armv.lds 的生成过程在 kernel/arch/arm/Makefile 中
ifeq ($(CONFIG_CPU_32),y)
PROCESSOR = armv
TEXTADDR = 0xC0008000
LDSCRIPT = arch/arm/vmlinux-armv.lds.in
endif
arch/arm/vmlinux.lds: $(LDSCRIPT) dummy
@sed 's/TEXTADDR/$(TEXTADDR)/;s/DATAADDR/$(DATAADDR)/' $(LDSCRIPT) >$@
查看 arch/arm/vmlinux.lds 中
OUTPUT_ARCH(arm)
ENTRY(stext)
SECTIONS
{
. = 0xC0008000;
.init : { /* Init code and data */
_stext = .;
__init_begin = .;
*(.text.init)
设置 kernel/arch/arm/boot/Makefile 文件中的
ifeq ($(CONFIG_ARCH_S3C2410),y)
ZTEXTADDR = 0x30008000
ZRELADDR = 0x30008000
endif
# 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)
#
查看 2410 的 datasheet ,发现内存映射的基址是 0x3000 0000 ,那么 0x30008000 又是如何来的呢?
在内核文档 kernel/Document/arm/Booting 文件中有:
Calling the kernel image
Existing boot loaders: MANDATORY
New boot loaders: MANDATORY
There are two options for calling the kernel zImage. If the zImage is stored in flash, and is linked correctly to be run
from flash, then it is legal for the boot loader to call the zImage in flash directly.
The zImage may also be placed in system RAM (at any location) and called there. Note that the kernel uses 16K of
RAM below the image to store page tables. The recommended placement is 32KiB into RAM.
看来在 image 下面用了 32K(0x8000)的空间存放内核页表。
0x30008000 就是 2410 的内核在 RAM 中的启动地址,这个地址就是这么来的。
![]()
文件:U-boot与kernel的关系new.tar
大小:0KB
下载:
下载
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/104274/showart_2058232.html |
|