您的位置:首页 > 运维架构 > Linux

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

2016-06-15 13:44 645 查看
Linux3.6.7中Make uImage的load address 和 Entry Point相同的问题

 

 

本文转自:http://blog.chinaunix.net/uid-28382924-id-3421282.html

从u-boot-2012.10那里拷贝个mkimage工具放在/usr/bin目录下,在make
uImage时发现load address
和entry point都是0x50008000.结果u-boot在bootm命令后一直停在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#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: