Hi3518EV200的环境搭建

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/oqqHuTu12345678/article/details/78968791

主要是安装SDK,编译得到烧录所需的uboot、kernel、rootfs。

  • 在osdrv/pub/image_uclibc目录下得到uboot和uImage
  • 根文件系统在osdrv/pub目录下,若需要制作成镜像,则执行(注意路径)osdrv/pub/bin/pc/mkfs.jffs2 -d osdrv/pub/rootfs_uclibc -l -e 0x10000 -o osdrv/pub/image_uclibc/rootfs_uclibc_64k.jffs2

1、下载包含海思SDK的软件包。https://pan.baidu.com/s/1geV6n1D

2、将Hi3518E V200R001**/01.software/board/Hi3518E_SDK_V1.0.3.0.tgz拷贝到虚拟机合适的目录(/root/hisisdk),并解压(使用命令: tar -zxf Hi3518E_SDK_V1.0.3.0.tgz )

3、解压SDK:./sdk.cleanup,然后再./sdk.unpack

4、安装交叉编译工具链

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0#ls
drv  mpp  osdrv  package  scripts  sdk.cleanup  sdk.unpack

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0# cd osdrv/opensource/toolchain/arm-hisiv300-linux(此交叉编译工具链对应uclibc库,相对比gclibc库小得多)

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/opensource/toolchain/arm-hisiv300-linux#ls
arm-hisiv300-linux.tar.bz2  cross.install.v300  runtime_lib

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/opensource/toolchain/arm-hisiv300-linux#sudo ./cross.install.v300(该脚本指定了工具链的安装的路径)

root@ubuntu:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin#export PATH=/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin:$PATH (环境变量的导入
root@ubuntu:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin# echo $PATH
/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin:/usr/local/arm/arm-2009q3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
root@ubuntu:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin# vim ~/.bashrc然后在末行添加上面的环境变量导入语句命令

然后source /etc/profile(否则编译时会报错arm-hisiv300-linux-gcc:command not found)

5、编译整个osdrv

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv#make OSDRV_CROSS=arm-hisiv300-linux CHIP=hi3518ev200 all

报错,需要修改sh的命令链接,使其链接到bash

root@ubuntu:/bin# ls -lh sh
lrwxrwxrwx 1 root root 4 Oct 18 07:43 sh -> dash

root@ubuntu:/bin# sudo dpkg-reconfigure dash  //在弹出的窗口处选择no
Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash'

root@ubuntu:/bin# ls -lh sh
lrwxrwxrwx 1 root root 4 Jan  3 19:18 sh -> bash
root@ubuntu:/bin# 

然后再

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv#make OSDRV_CROSS=arm-hisiv300-linux CHIP=hi3518ev200 all

6、至此,SDK安装完毕。uboot、kernel、rootfs也可以单独编译,详细参照osdrv/readme_cn.txt

附:还可能出现的错误

(1)"mkimage" command not found - U-Boot images will not be built

解决方法如下:

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv#sudo apt-get install uboot-mkimage
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package uboot-mkimage is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  u-boot-tools
E: Package 'uboot-mkimage' has no installation candidate

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv# sudo apt-get install u-boot-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  u-boot-tools
0 upgraded, 1 newly installed, 0 to remove and 674 not upgraded.
Need to get 59.7 kB of archives.
After this operation, 197 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main u-boot-tools i386 2013.10-3 [59.7 kB]
Fetched 59.7 kB in 1s (51.7 kB/s) 
Selecting previously unselected package u-boot-tools.
(Reading database ... 169087 files and directories currently installed.)
Preparing to unpack .../u-boot-tools_2013.10-3_i386.deb ...
Unpacking u-boot-tools (2013.10-3) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up u-boot-tools (2013.10-3) ...

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv# 

或者,将osdrv/opensource/uboot/u-boot-2010.06/tools目录下的mkimage拷贝到/usr/local/bin目录下,即可。

(2)出现mkyaffs2image100错误提示:

因为SDK有在64位系统下编译的.o文件,而我用的是32位的ubuntu,解决办法是进入tools/pc/mkyaffs2image/mkyaffs2image目录下,rm *.o(或者make clean)删除所有之前编译的痕迹即可。实际上我们板子上用的是spi flash,适用jffs2文件系统,所以不会做yaffs2文件系统,这个东西要不要都无所谓的。

make[2]: *** [mkyaffs2image100] Error 1
make[2]: Leaving directory `/root/hisisdk/Hi3518E_S DK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image/mkyaffs2image'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image'
make: *** [hipctools] Error 2
root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv# cd ./tools/pc/mkyaffs2image/mkyaffs2image
root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image/mkyaffs2image#ls
devextras.h      mkyaffs2image.o    oob_config_v100.o  oob_config_v400.c  tar          yaffs_ecc.o   yaffs_packedtags2.c  yaffs_tagsvalidity.c  yaffs_trace.h
Makefile         oob_config.h       oob_config_v300.c  oob_config_v504.c  yaffs_ecc.c  yaffs_guts.h  yaffs_packedtags2.h  yaffs_tagsvalidity.h  yportenv.h
mkyaffs2image.c  oob_config_v100.c  oob_config_v301.c  oob_config_v610.c  yaffs_ecc.h  yaffs_list.h  yaffs_packedtags2.o  yaffs_tagsvalidity.o

root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image/mkyaffs2image#make clean
rm -f mkyaffs2image.o yaffs_ecc.o yaffs_packedtags2.o yaffs_tagsvalidity.o mkyaffs2image??? oob_config_v???.o
root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image/mkyaffs2image# ls
devextras.h  mkyaffs2image.c  oob_config_v100.c  oob_config_v301.c  oob_config_v504.c  tar          yaffs_ecc.h   yaffs_list.h         yaffs_packedtags2.h   yaffs_tagsvalidity.h  yportenv.h Makefile     oob_config.h     oob_config_v300.c  oob_config_v400.c  oob_config_v610.c  yaffs_ecc.c  yaffs_guts.h  yaffs_packedtags2.c  yaffs_tagsvalidity.c  yaffs_trace.h
root@ubuntu:~/hisisdk/Hi3518E_SDK_V1.0.3.0/osdrv/tools/pc/mkyaffs2image/mkyaffs2image#make //这里的make只是对错误部分的make,其他部分已经是正确的。

(3)bash: osdrv/pub/bin/pc/mkfs.jffs2: No such file or directory
https://blog.csdn.net/QHZM72/article/details/79200213

(4)交叉工具链是32bit的而ubuntu是64bit的。

这里我的ubuntu就是32bit的,所以规避了这个问题

(5)错误:compr_zlib.c:39:18: fatal error: zlib.h: No such file or directory

因为找不到zlib.h所以编译错误,zlib.h在tools/pc/zlib/tmp/include目录中有,只需要复制到tools/pc/jffs2_tool/tmp/include目录中即可,注意同时要将zconf.h也复制过去的。还有要将tools/pc/zlib/tmp/lib目录下的libz.a  libz.so  libz.so.1  libz.so.1.2.7等4个文件复制到tools/pc/jffs2_tool/tmp/lib目录下。

(6)其他错误
其他错误不需再管,因为此时已经有mkfs.jffs2了,我们只要这个而已,手工将其复制到osdrv/pub/bin/pc目录下。

猜你喜欢

转载自blog.csdn.net/oqqHuTu12345678/article/details/78968791