linux内核loadaddr地址设定

问题背景:移植内核Linux-3.14Linux-4.20.8至exynos4412开发板上。

制作Linux-4.20.8的镜像的时候,提示要指定loadaddr:

 

而制作linux-3.14的镜像时却不需要指定loadaddr,并且3.14的镜像制作完成后会提示:

load address: 40008000。那么这个loadaddr是怎么来的?为什么有的内核需要指定有的

不要指定?

解决:参考https://blog.csdn.net/dahailantian1/article/details/78584838

两个重要的地址:ZTEXTADDR和ZRELADDR

ZTEXTADDR:

Start address of decompressor. here'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.
在arch/arm/boot/compressed/Makefile中有这样的描述:(PIC:position independent code)

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.

 不同板子的ZRELADDR不同,可以在目录arch/arm/mach-xx下的Makefile.boot中找到。

 比如我用的exynos4412就在arch/arm/mach-exynos/Makefile.boot中有定义:

这个是在Linux3.14中有定义,而在Linux4.20.8中没有,这也就解释了为什么在编译Linux4.20.8时

需要指定loadaddr。

更进一步,为什么要定义为0x40008000?

在Documentation/Booting中有如下描述:这是中文版的,我查看英文版的貌似没有这个描述。。。姑且这么认为吧

现在寻找映像基地址,通过exynos4412的芯片手册来寻找,在memory-map中:

 

 PS:关于内核的信息,可以查阅Documentationm目录下的文档,我甚至发现了中文的文档。。。

 

posted @ 2019-06-27 16:06  bigsissy  阅读(3673)  评论(0编辑  收藏  举报