说明:
1:编译前请先自行安装所需交叉编译器(参考SDK里文档)
2:海思平台下多款芯片编译均可参考以下
问题1:
/bin/sh: 1: pushd: not found
解决1:
步骤1:which sh,结果是/bin/sh
步骤2:ls -l /bin/sh,结果sh指向dash
步骤3:sudo rm /bin/sh
步骤4:sudo ln -s /bin/bash /bin/sh
步骤5:ls -l /bin/sh,结果sh指向bash
解决2:
步骤1:sudo dpkg-reconfigure dash 【NO】
步骤2:ls -l /bin/sh,结果sh指向bash
问题2:
make[2]: arm-hisiv300-linux-gcc: Command not found
解决1:
步骤1:vi ~/.bashrc,没有的话在文件末尾追加export PATH=/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin:$PATH
步骤2:source ~/.bashrc 【确保环境变量设置生效.,可以用echo $PATH查看是否成功导入】
解决2:
这是因为宿主机是64 位 而交叉编译器是针对32位的开发板制作的。所以要安装对应的32位库。
我的linux宿主机是ubuntu 14.04 64位。
安装命令: sudo apt install lib32z1-dev
问题3:
"mkimage" command not found - U-Boot images will not be built
解决1:
步骤1:cd osdrv/opensource/uboot/u-boot-2010.06
步骤2:ls 【可以看到里面uboot.bin已经生成了】
步骤3:cd tools 【里面有mkimage.c和mkimage】
步骤4:file mkimage 【写x86-64位的架构,ubuntu16.0.04也是x86-64架构,因此可以在当前虚拟机上运行】
步骤5:sudo cp mkimage /usr/local/bin
步骤6:cd ../../
步骤7:ls 【发现里面要u-boot-2010.06文件夹和u-boot-2010.06.tgz压缩包】
步骤8:mki[连续按TabTab键] 【发现补全mkimage,说明已经成功解决了】
解决2:
sudo apt-get install u-boot-tools
问题4:
compr_zlib.c:39:18: fatal error: zlib.h: No such file or directory
解决:
sudo aptitude install zlib1g-dev
问题5:
serve_image.c:32:18: error: storage size of ‘hints’ isn’t known
解决:
步骤1:sudo vi /usr/include/netdb.h
步骤2::set nu 【显示行号】
步骤3:/__USE_XOPEN2K 【搜索】
步骤4:将第79行的#if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED和相应的第82行的#endif用//注释掉
步骤5:/__USE_XOPEN2K 【搜索】
步骤6:第565行的#ifdef __USE_XOPEN2K和第681行的的#endif用//注释掉 【用:681命令跳转到681行】
问题6:
编译 jffs2_tool 工具 mtd-utils_1.5.0 错误信息,里面.c文件找不到一些东东
解决:
到osdrv目录下打开下面的Makefile,搜索jffs2_tool相关并注释
问题7:
mkfs.ubifs/hashtable/hashtable_itr.c:42:1: error: redefinition of ‘hashtable_iterator_key’
-----------
Makefile:204: recipe for target ‘hipctools‘ failed
解决:
步骤1:下载 mtd-utils_1.5.2.tar.bz2
http://nl.archive.ubuntu.com/ubuntu/pool/universe/m/mtd-utils/mtd-utils_1.5.2.orig.tar.bz2
步骤2::cd osdrv/tools/pc/jffs2_tool
mv mtd-utils-1.5.0.tar.bz2 mtd-utils-1.5.0_backup.tar.bz2 (备份)
步骤3:将下载的新版本拷贝到当前目录,并改名
mv mtd-utils_1.5.2.orig.tar.bz2 mtd-utils-1.5.2.tar.bz2
步骤4:修改Makefile:
修改文件中指定的版本号
10 export CHIP
11
12 ifndef CHIP
13 CHIP = hi3516cv200
14 endif
15
16 CC := gcc
17 BUILD_DIR := $(PREFIX)/tmp
18 ZLIB := $(shell pwd)/../zlib
19 ZLIB_INSTALL := $(PREFIX)/../zlib
20 ZLIB_DIR := $(ZLIB_INSTALL)/tmp
21 STRIP := strip
22 MTD_UTILS := mtd-utils-1.5.2
23 # this lib should be install to host
24 LZO := lzo-2.09
25
26 TARGETS
保存退出
问题8:
configure: error: ncurses or ncursesw selected, but library not found (--without-ncurses to disable)
解决:
sudo apt-get install libncurses5-dev libncursesw5-dev
问题9:
uuid/uuid.h no such file or directory
解决:
sudo apt-get install uuid-dev
问题10:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
解决:
apt-get install g++-multilib
问题11:
configure:error:ncurses or ncursesw selected,but library not found(–without-ncrses to disable)
解决:
sudo apt-get install libncurses5-dev libncursesw5-dev
出现---------finish osdrv work,表示整个osdrv编译成功