问题
前两天在编译博雅芯片厂商提供的内核时,总是无法编译通过,试了好几次都提示如下错误:
Invalid CPU Type - valid names are: alpha, arm, x86, ia64, m68k, microblaze, mips, mips64, nios2, powerpc, ppc, s390, sh, sparc, sparc64, blackfin, avr32
Usage: /usr/local/bin/mkimage -l image-l ==> list image header information/usr/local/bin/mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image-A ==> set architecture to 'arch'-O ==> set operating system to 'os'-T ==> set image type to 'type'-C ==> set compression type 'comp'-a ==> set load address to 'addr' (hex)-e ==> set entry point to 'ep' (hex)-n ==> set image name to 'name'-d ==> use image data from 'datafile'-x ==> set XIP (execute in place)/usr/local/bin/mkimage [-D dtc_options] -f fit-image.its fit-image
make[1]: *** [arch/csky/boot/uImage] Error 1
make: *** [uImage] Error 2
Creating Temp DIR for building rootfs:/tmp/rootfs-20695
/tmp/rootfs-20695
分析
查看系统里是有该工具的,而且同事在同样版本的Ubuntu系统也可以编译通过,所以考虑是mkimage的问题
mkimage
工具可以通过两个途径获得,一般芯片厂商给的SDK里会有mkimage
工具,在uboot
中tools
目录下拷贝到编译的机器使用即可(记得备份好旧的mkimage);另一个是自己从网上下载安装(一般不建议)。
我的编译机器是Ubuntu14.04
的,先使用安装的方式更新mkimage
,在命令行输入下面命令:
sudo apt-get install u-boot-tools
更新完继续编译,还是出错。。。
最后直接使用同事拷贝过来的mkimage
,编译通过。
总结:
编译内核时,mkimage工具
报错 Invalid CPU Type - valid names are: .....
时,很可能是工具太旧了,可以尝试更新mkimage
,看是否解决问题,最好使用厂商提供的 mkimage
工具,替换mkimage
时,注意备份好旧的工具,以防丢失。