准备工作

  1. 下载交叉编译工具:
    百度网盘:链接:https://pan.baidu.com/s/1g4frOXmSnQU1NsOj8Zu60A

        提取码:rdap
  2. ubuntu版本:

    vmare安装的ubuntu18.04 amd64版本

     dopi@ubuntu:~$ cat /proc/version
    Linux version 5.3.0-62-generic (buildd@lcy01-amd64-004) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020

交叉编译

1. 首先更换镜像源,再更新

打开镜像源,ubuntu18更新源:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
选择ubuntu18.04:
在这里插入图片描述
修改权限,复制到 source.list 中,保存退出。

sudo chmod 777 /etc/apt/sources.list
vi /etc/apt/sources.list

2. 首先更新系统

更新命令:

 sudo apt-get update && sudo apt-get install -y bzip2 build-essential libc6-dev-i386 ia32-libs lib32z1-dev libncurses5 libncurses5-dev u-boot-tools vim squashfs-tools gettext git zip subversion bc

错误提示:Package ‘ia32-libs’ has no installation candidate

dopi@ubuntu:/home/ev200_tools$ sudo apt-get update && sudo apt-get install -y bzip2 build-essential libc6-dev-i386 ia32-libs lib32z1-dev libncurses5 libncurses5-dev u-boot-tools vim squashfs-tools gettext git zip subversion bc                                                                                                                        
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ia32-libs 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:
  lib32ncurses5 lib32z1
E: Package 'ia32-libs' has no installation candidate

解决方法:

sudo apt-get install lib32z1 lib32ncurses5 
sudo apt-get install lib32stdc++6

去掉ia32-libs,重新更新系统:

sudo apt-get update && sudo apt-get install -y bzip2 build-essential libc6-dev-i386  lib32z1-dev libncurses5 libncurses5-dev u-boot-tools vim squashfs-tools gettext git zip subversion bc

提示更新完成:

Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
bc is already the newest version (1.07.1-2).
build-essential is already the newest version (12.4ubuntu1).
lib32z1-dev is already the newest version (1:1.2.11.dfsg-0ubuntu2).
libc6-dev-i386 is already the newest version (2.27-3ubuntu1).
zip is already the newest version (3.0-11build1).
subversion is already the newest version (1.9.7-4ubuntu1).
bzip2 is already the newest version (1.0.6-8.1ubuntu0.2).
gettext is already the newest version (0.19.8.1-6ubuntu0.3).
git is already the newest version (1:2.17.1-1ubuntu0.7).
libncurses5 is already the newest version (6.1-1ubuntu1.18.04).
libncurses5-dev is already the newest version (6.1-1ubuntu1.18.04).
squashfs-tools is already the newest version (1:4.3-6ubuntu0.18.04.1).
u-boot-tools is already the newest version (2019.07+dfsg-1ubuntu4~18.04.1).
vim is already the newest version (2:8.0.1453-1ubuntu1.3).
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.

3. 把arm-himix100-linux.tgz拷贝到ubuntu18中

下载的arm-himix100-linux.tgz拷贝到ubuntu18中,我是通过vmare的共享文件夹拷贝到ubuntu18中的。

 dopi@ubuntu:/mnt/hgfs$ cd dopi-linux/
dopi@ubuntu:/mnt/hgfs/dopi-linux$ ls
arm-himix100-linux.tgz
dopi@ubuntu:/mnt/hgfs/dopi-linux$ cp arm-himix100-linux.tgz /home/ev200_tools/

4. 解压 tar -zxvf arm-himix100-linux.tgz

dopi@ubuntu:/mnt/hgfs/dopi-linux$ cd /home/ev200_tools/
dopi@ubuntu:/home/ev200_tools$ ls
arm-himix100-linux.tgz
dopi@ubuntu:/home/ev200_tools$ tar -zxvf arm-himix100-linux.tgz 
arm-himix100-linux/
arm-himix100-linux/arm-himix100-linux.install
arm-himix100-linux/runtime_uclibc.tgz
arm-himix100-linux/arm-himix100-linux.tar.bz2
arm-himix100-linux/readme.txt

4. 安装

安装命令

  cd arm-himix100-linux/
  sudo ./arm-himix100-linux.install

执行过程,到此安装交叉编译工具链完成。

dopi@ubuntu:/home/ev200_tools$ ls
arm-himix100-linux  arm-himix100-linux.tgz
dopi@ubuntu:/home/ev200_tools$ cd arm-himix100-linux/
dopi@ubuntu:/home/ev200_tools/arm-himix100-linux$ sudo ./arm-himix100-linux.install
Installing HuaWei LiteOS Linux at /opt/hisi-linux/x86-arm
Delete exist directory...
Extract cross tools ...
skip export toolchains path

通过查询版本号,确认是否安装成功: arm-himix100-linux-gcc -v

dopi@ubuntu:/home/ev200_tools/arm-himix100-linux$ arm-himix100-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-himix100-linux-gcc
COLLECT_LTO_WRAPPER=/opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../libexec/gcc/arm-linux-uclibceabi/6.3.0/lto-wrapper
Target: arm-linux-uclibceabi
Configured with: /home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/src/gcc-6.3.0/configure --host=i386-redhat-linux --build=i386-redhat-linux --target=arm-linux-uclibceabi --prefix=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/install --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --disable-libatomic --disable-nls --enable-clocale=gnu --enable-extra-hisi-multilibs --with-sysroot=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/install/target --with-build-sysroot=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/install/target --with-gmp=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/obj/host-libs/usr --with-mpfr=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/obj/host-libs/usr --with-mpc=/home/sying/SDK_CPU_UNIFIED/build/script/arm-himix100-linux/arm_himix100_build_dir/obj/host-libs/usr --disable-libgomp --disable-libquadmath --disable-fixed-point --disable-libsanitizer --disable-libitm --enable-poison-system-directories --with-pkgversion='HC&C V100R002C00B032_20190114'
Thread model: posix
gcc version 6.3.0 (HC&C V100R002C00B032_20190114) 

5. 添加到环境变量中

export path=/opt/hisi-linux/x86-arm/arm-himix100-linux/bin
source /etc/profile

6. 感谢阅读

感谢阅读,此文献给初学者,关注DOPI海思开源项目!

文档更新时间: 2021-02-18 06:59   作者:Tony