红联Linux门户
Linux帮助

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

发布时间:2017-01-30 11:18:54来源:blog.csdn.net/leon1741作者:leon1741
今天心血来潮,想编译以下Linux内核来玩玩。一开始编译x86的版本,遇到了openssl/opensslv.h文件缺失的问题,经过一番折腾,顺利解决(解决过程请参见“linux(ubuntu)编译linux内核提示openssl/opensslv.h文件缺失”)(http://www.linuxdiyf.com/linux/28051.html)。然后就进而想编译一个arm的版本出来,放到我的mini2440开发板上跑一跑。
 
于是按照文章(移植Linux3.4.2版本内核到mini2440)的步骤[附1],修改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 built
make[1]: *** [arch/arm/boot/uImage] 错误 1
make: *** [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/uImage
Image Name:   Linux-4.9.0-dirty
Created:      Tue Jan 24 16:25:24 2017
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3200648 Bytes = 3125.63 kB = 3.05 MB
Load Address: 30108000
Entry 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
 
搞定!收工!
 
附[1]:
linux(ubuntu)编译linux内核提示"mkimage" command not foun
 
本文永久更新地址:http://www.linuxdiyf.com/linux/28052.html