美文网首页
Hisi3569交叉编译

Hisi3569交叉编译

作者: 可不期诺Cappuccino | 来源:发表于2021-11-09 17:10 被阅读0次

    1. 系统

         ubuntu18.04 64位
         由于提供交叉编译程序为32位。需要在64上安装支持32位程序运行库,命令如下 
    
         dpkg --print-architecture  #确认64为架构的内核
          dpkg --print-foreign-architectures  #确认打开了多架构支持功能
    

    输出i386为已打开 ,如果没有需要手动打开

        sudo dpkg --add-architecture i386
        sudo apt-get update
    

    再执行

    sudo apt-get dist-upgrade  ( #这一步是更新所有的软件,如果你对新版本软件的需求不是那么迫切,可以不执行)
    

    安装32位支持库

        sudo apt install libc6:i386
         sudo apt install libstdc++6:i386
    

    2. 下载生成交叉编译环境

       \\192.168.199.88\Software\hisilicon目录下找到Hi3569文件夹下下载解压aarch64-himix200-linux.tgz。
    
     执行    source ./aarch64-himix200-linux.install [dirname]  生成交叉编译环境到dirname
    

    3. 配置交叉编译环境脚本

    编写配置脚本configure-environment.sh,内容如下:

    #!/bin/sh
     
    SDK_PATH="/home/calmcar/aarch64-himix200-linux/"
    export TOOLCHAIN_SYS=aarch64-himix200-linux
    export TOOLCHAIN_PREFIX=$TOOLCHAIN_SYS-
    export SDK_PATH_NATIVE=$SDK_PATH/
    export SDK_PATH_TARGET=$SDK_PATH/target
    export PATH=$SDK_PATH_NATIVE/bin/aarch64-himix200-linux:$PATH
    export CPATH=$SDK_PATH_TARGET/usr/include:$CPATH
    export PKG_CONFIG_SYSROOT_DIR=$SDK_PATH_TARGET
    export PKG_CONFIG_PATH=$SDK_PATH_TARGET/usr/lib/pkgconfig
    export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
    #export CONFIG_SITE=$SDK_PATH/site-config-$REAL_MULTIMACH_TARGET_SYS
    export CC="${SDK_PATH}/bin/${TOOLCHAIN_PREFIX}gcc"
    #--sysroot=$SDK_PATH_TARGET
    export CXX="${SDK_PATH}/bin/${TOOLCHAIN_PREFIX}g++"
    # --sysroot=$SDK_PATH_TARGET
    export GDB=${TOOLCHAIN_PREFIX}gdb
    export CPP="${TOOLCHAIN_PREFIX}gcc -E --sysroot=$SDK_PATH_TARGET"
    export LD="${TOOLCHAIN_PREFIX}ld --sysroot=$SDK_PATH_TARGET"
    export NM=${TOOLCHAIN_PREFIX}nm
    export AS=${TOOLCHAIN_PREFIX}as
    export AR=${TOOLCHAIN_PREFIX}ar
    export RANLIB=${TOOLCHAIN_PREFIX}ranlib
    export OBJCOPY=${TOOLCHAIN_PREFIX}objcopy
    export OBJDUMP=${TOOLCHAIN_PREFIX}objdump
    export STRIP=${TOOLCHAIN_PREFIX}strip
    export CONFIGURE_FLAGS="--target=aarch64-linux --host=aarch64-linux --build=x86_64-linux --with-libtool-sysroot=$SDK_PATH_TARGET"
    export CPPFLAGS=" --sysroot=$SDK_PATH_TARGET"
    export CFLAGS="$CPPFLAGS"
    export CXXFLAGS="$CPPFLAGS"
    export LDFLAGS=" --sysroot=$SDK_PATH_TARGET"
    export OECORE_NATIVE_SYSROOT=$SDK_PATH_NATIVE
    export OECORE_TARGET_SYSROOT=$SDK_PATH_TARGET
    export OECORE_ACLOCAL_OPTS="-I $SDK_PATH_NATIVE/usr/share/aclocal"
    export OECORE_DISTRO_VERSION="2020.05"
    export OECORE_SDK_VERSION="2020.05"
     
    # Append environment subscripts
    if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
        for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
            . $envfile
        done
    fi
    if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
        for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
            . $envfile
        done
    fi
    

    cmake 编译工程

    (1)编写build_hisi.sh,内容如下:

    #!/bin/bash
    source /home/calmcar/Hisi/configure-environment.sh
    cd ./build
    #cmake -DCMAKE_SYSTEM_VERSION="3569" -DCMAKE_SYSTEM_PROCESSOR="aarch64" -DCMAKE_TOOLCHAIN_FILE=./toolchain_hisi.cmake -G"Unix Makefiles" ..
    cmake ..
    make -j8
    
    1. demo编译
      下载解压freetype-2.10.2
      修改configure-environment.sh 下SDK_PATH 为自己的路径
      build_hisi.sh下修改configure-environment.sh为自己的路径
      build_his.sh文件拷贝到freetype-2.10.2解压后CMakeList同级路径。
      执行命令:
      mkdir build
      ./build_his.sh

    相关文章

      网友评论

          本文标题:Hisi3569交叉编译

          本文链接:https://www.haomeiwen.com/subject/ioxvzltx.html