Linux3.6.7中Make uImage的load address 和 Entry Point相同的问题

u-boot-2012.10那里拷贝mkimage工具放在/usr/bin目录下,make uImage发现load address 和entry point都是0x50008000.结果u-bootbootm命令一直starting kernel......

手工entry point=0x50008040就可以启动了。那么,怎样让make uImage自动entry point设置为50008040呢?网上资料arch/arm/boot/里面的Makefile文件


$(obj)/uImage: STARTADDR=$(LOADADDR)
改为
$(obj)/uImage: STARTADDR=$(shell echo $(LOADADDR) | sed -e "s/..$$/40/")
其中,sed -e "s/..$$/40/"的意思是,把输出的字符串的最后两个字符删掉,并且用40来补充,也可以理解为,把字符串最后两个字符用40来替换。

通过对比3.0.1版本和3.6.7版本发现前者有这样的内容,但后者的make file却找不到

STARTADDR这变量。找了半天才发现,linux3.6.7版本中设置mkimage传递的参数不是放在arch/arm/boot目录的makefile中,而是放在scripts目录下的makefile.lib文件中,内容如下:

# U-Boot mkimage
# ---------------------------------------------------------------------------

MKIMAGE := $(srctree)/scripts/mkuboot.sh

# SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces
# the number of overrides in arch makefiles
UIMAGE_ARCH ?= $(SRCARCH)
UIMAGE_COMPRESSION ?= $(if $(2),$(2),none)
UIMAGE_OPTS-y ?=
UIMAGE_TYPE ?= kernel
UIMAGE_LOADADDR ?= arch_must_set_this
#UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR)##这是原来的配置
UIMAGE_ENTRYADDR =$(shell echo $(UIMAGE_LOADADDR) | sed -e "s/..$$/40/")##这是我修改后的配置

UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)'
UIMAGE_IN ?= $<
UIMAGE_OUT ?= $@

quiet_cmd_uimage = UIMAGE $(UIMAGE_OUT)
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \
-C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \
-T $(UIMAGE_TYPE) \
-a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \
-n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT)

通过上面修改后,make uImage如下:

root@ubuntu:/home/my/linux-3.6.7# make uImage
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: “include/generated/mach-types.h”是最新的。
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
UIMAGE arch/arm/boot/uImage
Image Name: Linux-3.6.7
Created: Mon Nov 26 12:37:17 2012
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1476744 Bytes = 1442.13 kB = 1.41 MB
Load Address: 50008000
Entry Point: 50008040

Image arch/arm/boot/uImage is ready
root@ubuntu:/home/my/linux-3.6.7#

<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>
阅读(6) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
发布了28 篇原创文章 · 获赞 4 · 访问量 1万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章