问题描述
-
环境: ubuntu 20.04 ,编译 Linux 内核
-
报错信息
CC [M] drivers/usb/host/xhci-hcd.mod.o
MKITB arch/arm64/boot/Image.itb
make[2]: *** [../arch/arm64/boot/Makefile:39: arch/arm64/boot/Image.itb] Error 127
make[1]: *** [arch/arm64/Makefile:173: Image.itb] Error 2
make[1]: *** Waiting for unfinished jobs....
LD [M] sound/soc/codecs/snd-soc-rl6231.ko
LD [M] sound/soc/codecs/snd-soc-rt5651.ko
make[1]: Leaving directory '/home/rtt/bst/kernel-source-5.10/build'
make: *** [Makefile:185: __sub-make] Error 2
make[1]: Entering directory '/home/rtt/bst/kernel-source-5.10/build'
GEN Makefile
CALL ../scripts/atomic/check-atomics.sh
CALL ../scripts/checksyscalls.sh
-
最近使用一个新的虚拟机编译Linux 内核,编译完成的位置,报了一个错误,通过错误信息无法直接定位,通过错误信息,找到响应的文件,然后定位发现,原来系统缺少
mkimage
工具 -
安装
mkimage
的方法:
sudo apt install u-boot-tools
分析记录
-
找到 报错的 Makefile 文件,看看为何报错
-
原来这里调用 mkimage 生成 了
Image.itb
文件
quiet_cmd_mkitb = MKITB $@
cmd_mkitb = mkimage -f $< $@ > /dev/null 2>&1
quiet_cmd_copy_itb = COPY $@
cmd_copy_itb = cp $< $@ $(objtree)
$(obj)/Image.itb: $(srctree)/kernel_a.its FORCE
$(call cmd,mkitb)
$(call cmd,copy_itb)
- 尝试在ubuntu 20.04 中运行
mkimage
命令,发现没这个命令,这个命令是用来打包镜像文件的,所以需要安装,
$ mkimage
Command 'mkimage' not found, but can be installed with:
sudo apt install u-boot-tools
- 安装后,再次编译,发现编译正常,报错消失了,问题解决。