导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    【XR806开发板试用】XR806与鸿蒙,简化构建环境流程

    Wireless & Analog Series
    1
    1
    1465
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • R
      RiceChen LV 4 最后由 q1215200171 编辑

      前言

      • 很荣幸再次获得评测开发板的机会,这次活动依旧是ARM中国举办的活动。
      • 这次评测的开发板--全志XR806开发板+搭载Open鸿蒙1.0操作系统。这是完美的国产化。中国牛逼。。。。
      • 第一次接触鸿蒙是一年前,最开始接触是适配了RT-Thread内核进Open鸿蒙1.0中作为第三方内核。不过这个没有公布,只是玩玩。
      • 第二次接触是在5个月前,参与小熊派社区适配Open鸿蒙的Lite-A到STM32MP157,当时主要负责构建系统部分,以及1~2个驱动的适配。
      • 评测XR806算是我第三次接触Open鸿蒙, XR608内核采用Lite-M。在XR608的交流群中,我发现大家已久吐槽最多的就是整个构建流程,环境搭建TM的痛苦。所以写这篇文章的目的就是简化整个环境搭建流程。

      环境搭建

      安装ubuntu

      1. 建议采用ubuntu 18.04版本,这样子掉坑会比较少。
      2. 新安装的ubuntu可能存在与windows电脑之间无法复制粘贴问题,解决方案,如下命令:
      rice@rice:~$ sudo apt-get autoremove open-vm-tools
      rice@rice:~$ sudo apt-get install open-vm-tools-desktop
      

      安装git

      1. 在调试终端输出如下命令:
      rice@rice:~$ sudo apt-get install git
      ...
      rice@rice:~$ git config --global user.email "you@example.com"
      rice@rice:~$ git config --global user.name "Your Name"
      

      安装python3.8

      1. 在调试终端输出如下命令:
      rice@rice:~$ sudo apt-get install python3.8
      rice@rice:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
      rice@rice:~$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
      
      1. 在接下来的操作如果出现如下错误,请执行下面命令:
      • 错误码如下:
      Traceback (most recent call last):
        File "/usr/lib/command-not-found", line 28, in <module>
          from CommandNotFound import CommandNotFound
        File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
          from CommandNotFound.db.db import SqliteDatabase
        File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
          import apt_pkg
      ModuleNotFoundError: No module named 'apt_pkg'
      
      • 错误纠正命令:
      sudo cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so
      

      安装docker

      1. 在调试终端输出如下命令:
      rice@rice:~/xr806$ sudo apt install docker.io
      

      环境搭建完成

      xr806工程搭建

      创建xr806

      1. 在调试终端输出如下命令:
      rice@rice:~$ mkdir xr806
      rice@rice:~$ cd xr806
      

      下载的repo文件

      1. 下载的repo文件,在调试终端输出如下命令:
      rice@rice:~/xr806$ git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
      
      1. 修改git-repo下载到的repo文件REPO_URL地址(https://mirrors.ustc.edu.cn/aosp/git-repo),操作如下所示:
      • 在调试终端输出如下命令:
      rice@rice:~/xr806$ vim git-repo/repo
      
      • 修改位置如下图:

      1. 拷贝repo文件到/usr/bin/,便可以执行repo命令,在调试终端输出如下命令:
      rice@rice:~/xr806/$ sudo cp git-repo/repo /usr/bin/
      

      下载系统源码

      1. 创建目录,在调试终端输出如下命令:
      rice@rice:~/xr806$ mkdir code
      rice@rice:~/xr806$ cd code
      
      1. 通过repo,从gitee仓库中获取鸿蒙系统分支源码,在调试终端输出如下命令:
      rice@rice:~/xr806/code$ repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify
      rice@rice:~/xr806/code$ repo sync -c
      rice@rice:~/xr806/code$ repo forall -c 'git lfs pull'
      

      下载xr806源码

      1. 下载device源码,在调试终端输出如下命令:
      rice@rice:~/xr806/code$ cd device/
      rice@rice:~/xr806/code/device$ git clone https://gitee.com/moldy-potato-chips/devboard_device_allwinner_xr806.git
      rice@rice:~/xr806/code/device$ mv devboard_device_allwinner_xr806/ xradio
      
      1. 下载vendor源码,在调试终端输出如下命令:
      rice@rice:~/xr806/code/device$ cd ../
      rice@rice:~/xr806/code$ cd vendor/
      rice@rice:~/xr806/code/vendor$ git clone https://gitee.com/moldy-potato-chips/devboard_vendor_allwinner_xr806.git
      rice@rice:~/xr806/code/vendor$ mv devboard_vendor_allwinner_xr806/ xradio
      

      交叉编译工具

      1. 下载交叉编译工具,在调试终端输出如下命令:
      rice@rice:~/xr806$ mkdir tool
      rice@rice:~/xr806$ cd tool
      rice@rice:~/xr806/tool$ wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
      rice@rice:~/xr806/tool$ tar -jxvf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
      

      下载Open鸿蒙的适配好的docker

      1. 下载docker,在调试终端输出如下命令:
      rice@rice:~/xr806$ docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
      
      1. 进入docker,在调试终端输出如下命令:
      rice@rice:~/xr806$ sudo docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.5
      

      修改交叉编译工具

      1. 修改device/xradio/xr806/liteos_m/config.gni中的board_toolchain_prefix为实际环境下的gcc路径(/home/openharmony/tool/gcc-arm-none-eabi-10-2020-q4-major/bin)。操作如下:
      root@c2aa13139a52:/home/openharmony# cd code/device/xradio/xr806/liteos_m
      root@c2aa13139a52:/home/openharmony/code/device/xradio/xr806/liteos_m# vim config.gni
      

      1. 修改device/xradio/xr806/xr_skylark/gcc.mk,操作如下:
      root@c2aa13139a52:/home/openharmony# cd code/device/xradio/xr806/xr_skylark
      

      SDK配置

      1. 在修改完交叉编译工具路径后 ,在xr_skylark目录下执行,复制配置文件:
      root@c2aa13139a52:/home/openharmony/code/device/xradio/xr806/xr_skylark# make menuconfig
      
      1. 如果出现如下错误,输入如下命令:
      • 错误码:

      • 错误解决, 然后重新输入上面命令:
      root@c2aa13139a52:/home/openharmony/code/device/xradio/xr806/xr_skylark# apt-get install libncurses5-dev
      
      • 结果:

      1. 清除过程文件
      make build_clean
      
      1. 生成静态库已经自动生成头文件
      make lib -j
      
      1. 成功结果如图:

      系统源码编译

      1. 回到xr806系统源码目录:
      root@c2aa13139a52:/home/openharmony/code#  
      
      1. 输入hb set 选择skylark:

      1. 输入hb build -f 编译:

      1. 生成的镜像文件xr_system.img

      烧录代码

      1. 生成的镜像位于device/xradio/xr806/xr_skylark/out。将整个out的镜像拷贝到windows下。
      2. 拷贝烧录工具(phoenixMC)到windows,位置:device\xradio\xr806\xr_skylark\tools,并打开工具:
      • 第一步:选择镜像。
      • 第二部:选择对应的串口

      1. 修改烧录配置项,勾选“硬件复位烧写模式”:

      1. 点击升级固件,然后等待烧录到100%,便完成整个流程。

      运行效果

      1. 将板子接上串口软件,波特率选择115200,然后可以到对应的启动打印:

      <br/>关注微信公众号『Rice嵌入式开发技术分享』,后台回复“微信”添加作者微信,备注”入群“,便可邀请进入技术交流群。

      1 条回复 最后回复 回复 引用 分享 3
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策