linux(ubuntu)编译linux内核提示"mkimage" command not found

来源:互联网 发布:mvc php路由文件加载 编辑:程序博客网 时间:2024/06/05 20:11

今天心血来潮,想编译以下linux内核来玩玩。一开始编译x86的版本,遇到了openssl/opensslv.h文件缺失的问题,经过一番折腾,顺利解决(解决过程请参见我的另外一篇博客“linux(ubuntu)编译linux内核提示openssl/opensslv.h文件缺失”)。然后就进而想编译一个arm的版本出来,放到我的mini2440开发板上跑一跑。

于是按照博客(移植Linux3.4.2版本内核到mini2440)的步骤,修改makefile,指定交叉编译器(arm-linux-gcc)和配置文件(s3c2410_defconfig),运行make uImage命令。大约半个多小时后,提示:

  CC      arch/arm/boot/compressed/decompress.o  AS      arch/arm/boot/compressed/debug.o  CC      arch/arm/boot/compressed/string.o  SHIPPED arch/arm/boot/compressed/lib1funcs.S  AS      arch/arm/boot/compressed/lib1funcs.o  SHIPPED arch/arm/boot/compressed/ashldi3.S  AS      arch/arm/boot/compressed/ashldi3.o  SHIPPED arch/arm/boot/compressed/bswapsdi2.S  AS      arch/arm/boot/compressed/bswapsdi2.o  LD      arch/arm/boot/compressed/vmlinux  OBJCOPY arch/arm/boot/zImage  Kernel: arch/arm/boot/zImage is ready  UIMAGE  arch/arm/boot/uImage"mkimage" command not found - U-Boot images will not be builtmake[1]: *** [arch/arm/boot/uImage] 错误 1make: *** [uImage] 错误 2

百度一下,发现是因为系统缺少mkimage工具导致,解决办法很简单,直接安装一下这个工具就好:

leon@Ubuntu:~/linux$ sudo apt-get install uboot-mkimage正在读取软件包列表... 完成正在分析软件包的依赖关系树       正在读取状态信息... 完成       将会安装下列额外的软件包:  u-boot-tools下列【新】软件包将被安装:  u-boot-tools uboot-mkimage升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 221 个软件包未被升级。需要下载 71.4 kB 的软件包。解压缩后会消耗掉 245 kB 的额外空间。您希望继续执行吗?[Y/n]y获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main u-boot-tools amd64 2011.09-2 [60.4 kB]获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/main uboot-mkimage all 2011.09-2 [11.0 kB]下载 71.4 kB,耗时 0秒 (201 kB/s)   Selecting previously unselected package u-boot-tools.(正在读取数据库 ... 系统当前共安装有 166411 个文件和目录。)正在解压缩 u-boot-tools (从 .../u-boot-tools_2011.09-2_amd64.deb) ...Selecting previously unselected package uboot-mkimage.正在解压缩 uboot-mkimage (从 .../uboot-mkimage_2011.09-2_all.deb) ...正在处理用于 man-db 的触发器...正在设置 u-boot-tools (2011.09-2) ...正在设置 uboot-mkimage (2011.09-2) ..

然后再次运行生成命令,顺利成功!

leon@Ubuntu:~/linux$ make uImage  CHK     include/config/kernel.release  CHK     include/generated/uapi/linux/version.h  CHK     include/generated/utsrelease.h  CHK     include/generated/bounds.h  CHK     include/generated/timeconst.h  CHK     include/generated/asm-offsets.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/uImageImage Name:   Linux-4.9.0-dirtyCreated:      Tue Jan 24 16:25:24 2017Image Type:   ARM Linux Kernel Image (uncompressed)Data Size:    3200648 Bytes = 3125.63 kB = 3.05 MBLoad Address: 30108000Entry Point:  30108000

生成的可执行文件信息如下:

leon@Ubuntu:~/linux/arch/arm/boot$ file uImage uImage: u-boot legacy uImage, Linux-4.9.0-dirty, Linux/ARM, OS Kernel Image (Not compressed), 3200648 bytes, Tue Jan 24 16:25:24 2017, Load Address: 0x30108000, Entry Point: 0x30108000, Header CRC: 0xE1FE38F1, Data CRC: 0x5E772F78

搞定!收工!

0 0
原创粉丝点击