mkimage 时报错invalid entry point -n

在最后阶段出现了"invalid entry point -n"的错误,而我在ubuntu12.04上面是可以生成镜像的。以下是出错现场的信息



LZMA 4.57  Copyright (c) 1999-2007 Igor Pavlov  2007-12-06
echo Making uImage...
Making uImage...
cd util && mkuImage.sh /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31 _mi124_f1e lzma
+ MKIMAGE=/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools/mkimage
+ VMLINUX=/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/vmlinux
+ VMLINUXBIN=/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin
+ '[' -z /tftpboot/zhangdanfeng ']'
+ echo /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../build/util/mkuImage.sh Using TFTPPATH=/tftpboot/zhangdanfeng
/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../build/util/mkuImage.sh Using TFTPPATH=/tftpboot/zhangdanfeng
++ grep Entry
++ readelf -a /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/vmlinux
++ head -1
++ cut -d: -f 2
+ ENTRY=
++ grep '\[ 1\]'
++ readelf -a /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/vmlinux
++ head -1
++ cut '-d ' -f 26
+ LDADDR=80002000
+ '[' 4 -gt 3 ']'
+ suffix=_mi124_f1e
+ '[' xxlzma = xxlzma -o xx_mi124_f1e = xxlzma ']'
+ echo '**** Generating vmlinux_mi124_f1e.lzma.uImage ********'
**** Generating vmlinux_mi124_f1e.lzma.uImage ********
+ /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools/mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e -n 'Linux Kernel Image' -d /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin.lzma /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../images/mi124/vmlinux_mi124_f1e.lzma.uImage
/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools/mkimage: invalid entry point -n
+ cp /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../images/mi124/vmlinux_mi124_f1e.lzma.uImage /tftpboot/zhangdanfeng
cp: 无法获取'/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../images/mi124/vmlinux_mi124_f1e.lzma.uImage' 的文件状态(stat): 没有那个文件或目录


后来我将*argv全部打印出来发现:在ubuntu12.04下,Makefile文件中执行的语句展开后是

/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools/mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e -n 'Linux Kernel Image' -d /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin.lzma /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../images/mi124/vmlinux_mi124_f1e.lzma.uImage

argc的值是18,第12个参数“-e”后面紧接着的是代表入口地址的16进制参数;

但是在ubuntu14.04下,Makefile文件中执行的语句展开后是

**** Generating vmlinux_mi124_f1e.lzma.uImage ********
+ /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools/mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e -n 'Linux Kernel Image' -d /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin.lzma /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../images/mi124/vmlinux_mi124_f1e.lzma.uImage
/home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../boot/u-boot/tools/mkimage: invalid entry point -n
+ cp /home/zhangdanfeng/work/gaoju/rc_9342_wifi/sdk/build/../images/mi124/vmlinux_mi124_f1e.lzma.uImage /tftpboot/zhangdanfeng

argc的值是17,正是“-e”参数后缺少了入口地址参数,而紧接着“-n”。所以程序就报告了“ nvalid entry point -n”,但是为何会缺少一个参数?

答案就在Makefile里面找。Makefile中通过$(shell readelf -h $(ROOTDIR)/$(LINUXDIR)/vmlinux | grep "Entry" | awk '{print $$4}') 查找入口点地址,但是我们在ubuntu14.04中readelf文件vmlinux才发现Entry竟然被汉化成了“入口点地址”,所以grep Entry肯定找不到啦。最后把“Entry”改成“入口点地址”,再把$$4改成$$2就可以完成编译了。

这种问题着实让人哭笑不得,看来做开发的系统最好还是别汉化。开发中出现疑难异常问题的时候也可以从系统的语言环境考虑下。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

武溪嵌人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值