問題背景:移植內核Linux-3.14和Linux-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目錄下的文檔,我甚至發現了中文的文檔。。。

