Build a development environment
1. Prepare ubuntu 16.04
Windows downloads things fast, but the network is poor today. I had to use Thunder to download some packages under win.
1.1 Download etcher
1.2 Prepare ubuntu16.04 iso
1.3 Use etcher to make ubuntu boot USB
I3 desktop computer boot press F12 to enter BOOT option
1.4 Wait for the installation to complete
1.5 Copy Hi3518E_V200R001C01SPC030 to the host
1.6 ssh
sudo apt install openssh-server
1.7 Unzip
tar -zxf Hi3518E_SDK_V1.0.3.0.tgz
1.8 Change source.list
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
2. Expand SDK package content
./sdk.cleanup
When running the shell, ./sdk.unpack: source: not found
The default SH (script parser) of the ubuntu16.04 system is dash, you can use the ls -l /bin/sh command to view
Modify the default script parser to bash, the method is as follows:
1. Command line input: sudo dpkg-reconfigure dash
2. Select <no>
3. ls -l /bin/sh query confirmation
./sdk.unpack
3. Install the cross compiler on the linux server
cd osdrv/opensource/toolchain/arm-hisiv300-linux
sudo ./cross.install.v300
Import environment variables
export PATH=/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin:$PATH
echo $PATH
Modify ~/.bashrc
vim ~/.bashrc
Add at the very bottom:
export PATH=/opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin:$PATH
Let the configuration take effect
source ~/.bashrc
4. Compile OSDRV
cd ~/HI3518EV200/Hi3518E_SDK_V1.0.3.0/osdrv/
make OSDRV_CROSS=arm-hisiv300-linux CHIP=hi3518ev200 all
Error, the system cannot find arm-hisiv300-linux-gcc, indicating that the cross compilation tool has not been installed
4.1 Install cross compilation tool
Solution
Step 1. Enter the directory location of the tool chain and its installation program: Hi3518E_SDK_V1.0.3.0/osdrv/opensource/toolchain/arm-hisiv300-linux
Step 2. Unzip the tool chain: tar -xvf arm-hisiv300-linux.tar .bz2
Step 3, install the tool chain: sudo ./cross.install.v300
Step 4, enter the mount directory of the cross compilation tool chain: cd /opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin
step 5. ls [found that there are many arm-hisiv300-linux-uclibcgnueabi-xxx compilation tool chains]
Step 6, file file arm-hisiv300-linux-uclibcgnueabi-gcc [ELF 32-bit LSB executable, which means this cross-compilation tool The chain is 32-bit, but Ubuntu 16.04 on the virtual machine I use is 64-bit, so 32-bit compatibility packages must be installed]
Step 7, cd ../target/bin,
Step 8, ls [I found there are many arm-hisiv300-linux-xxx compilation tool chain, these are the symbolic links of arm-hisiv300-linux-uclibcgnueabi-xxx, which is the arm-hisiv300-linux tool chain we are looking for, which can be viewed with ls -l]
Step 9, pwd [/Opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin, remember this path, you need to import this path into the environment variable: see steps 9, 10]
Step 10, vi ~/.bashrc, append export PATH=/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin:$PATH at the end of the file
Step 11, source ~/.bashrc [Ensure the environment The variable setting is effective. You can use echo $PATH to check whether the import is successful]
Step 12, ping www.baidu.com [Ensure that the virtual machine can access the Internet]
Step 13, sudo apt install lib32z1 [Note: Before installing any software, be sure to make sure The virtual machine can access the Internet]
Step 14, sudo apt install lib32stdc++6-4.8-dbg [Note: Before installing any software, make sure that the virtual machine can access the Internet]
4.2 Compile again
cd ~/HI3518EV200/Hi3518E_SDK_V1.0.3.0/osdrv/
make OSDRV_CROSS=arm-hisiv300-linux CHIP=hi3518ev200 all
4.3 Error
4.3.1 "mkimage" command not found - U-Boot images will not be built
Solution 1:
Step 1, cd opensource/uboot/u-boot-2010.06
Step 2, ls [You can see that uboot.bin has been generated inside]
Step 3, cd tools [There are mkimage.c and mkimage inside]
Step 4, file mkimage [write x86-64 architecture, ubuntu16.0.04 is also x86-64 architecture, so it can run on the current virtual machine]
Step 5, sudo cp mkimage /usr/local/bin
Step 6, cd ../.. /
Step 7, ls [found that u-boot-2010.06 folder and u-boot-2010.06.tgz compressed package are
needed ] Step 8, mki [continuously press TabTab] [find the completion of mkimage, indicating that it has been successfully resolved]
Solution 2:
Step 1, ping www.baidu.com to ensure that the virtual machine can access the Internet.
Step 2, sudo apt-get install u-boot-tools
4.3.2 compr_zlib.c:39:18: fatal error: zlib.h: No such file or directory
Solution
step 1, sudo apt install zlib1g-dev
4.3.3 serve_image.c:32:18: error: storage size of ‘hints’ isn’t known
The reason
is that the version of the ubuntu operating system is too high, and the version of mtd-utils used by the SDK is too low.
Solution
Modify the operating system header file /usr/include/netdb.h, comment this macro __USE_XOPEN2K, as shown in the figure below (note that #ifdef and #endif are one-to-one correspondence)
Step 1, sudo vim /usr/include/netdb. h
Step 2: set nu [Display line number]
Step 3, /__USE_XOPEN2K [Search]
Step 4, comment out #if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED on line 79 and the corresponding #endif on line 82 //
Step 5, /__USE_XOPEN2K [Search]
Step 6, #ifdef __USE_XOPEN2K on line 565 and #endif on line 681 are commented out with // [Use: 681 command to jump to line 681]
4.3.4 mkfs.ubifs/hashtable/hashtable_itr.c:42:1: error: redefinition of ‘hashtable_iterator_key’
-----------
Makefile:204: recipe for target'hipctools' failed
Solution: Download mtd-utils-1.5.2.tar.bz2 and replace mtd in the osdrv\tools\pc\jffs2_tool directory -utils-1.5.0.tar.bz2
Step 1, wget http://nl.archive.ubuntu.com/ubuntu/pool/universe/m/mtd-utils/mtd-utils_1.5.2.orig.tar.bz2
Step 2. After downloading, you can directly put it in the osdrv\tools\pc\jffs2_tool directory, and modify the compressed package name to mtd-utils-1.5.2.tar.bz2 to be recognized.
Step 3. At the same time, modify the Makefile in this directory and change the version number to 1.5.2. Change mtd-utils-1.5.0 on line 22 to mtd-utils-1.5.2
4.3.5 onfigure: error: ncurses or ncursesw selected, but library not found
Solution:
sudo apt-get install libncurses5-dev libncursesw5-dev
4.3.6 mkfs.ubifs/mkfs.ubifs.h:46:23: fatal error: uuid/uuid.h: No such file or directory
Solution: sudo apt-get install uuid-dev
After the final compilation is completed, the following screen will appear:
reference
HI3518EV200 SDK installs and compiles osdr. https://www.cnblogs.com/Ocean-Star/p/8902397.html
Hi3518EV200 environment setup, https://blog.csdn.net/oqqhutu12345678/article/details/78968791
Hi3518EV200 environment setup-a collection of problems encountered by Ubuntu16 and 18, https://blog.csdn.net/qq_27158179/article/details/86745776