系统版本: Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-159-generic x86_64)
前期文件清单:【操作目录:/data/hi3516】
.
├── arm-himix200-linux.tgz —> 交叉编译软件包
├── Hi3516CV500R001C02SPC011.rar —> 解压之后 /data/hi3516/Hi3516CV500/目录
.
├── 00.hardware
├── 01.software —> /data/hi3516/Hi3516CV500/01.software/board 里面有SDK文件
└── 02.only for reference
1、解压缩 SDK 包
cd /data/hi3516/Hi3516CV500/01.software/board
tar -xzf Hi3516CV500_SDK_V2.0.1.1.tgz
2、展开 SDK 包内容
./sdk.unpack
出现错误信息
./sdk.unpack: 2: ./sdk.unpack: source: not found
./sdk.unpack: 4: ./sdk.unpack: ECHO: not found
./sdk.unpack: 6: ./sdk.unpack: WARN: not found
./sdk.unpack: 7: ./sdk.unpack: WARN: not found
./sdk.unpack: 8: ./sdk.unpack: ECHO: not found
./sdk.unpack: 15: ./sdk.unpack: ECHO: not found
./sdk.unpack: 20: ./sdk.unpack: ECHO: not found
mkdir: created directory 'drv/'
./sdk.unpack: 22: ./sdk.unpack: run_command_progress_float: not found
./sdk.unpack: 24: ./sdk.unpack: ECHO: not found
mkdir: created directory 'osal/'
./sdk.unpack: 26: ./sdk.unpack: run_command_progress_float: not found
./sdk.unpack: 28: [: =: unexpected operator
./sdk.unpack: 28: [: =: unexpected operator
./sdk.unpack: 34: ./sdk.unpack: ECHO: not found
mkdir: created directory 'osdrv/'
./sdk.unpack: 36: ./sdk.unpack: run_command_progress_float: not found
./sdk.unpack: 39: [: =: unexpected operator
./sdk.unpack: 39: [: =: unexpected operator
./sdk.unpack: 56: [: =: unexpected operator
./sdk.unpack: 56: [: =: unexpected operator
./sdk.unpack: 83: [: =: unexpected operator
./sdk.unpack: 83: [: =: unexpected operator
./sdk.unpack: 109: [: =: unexpected operator
./sdk.unpack: 109: [: =: unexpected operator
解决方案
# sudo dpkg-reconfigure dash
Using dash as the system shell will improve the system's overall performance. It does not alter the shell presented to interactive users.
Use dash as the default system shell (/bin/sh)?
选择no
可以用: ls -l /bin/sh 查看
3、在 linux 服务器上安装交叉编译器
cd /data/hi3516/
tar –xzf arm-himix200-linux.tgz
cd arm-himix200-linux/
chmod +x arm-himix200-linux.install
./arm-himix200-linux.install
source /etc/profile
4、编译 osdrv
cd /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
vim Makefile
修改芯片型号为 hi3516cv500
执行make all 会报错,原因是linux-4.9.37 kernel 源文件找不到,需要下载
# make all
make: arm-himix200-linux-gcc: Command not found
Makefile:211: "---------------------------------------------------------------------"
Makefile:212: " Cannot found the linux-4.9.37 kernel source file "
Makefile:213: " Please download the compression package from www.kernel.org "
Makefile:214: "---------------------------------------------------------------------"
Makefile:215: *** . Stop.
解决方案:
从linux开源社区下载v4.9.37版本的内核:
1)进入网站:www.kernel.org
2)选择HTTP协议资源的https://www.kernel.org/pub/选项,进入子页面
3)选择linux/菜单项,进入子页面
4)选择kernel/菜单项,进入子页面
5)选择v4.x/菜单项,进入子页面
6)下载linux-4.9.37.tar.gz (或者linux-4.9.37.tar.xz)到osdrv/opensource/kernel目录下
报错信息:
make: arm-himix200-linux-gcc: Command not found
mkdir /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/pub/hi3516cv500_spi_smp_image_glibc -p
mkdir /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/pub/bin/board_glibc -p
mkdir /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/pub/bin/pc -p
---------task [0] hiregbin_prepare
tar xzf /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1.tgz -C /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools
chmod 777 /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1/hiregbin
cp /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/Hi3516CV500-DMEB_4L-DDR3_1800M_256MB_16bit-A7_900M-SYSBUS_300M.xlsm /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1
pushd /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1;./hiregbin Hi3516CV500-DMEB_4L-DDR3_1800M_256MB_16bit-A7_900M-SYSBUS_300M.xlsm reg_info_hi3516cv500.bin;popd
/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1 /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
./hiregbin: line 3: ./jre/bin/java: No such file or directory
/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
mv /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1/reg_info_hi3516cv500.bin /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools
mv: cannot stat '/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/uboot_tools/hiregbin-v5.0.1/reg_info_hi3516cv500.bin': No such file or directory
Makefile:159: recipe for target 'hiregbin_prepare' failed
make: *** [hiregbin_prepare] Error 1
原因分析:
【line 3: ./jre/bin/java: No such file or directory】
这是因为宿主机是64 位 而交叉编译器是针对32位的开发板制作的。所以要安装对应的32位库。
我的linux宿主机是ubuntu 16.04 64位。
解决方案:
sudo apt install lib32z1-dev
报错信息:
make[1]: Leaving directory '/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/kernel/linux-4.9.y-smp'
pushd /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/kernel/linux-4.9.y-smp;\
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage -j 20 >/dev/null;popd
/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/kernel/linux-4.9.y-smp /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
/bin/sh: bc: command not found
make[2]: *** [include/generated/timeconst.h] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [prepare0] Error 2
/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
cp /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/kernel/linux-4.9.y-smp/arch/arm/boot/uImage /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/pub/hi3516cv500_spi_smp_image_glibc/uImage_hi3516cv500_smp
cp: cannot stat '/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/kernel/linux-4.9.y-smp/arch/arm/boot/uImage': No such file or directory
Makefile:222: recipe for target 'hikernel' failed
make: *** [hikernel] Error 1
原因分析:
【/bin/sh: bc: command not found】bc 命令未安装
【4.9.y-smp/arch/arm/boot/uImage': No such file or directory】 mkimage 工具未安装
解决方案:
apt-get install bc
apt-get install u-boot-tools
报错信息:
configure: mtd-utils can optionally be built without mkfs.ubifs
configure: mtd-utils can optionally be built without mkfs.jffs2
configure: error: missing one or more dependencies
Makefile:45: recipe for target '/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2' failed
make[1]: *** [/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2] Error 1
make[1]: Leaving directory '/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/tools/pc/jffs2_tool'
Makefile:269: recipe for target 'hipctools' failed
make: *** [hipctools] Error 2
原因分析:
编译mtd-utils会失败
解决方案:
sudo apt-get install zlib1g-dev liblzo2-dev uuid-dev pkg-config automake
编译成功:显示【finish osdrv work】
/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv/pub /data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
/data/hi3516/Hi3516CV500/01.software/board/Hi3516CV500_SDK_V2.0.1.1/osdrv
---------finish osdrv work