鸿蒙OpenHarmony【轻量系统 环境搭建】 (基于Hi3861开发板)

ops/2024/10/24 11:12:43/

 安装Hi3861开发板特有环境

除上述[安装库和工具集]和[安装编译工具]外,针对Hi3861开发板还需要安装特定的编译工具。

工具要求

表1 Hi3861 WLAN模组需要安装的编译工具

开发工具用途
SCons3.0.4+编译构建工具
python模块:setuptools、kconfiglib、pycryptodome、six、ecdsa编译构建工具
gcc riscv32编译构建工具

操作步骤

相关操作在Ubuntu环境下进行。

安装Scons

  1. 运行如下命令,安装SCons安装包。

    python3 -m pip install scons

  2. 运行如下命令,查看是否安装成功。如果安装成功,查询结果下图所示。

    scons -v

    图1 SCons安装成功界面,版本要求3.0.4以上  

    hi3861-scons-install-success

鸿蒙开发>鸿蒙开发指导文档:gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。

安装python模块

  1. 运行如下命令,安装python模块setuptools。

    pip3 install setuptools

  2. 安装GUI menuconfig工具(Kconfiglib),建议安装Kconfiglib 13.2.0+版本,任选如下一种方式。

    • 命令行方式:

      sudo pip3 install kconfiglib

    • 安装包方式:

      1. 下载.whl文件(例如:kconfiglib-13.2.0-py2.py3-none-any.whl)。 下载路径:“https://pypi.org/project/kconfiglib#files”
      2. 运行如下命令,安装.whl文件。

        sudo pip3 install kconfiglib-13.2.0-py2.py3-none-any.whl
  3. 安装pycryptodome,任选如下一种方式。

    安装升级文件签名依赖的Python组件包,包括:pycryptodome、six、ecdsa。安装ecdsa依赖six,请先安装six,再安装ecdsa。

    • 命令行方式:

      sudo pip3 install pycryptodome

    • 安装包方式:

      1. 下载.whl文件(例如:pycryptodome-3.9.9-cp38-cp38-manylinux1_x86_64.whl)。 下载路径:“https://pypi.org/project/pycryptodome/#files”。
      2. 运行如下命令,安装.whl文件。

        sudo pip3 install pycryptodome-3.9.9-cp38-cp38-manylinux1_x86_64.whl

  4. 安装six,任选如下一种方式。

    • 命令行方式:

      sudo pip3 install six --upgrade --ignore-installed six

    • 安装包方式:

      1. 下载.whl文件(例如:six-1.12.0-py2.py3-none-any.whl)。 下载路径:“https://pypi.org/project/six/#files”
      2. 运行如下命令,安装.whl文件。

        sudo pip3 install six-1.12.0-py2.py3-none-any.whl

  5. 安装ecdsa,任选如下一种方式。

    • 命令行方式:

      sudo pip3 install ecdsa

    • 安装包方式:

      1. 下载.whl文件(例如:ecdsa-0.14.1-py2.py3-none-any.whl)。 下载路径:“https://pypi.org/project/ecdsa/#files”
      2. 运行如下命令,安装.whl文件。

        sudo pip3 install ecdsa-0.14.1-py2.py3-none-any.whl

安装gcc_riscv32(WLAN模组类编译工具链)

须知:

  • Hi3861开发板平台仅支持使用libgcc运行时库的静态链接,不建议开发者使用libgcc运行时库的动态链接,以免产品需遵从GPLV3许可证。
  • 通过下述步骤2-14,编译好了gcc_riscv32镜像,提供给开发者[直接下载]使用。直接下载gcc_riscv32镜像的开发者可省略下述2-14步。
  1. 打开Linux编译服务器终端。
  2. 下载riscv-gnu-toolchain交叉编译工具链。

    git clone --recursive https://gitee.com/mirrors/riscv-gnu-toolchain.git

  3. 打开文件夹riscv-gnu-toolchain,先删除空文件夹,以防止下载newlib,binutils,gcc时冲突。

    cd riscv-gnu-toolchain && rm -rf riscv-newlib && rm -rf riscv-binutils && rm -rf riscv-gcc

  4. 下载riscv-newlib-3.0.0。

    git clone -b riscv-newlib-3.0.0 https://github.com/riscv/riscv-newlib.git

  5. 下载riscv-binutils-2.31.1。

    git clone -b riscv-binutils-2.31.1 https://github.com/riscv/riscv-binutils-gdb.git

  6. 下载riscv-gcc-7.3.0。

    git clone -b riscv-gcc-7.3.0 https://github.com/riscv/riscv-gcc

  7. 添加riscv-gcc-7.3.0补丁。

    访问gcc官方补丁链接[89411],[86724],按照补丁链接中要求的修改,手动将变更添加到对应的.c和.h文件中,注意由于patch版本与下载的gcc版本有所偏差,行数有可能对应不上,请自行查找patch中的关键字定位到对应行。

  8. 下载[GMP 6.1.2],并解压安装。

    ​
    tar -xvf gmp-6.1.2.tar.bz2 && mkdir build_gmp && cd build_gmp && ../gmp-6.1.2/configure --prefix=/usr/local/gmp-6.1.2 --disable-shared --enable-cxx && make && make install​

  9. 下载[mpfr-4.0.2 ],并解压安装。

    tar -xvf mpfr-4.0.2.tar.gz && mkdir build_mpfr && cd build_mpfr && ../mpfr-4.0.2/configure --prefix=/usr/local/mpfr-4.0.2 --with-gmp=/usr/local/gmp-6.1.2 --disable-shared && make && make install

  10. 下载mpc-1.1.0  ,并解压安装。

    tar -xvf mpc-1.1.0.tar.gz && mkdir build_mpc && cd build_mpc && ../mpc-1.1.0/configure --prefix=/usr/local/mpc-1.1.0 --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-4.0.2 --disable-shared && make && make install

  11. 打开文件夹riscv-gnu-toolchain,新建工具链输出目录。

    cd /opt && mkdir gcc_riscv32

  12. 编译binutils。

    mkdir build_binutils && cd build_binutils && ../riscv-binutils-gdb/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --bindir=/opt/gcc_riscv32/bin --libexecdir=/opt/gcc_riscv32/riscv32 --libdir=/opt/gcc_riscv32 --includedir=/opt/gcc_riscv32 && make -j16 && make install && cd ..

  13. 编译newlib。

    mkdir build_newlib && cd build_newlib && ../riscv-newlib/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" \CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --bindir=/opt/gcc_riscv32/bin --libexecdir=/opt/gcc_riscv32 --libdir=/opt/gcc_riscv32 --includedir=/opt/gcc_riscv32 && make -j16 && make install && cd ..

  14. 编译gcc。

    mkdir build_gcc && cd build_gcc && ../riscv-gcc/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" LDFLAGS="-Wl,-z,relro,-z,now,-z,noexecstack" CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --with-headers="/opt/gcc-riscv32/riscv32-unknown-elf/include" --with-mpc=/usr/local/mpc-1.1.0 --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-4.0.2 && make -j16 && make install

搜狗高速浏览器截图20240326151547.png

  1. 设置环境变量。

说明:

>
> 如果直接采用编译好的riscv32 gcc包,请先执行以下命令将压缩包解压到根目录:
>
> ```
> tar -xvf gcc_riscv32-linux-7.3.0.tar.gz -C ~
> ```
>
> 注意之后设置和生效环境变量时,所设置的路径为根目录。

打开`.bashrc`文件。 

vim /opt/.bashrc
将以下命令拷贝到的最后一行,保存并退出。
export PATH=/opt/gcc_riscv32/bin:$PATH
  1. 生效环境变量。

    source /opt/.bashrc

  2. Shell命令行中输入如下命令,如果能正确显示编译器版本号,表明编译器安装成功。

    riscv32-unknown-elf-gcc -v

我们程序员都知道学习开发技术,最先是从语言学起,鸿蒙语言有TS、ArkTS等语法,那么除了这些基础知识之外,其核心技术点有那些呢?下面就用一张整理出的鸿蒙学习路线图表示:

从上面的OpenHarmony技术梳理来看,鸿蒙的学习内容也是很多的。现在全网的鸿蒙学习文档也是非常的少,下面推荐一些:完整内容可在头像页保存,或这qr23.cn/AKFP8k甲助力

内容包含:《鸿蒙NEXT星河版开发学习文档》

  • ArkTS
  • 声明式ArkUI
  • 多媒体
  • 通信问题
  • 系统移植
  • 系统裁剪
  • FW层的原理
  • 各种开发调试工具
  • 智能设备开发
  • 分布式开发等等。

这些就是对往后开发者的分享,希望大家多多点赞关注喔!


http://www.ppmy.cn/ops/24896.html

相关文章

计算机网络-IS-IS基础配置实验

前面我们了解了IS-IS的一些基础理论,从建立邻接、链路状态数据库同步以及路由计算,现在开始学习下配置操作。 一、IS-IS配置 网络拓扑图: 拓扑图 IS-IS有Level级别的区分,Level-1可以是性能较低的设备只维护区域内的LSDB&#xff…

工厂降温通风方案有多种

工厂降温通风方案有多种,以下是一些常见的方案: 自然通风:利用门窗、天窗等自然开口,通过热压和风压等自然力进行通风。这种方案简单易行、无能耗、效果显著,特别适用于小型工厂或车间。关键是确定最佳通风时间&#…

连锁企业如何通过OceanBase解决数据库瓶颈

本文来自OceanBase客户,重庆三十七度健康管理有限公司的技术负责人Rinvay的分享 背景 足疗养生对于大家来说应该并不陌生,自古以来便有多部古籍记载。尽管现代生活中,人们可能不再严格遵循节气进行泡脚,但在忙碌的工作间隙&#…

YOLOv8+bytetrack实现多目标追踪

1. bytetrack简介 ByteTrack是一种基于检测的目标追踪算法,它在YOLOv8检测器的基础上进行了改进,实现了更高效的目标追踪,具有简单、高效和通用的特点。相较于传统的多目标跟踪方法,ByteTrack不依赖于ReID模型,而是通…

2024年十五届蓝桥杯省赛大学B组真题(Java完整版)

2024年十五届蓝桥杯省赛大学B组真题(Java) 前言: 赛后一直犹豫要不要对比赛进行复盘出个题解,拖到了现在,终于也是等到比赛结果出来,看到没有辜负个人期望成功取得省一,决定在国赛前对省赛进行…

拦截pytorch算子,dump输入输出

拦截pytorch算子,dump输入输出 一.代码二.输出 希望dump出pytorch每个算子的输入输出,但pytorch普通的hook机制只能拦截module.以下提供一种方法可以拦截torch.add,torch.Tensor.add这类算子.原理是通过模板替换,劫持torch和torch.Tensor中的算子.遍历next_functions调用regist…

MO干货 | Matrixone-Operator 设计与实现

作者:吴叶磊 MO研发工程师 目录 Part 1.MatrixOne-Operator 设计 Part 2.集群 API 设计 Part 3.控制器实现 Part 4.应用状态管理 Part 5.总结 Part 1 MatrixOne-Operator 设计 尽管 K8S 原生提供了 StatefulSet API 来服务有状态应用的编排,但由于…

Grafana – unable to login “User already exists”

The Issue When trying to log into Grafana Web UI using an OIDC provider, in my case, Dex. The login would fail due to the error “User already exists”, after some time. This happened for any users given access via the OIDC. The Cause This looks to happ…