NanoPi M1 Plus 移植 Openharmony 之建立自己的开发仓库 原创 精华

Soon_L
发布于 2022-2-6 21:12
浏览
3收藏

【本文正在参与优质创作者激励】

1、前言

因为之前快速移植的时候,除了boot.img用自己编译的,其他img多用树莓派3B的img就能正常点亮,所以为了能快速成功移植选用树莓派3B作为参考。目前已经可以编译通过,可以显示画面,并支持触摸驱动,其他功能还很不完善。

2、 manifest base 的选择

树莓派3B的代码下载可以参考以下官方链接:
树莓派3B快速上手 OpenHarmony:https://gitee.com/openharmony-sig/devboard_vendor_rpi3b#预编译固件

或者原作者xfan1024的Gitee 仓库
https://gitee.com/xfan1024/oh-rpi3b

也可参考朱伟老师的帖子
OpenHarmony3.0在树莓派3B上的烧录与通讯:https://harmonyos.51cto.com/posts/9379

树莓派移植的主要仓库在:https://gitee.com/xfan1024/

我的编译环境之前是参考朱伟老师的帖子下载的
repo init 指令如下:

repo init -u https://gitee.com/xfan1024/oh-rpi3b.git -m oh-rpi3b.xml -b openharmony-3.0 --no-repo-verify

repo 参数说明如下:
-u URL,指定manifest位置
-m 选择仓库中的manifest文件,缺省为default.xml
-b 指定revision, 如一个特定的manifest分支.

从以上可以看出我用的树莓派3B对应的mainfest仓库为
https://gitee.com/xfan1024/oh-rpi3b.git
这个仓库的openharmony-3.0分支的oh-rpi3b.xml

如果参考openharmony官方网站的则是

repo init -u https://gitee.com/openharmony-sig/manifest.git -m devboard_rpi3b.xml -b master --no-repo-verify

对应的mainfest仓库为
https://gitee.com/openharmony-sig/manifest.git
这个仓库的master 分支的devboard_rpi3b.xml文件

这两个仓库版目前版本上差异不大只是vendor/rpi3这个仓库一个用sig下的一个是用xfan1024下的

3、参考树莓派3B新增NanoPi M1 Plus 的仓库

3.1、克隆树莓派3B仓库到自己的Gitee下

从oh-rpi3b.xml 中可以知道针对树莓派3B的主要差异如下:

  <remote name="xfan1024" fetch="." review="https://gitee.com/xfan1024/"/>
  <project name="oh-rpi3b-device" path="device/rpi3" remote="xfan1024" revision="14fd2079bc9286d13ad6793149a71db8f35507c1" upstream="master" dest-branch="master">
    <linkfile src="rpi3/build-rpi3.py" dest="build-rpi3.py"/>
  </project>
  <project name="oh-rpi3b-vendor" path="vendor/rpi3" remote="xfan1024" revision="f6da250bb8cdd166f6ff2ddb061c60aa3aa70b09" upstream="master" dest-branch="master"/>
  <project name="oh-rpi3b-kernel" path="kernel/linux-rpi" remote="xfan1024" revision="801216065873b1ce418f7bc550415687af21f9b1" upstream="master" dest-branch="master"/>
  <project name="oh-rpi3b-projectpatch" path="projectpatch" remote="xfan1024" revision="fd9ab7480be43d80e2306a9fae8b38974223ee1a" upstream="master" dest-branch="master"/>
  <project name="oh-firmware-utils" path="third_party/firmware-utils" remote="xfan1024" revision="c2d594b731c1ebc3d16e5bd1fe96d10ff6790e41" upstream="master" dest-branch="master"/>
  <project name="oh-dropbear" path="third_party/dropbear" remote="xfan1024" revision="588cd36d3fbd1268c669d32a37e0599124ac7cad" upstream="master" dest-branch="master">
    <linkfile src="openharmony-develtools" dest="developtools/dropbear"/>
  </project>

可以先将这几个仓库从 https://gitee.com/xfan1024/ 克隆到自己的gitee下,我这边新建了一个OHOS_nanopi_m1_plus组织,然后将以上6个仓库克隆过来。
OHOS_nanopi_m1_plus组织地址:https://gitee.com/ohos_nanopi_m1_plus
修改oh-rpi3b.xml中以下内容:
将remote name=“xfan1024"替换为remote name=“ohos_nanopi_m1_plus”
将fetch=”." 替换fetch=“https://gitee.com/ohos_nanopi_m1_plus
将review=“https://gitee.com/xfan1024/"/替换为review="https://gitee.com/ohos_nanopi_m1_plus/
将全部的remote="xfan1024"替换为remote=“ohos_nanopi_m1_plus”
相关修改如下

  <remote name="ohos_nanopi_m1_plus" fetch="https://gitee.com/ohos_nanopi_m1_plus" review="https://gitee.com/ohos_nanopi_m1_plus/"/>
  <project name="oh-rpi3b-device" path="device/rpi3" remote="ohos_nanopi_m1_plus" revision="14fd2079bc9286d13ad6793149a71db8f35507c1" upstream="master" dest-branch="master">
    <linkfile src="rpi3/build-rpi3.py" dest="build-rpi3.py"/>
  </project>
  <project name="oh-rpi3b-vendor" path="vendor/rpi3" remote="ohos_nanopi_m1_plus" revision="f6da250bb8cdd166f6ff2ddb061c60aa3aa70b09" upstream="master" dest-branch="master"/>
  <project name="oh-rpi3b-kernel" path="kernel/linux-rpi" remote="ohos_nanopi_m1_plus" revision="801216065873b1ce418f7bc550415687af21f9b1" upstream="master" dest-branch="master"/>
  <project name="oh-rpi3b-projectpatch" path="projectpatch" remote="ohos_nanopi_m1_plus" revision="fd9ab7480be43d80e2306a9fae8b38974223ee1a" upstream="master" dest-branch="master"/>
  <project name="oh-firmware-utils" path="third_party/firmware-utils" remote="ohos_nanopi_m1_plus" revision="c2d594b731c1ebc3d16e5bd1fe96d10ff6790e41" upstream="master" dest-branch="master"/>
  <project name="oh-dropbear" path="third_party/dropbear" remote="ohos_nanopi_m1_plus" revision="588cd36d3fbd1268c669d32a37e0599124ac7cad" upstream="master" dest-branch="master">
    <linkfile src="openharmony-develtools" dest="developtools/dropbear"/>
  </project>

将修改后的完整oh-rpi3b.xml重命名为任意你想要的名字如devboard_nanopim1plus_tag.xml,并在自己的gitee/或组织下建立一个manifest的仓库,把这个文件上传,将repo ini 指令中的url和manifest换成你自己的地址和文件,这样子你就可以通过以下指令下载到可以编译树莓派3B的仓库。

repo init -u https://gitee.com/ohos_nanopi_m1_plus/manifest.git -m devboard_nanopim1plus_tag.xml -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

3.2、客制化NanoPi M1 Plus

首先我们列一个表格,填入信息如下

product device vendor socvendor
含义 嵌入式产品名 SOC名 产品制造商 SOC制造商
名字 nanopim1plus allwinnerh3 friendlyarm allwinner

3.2.1、 建立NanoPi M1 Plus的 kernel 仓库

NanoPi M1 Plus的kernel 移植可以参考之前发的帖子 https://harmonyos.51cto.com/posts/9806
目前我移植使用的config是ohos_sunxi_defconfig可以比对sunxi_defconfig来查看差异部分,多开的config如下

CONFIG_DRM_FBDEV_OVERALLOC=100#修改显示问题,具体原因还不清楚
CONFIG_HID_MULTITOUCH=y#修改支持触摸
CONFIG_HILOG=y#以下ohos 特性移植
CONFIG_HI_LOG_BUFFER_SIZE=2048
CONFIG_HIEVENT=y
CONFIG_DRIVERS_HDF=y
CONFIG_HDF_SUPPORT_LEVEL=2
CONFIG_DRIVERS_HDF_PLATFORM=y
CONFIG_DRIVERS_HDF_PLATFORM_MIPI_DSI=y
CONFIG_DRIVERS_HDF_PLATFORM_GPIO=y
CONFIG_DRIVERS_HDF_PLATFORM_I2C=y
CONFIG_DRIVERS_HDF_PLATFORM_UART=y
CONFIG_DRIVERS_HDF_TEST=y
CONFIG_AUDIT=y#以下SECURITY相关
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y
CONFIG_NETWORK_SECMARK=y
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
CONFIG_ANDROID_BINDER_IPC_32BIT=y
CONFIG_NFS_V4_SECURITY_LABEL=y
CONFIG_SECURITY=y
CONFIG_LSM_MMAP_MIN_ADDR=32768
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
CONFIG_INTEGRITY=y
CONFIG_INTEGRITY_AUDIT=y

移植后的仓库已上传
https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-kernel

上传好后将devboard_nanopim1plus_tagr.xml中

<project name="oh-rpi3b-vendor" path="vendor/rpi3" remote="xfan1024" revision="f6da250bb8cdd166f6ff2ddb061c60aa3aa70b09" upstream="master" dest-branch="master"/>

修改为

<project name="oh-nanopi-m1-plus-kernel" path="kernel/linux-nanopim1plus" remote="ohos_nanopi_m1_plus" revision="master" upstream="master" dest-branch="master"/>

这样子就将kernel 的仓库替换好了。

3.2.2、 建立NanoPi M1 Plus的 vendor 仓库

Vendor 的仓库内容暂时没有做修改,但是为了后续修改方便,我拷贝了一份上传到
https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-vendor
另外因为我们定义的"产品制造商"是“friendlyarm”所以要放到"vendor/friendlyarm"路径下,修改devboard_nanopim1plus_tagr.xml中

<project name="oh-rpi3b-vendor" path="vendor/rpi3" remote="xfan1024" revision="f6da250bb8cdd166f6ff2ddb061c60aa3aa70b09" upstream="master" dest-branch="master"/>

<project name="oh-nanopi-m1-plus-vendor" path="vendor/friendlyarm" remote="ohos_nanopi_m1_plus" revision="master" upstream="master" dest-branch="master"/>

3.2.3、 建立NanoPi M1 Plus的 device 仓库

device 目录结构是device\{SOC制造商}\{SOC名}
先拷贝一份device\rpi3为device\allwinner
修改如下
device\allwinner\build\ohos.build

{
    "subsystem": "allwinner_products",
    "parts": {
        "allwinner_products": {
            "module_list": [
                "//device/allwinner/build:products_group"
            ]
        }
    }
}

device\allwinner\build\BUILD.gn

import("//build/ohos.gni")
device_type = "allwinnerh3"
group("products_group") {
  if (device_type == "allwinnerh3") {
    deps = [
      "//device/allwinner/allwinnerh3:allwinnerh3_group",
    ]
  } 
}

将device\allwinner\rpi3改为device\allwinner\allwinnerh3,并
将目下make_rpi_sdcard_image.py修改为make_nanopim1plus_sdcard_image.py
将build-rpi3.py修改为device\allwinner\allwinnerh3\build-nanopim1plus.py并修改如下:

    cmd = 'bash build.sh --product-name nanopim1plus --ccache --build-target firmware'
        print('please run: python3 ./build-nanopim1plus.py build')
    print('    python3 ./build-nanopim1plus.py build')
    print('    python3 ./build-nanopim1plus.py flash /dev/sdx')

将device\allwinner\allwinnerh3\BUILD.gn修改为如下

import("//build/ohos.gni")

print("allwinnerh3_group in")
group("allwinnerh3_group") {
  deps = [
    "kernel:allwinnerh3_modules",
    "hisi_lib:hisi_lib",
    "build:allwinnerh3_prebuilts_files",
    "prebuilts:prebuilts",
  ]
}

action("firmware") {
  deps = [
    "kernel:allwinnerh3_bootimg",
    "//build/core/gn:images",
    "//third_party/firmware-utils:ptgen(${host_toolchain})"
  ]
  script = "make_nanopim1plus_sdcard_image.py"
  outputs = [ "$root_build_dir/packages/phone/images/firmware.img" ]
  args = [
    "--output",
    rebase_path("$root_build_dir/packages/phone/images/firmware.img"),
    #"--userdata",
    #"300M",
    rebase_path("$root_build_dir/packages/phone/images/boot.img"),
    rebase_path("$root_build_dir/packages/phone/images/system.img"),
    rebase_path("$root_build_dir/packages/phone/images/vendor.img"),
    rebase_path("$root_build_dir/packages/phone/images/userdata.img"),
  ]
}

device\allwinner\allwinnerh3\kernel\build_kernel.py

os.environ['CROSS_COMPILE'] = 'arm-linux-'
defconfig = 'ohos_sunxi_defconfig'
kernel_dir = os.path.abspath('../../kernel/linux-nanopim1plus')
    subprocess.run(F'touch .scmversion', shell=True, check=True)
    subprocess.run(F'make {defconfig} ARCH=arm CROSS_COMPILE=arm-linux-', shell=True, check=True)
    subprocess.run(F'make -j{nproc+1} zImage dtbs ARCH=arm CROSS_COMPILE=arm-linux-', shell=True, check=True)
    #for ko in kolist:
    #    shutil.copy(os.path.join(kernel_dir, ko), modules_dir)
    #overlays_dir = 'boot/overlays'
    #os.mkdir(overlays_dir)
        os.path.join(kernel_dir, 'arch/arm/boot/dts/sun8i-h3-nanopi-m1-plus.dtb'),
    #shutil.copy(
    #    os.path.join(kernel_dir, 'arch/arm/boot/dts/overlays/vc4-kms-v3d.dtbo'),
    #    overlays_dir
    #)

接着将所有子目录下的BUILD.gn中rpi3_products改为allwinner_products在将其他的“rpi3_”开头的内容修改为“allwinnerh3_”
BUILD.gn还有修改的内容参考如下
device\allwinner\allwinnerh3\kernel\BUILD.gn

group("allwinnerh3_modules") {
    print("allwinnerh3_modules in")
#    deps = allwinnerh3_modules_deps
}

device\allwinner\allwinnerh3\hisi_lib\BUILD.gn

GPL_SDK_LIB_DIR = "//device/allwinner/allwinnerh3/hisi_lib/lib"
GPL_SDK_ETC_DIR = "//device/allwinner/allwinnerh3/hisi_lib/etc"

另外将
device\allwinner\allwinnerh3\build\vendor\etc\fstab.rpi3
修改为fstab.allwinnerh3

并且device\allwinner\allwinnerh3\kernel\boot这个目录替换为NanoPi M1 Plus的boot 分区

修改后的仓库上传
https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-device

最后修改
上传好后将devboard_nanopim1plus_tagr.xml中

  <project name="oh-rpi3b-device" path="device/rpi3" remote="xfan1024" revision="14fd2079bc9286d13ad6793149a71db8f35507c1" upstream="master" dest-branch="master">
    <linkfile src="rpi3/build-rpi3.py" dest="build-rpi3.py"/>
  </project>

修改为

  <project name="oh-nanopi-m1-plus-device" path="device/allwinner" remote="ohos_nanopi_m1_plus" revision="master" upstream="master" dest-branch="master">
    <linkfile src="allwinnerh3/build-nanopim1plus.py" dest="build-nanopim1plus.py"/>
  </project>

3.2.4、 建立NanoPi M1 Plus的 projectpatch 仓库

之一部分主要修改如下
将projectpatch\patches\build\0001-build-support-rpi3.patch移除并在这个目录下新增如下 0001-PATCH-Support-nanopim1plus.patch,这个patch可以修改后commit再用git format-patch
0001-PATCH-Support-nanopim1plus.patch

From a131f7d235ca7cf8acd0506a654bf02fa3294e03 Mon Sep 17 00:00:00 2001
From: soon_l <lxs_vip@126.com>
Date: Tue, 11 Jan 2022 23:37:38 +0800
Subject: [PATCH] [PATCH] Support nanopim1plus

:Release Notes:
[PATCH] Support nanopim1plus
:Detailed Notes:
- Problem : [PATCH] Support nanopim1plus
- RootCause : [PATCH] Support nanopim1plus
- Solution : [PATCH] Support nanopim1plus
- Author : Soon_L
- Build : ok

:Testing Preformed:
How to Test :
build

Change-Id: I2f09e00e8c5ee27da4b7422fc5bfd0878d10af5d
---
 subsystem_config.json | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/subsystem_config.json b/subsystem_config.json
index 4288f49..21447e3 100644
--- a/subsystem_config.json
+++ b/subsystem_config.json
@@ -11,6 +11,12 @@
     "name": "account",
     "dir": "base"
   },
+  "allwinner_products":{
+    "project": "hmf/allwinner_products",
+    "path": "device/allwinner/build",
+    "name": "allwinner_products",
+    "dir": "device/allwinner"
+   },
   "distributeddatamgr": {
     "project": "hmf/distributeddatamgr",
     "path": "foundation/distributeddatamgr",
-- 
2.25.1

修改projectpatch\patches\drivers_peripheral\0001-support-rpi3.patch

+    if ((device_type == "Hi3516DV300") || (device_type == "DAYU") || (device_type == "ohos-arm64") || (device_type == "rpi3")) {

改为

+    if ((device_type == "Hi3516DV300") || (device_type == "DAYU") || (device_type == "ohos-arm64") || (device_type == "nanopim1plus")) {

projectpatch\patches\productdefine_common下删除0001-support-rpi3.patch,新增
0001-PATCH-Support-nanopim1plus.patch

From a944c7ee0608aa0255b535668e59338ca5f07f06 Mon Sep 17 00:00:00 2001
From: soon_l <lxs_vip@126.com>
Date: Sun, 16 Jan 2022 21:58:57 +0800
Subject: [PATCH] [PATCH] [PATCH] Support nanopim1plus

:Release Notes:

:Detailed Notes:
- Problem : Support nanopim1plus
- RootCause : Support nanopim1plus
- Solution : Support nanopim1plus
- Author : Soon_L
- Build : ok

:Testing Preformed:
How to Test :
build

Change-Id: Ic2aabbb2b0bff96ad7447225b8f9d82398040319
---
 device/allwinnerh3.json    |  7 ++++
 products/nanopim1plus.json | 81 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100755 device/allwinnerh3.json
 create mode 100755 products/nanopim1plus.json

diff --git a/device/allwinnerh3.json b/device/allwinnerh3.json
new file mode 100755
index 0000000..68dcf27
--- /dev/null
+++ b/device/allwinnerh3.json
@@ -0,0 +1,7 @@
+{
+    "device_name": "allwinnerh3",
+    "device_company": "allwinner",
+    "target_os": "ohos",
+    "target_cpu": "arm",
+    "kernel_version": ""
+}
diff --git a/products/nanopim1plus.json b/products/nanopim1plus.json
new file mode 100755
index 0000000..0f142c1
--- /dev/null
+++ b/products/nanopim1plus.json
@@ -0,0 +1,81 @@
+{
+  "product_name": "nanopim1plus",
+  "product_company": "friendlyarm",
+  "product_device": "allwinnerh3",
+  "version": "2.0",
+  "type": "standard",
+  "parts":{
+    "ace:ace_engine_standard":{},
+    "ace:napi":{},
+    "account:os_account_standard":{},
+    "distributeddatamgr:native_appdatamgr":{},
+    "distributeddatamgr:distributeddatamgr":{},
+    "distributeddatamgr:appdatamgr_jskits":{},
+    "distributeddatamgr:distributedfilejs":{},
+    "distributeddatamgr:e2fsprogs":{},
+    "common:common":{},
+    "security:permission_standard":{},
+    "startup:startup_l2":{},
+    "startup:init":{},
+    "hiviewdfx:hiviewdfx_hilog_native":{},
+    "hiviewdfx:hilog_native":{},
+    "hiviewdfx:hilog_service":{},
+    "hiviewdfx:hisysevent_native":{},
+    "hiviewdfx:hiappevent_js":{},
+    "hiviewdfx:hiview":{},
+    "hiviewdfx:faultloggerd":{},
+    "utils:utils_base":{},
+    "subsystem_examples:subsystem_examples":{},
+    "allwinner_products:allwinner_products":{},
+    "appexecfwk:appexecfwk_standard":{},
+    "aafwk:aafwk_standard":{},
+    "notification:ces_standard":{},
+    "notification:ans_standard":{},
+    "communication:ipc":{},
+    "communication:net_manager":{},
+    "communication:dsoftbus_standard":{},
+    "communication:wifi_standard":{},
+    "communication:wifi_native_js":{},
+    "communication:bluetooth_native_js":{},
+    "distributedschedule:samgr_L2":{},
+    "distributedschedule:safwk":{},
+    "distributedschedule:dmsfwk_standard":{},
+    "hdf:hdf":{},
+    "updater:updater":{},
+    "developtools:bytrace_standard":{},
+    "developtools:dropbear":{},
+    "developtools:profiler":{},
+    "sensors:sensors_miscdevice":{},
+    "graphic:graphic_standard":{},
+    "security:appverify":{},
+    "security:huks_standard":{},
+    "security:deviceauth_standard":{},
+    "security:dataclassification":{},
+    "sensors:sensors_sensor":{},
+    "miscservices:time_native":{},
+    "multimedia:multimedia_histreamer":{},
+    "multimedia:multimedia_media_standard":{},
+    "multimedia:multimedia_audio_standard":{},
+    "multimedia:multimedia_camera_standard":{},
+    "multimedia:multimedia_image_standard":{},
+    "multimedia:multimedia_media_library_standard":{},
+    "multimodalinput:multimodalinput_base":{},
+    "telephony:core_service":{},
+    "telephony:ril_adapter":{},
+    "telephony:data_storage":{},
+    "telephony:state_registry":{},
+    "telephony:cellular_call":{},
+    "telephony:cellular_data":{},
+    "telephony:sms_mms":{},
+    "telephony:call_manager":{},
+    "global:i18n_standard":{},
+    "global:resmgr_standard":{},
+    "powermgr:power_manager_native":{},
+    "powermgr:battery_manager_native":{},
+    "powermgr:display_manager_native":{},
+    "applications:prebuilt_hap":{},
+    "wpa_supplicant-2.9:wpa_supplicant-2.9":{},
+    "xts:phone_tests":{},
+    "distributedhardware:device_manager_base":{}
+  }
+}
-- 
2.25.1

修改后projectpatch上传
https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-projectpatch

上传好后将devboard_nanopim1plus_tagr.xml中

  <project name="oh-rpi3b-projectpatch" path="projectpatch" remote="xfan1024" revision="fd9ab7480be43d80e2306a9fae8b38974223ee1a" upstream="master" dest-branch="master"/>

修改为

  <project name="oh-nanopi-m1-plus-projectpatch" path="projectpatch" remote="ohos_nanopi_m1_plus" revision="master" upstream="master" dest-branch="master"/>

3.2.4、 建立NanoPi M1 Plus的 toolchain 和 oh-sd-fuse_h3仓库

toolchain 主要放编译kernel的toolchain仓库路径:https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-toolchain
oh-sd-fuse_h3 仓库路径 https://gitee.com/ohos_nanopi_m1_plus/oh-sd-fuse_h3

4 NanoPi M1 Plus 项目编译说明

4.1 NanoPi M1 Plus 移植Openharmony项目源码下载

mkdir ~/nanopim1plus
cd ~/nanopim1plus
mkdir openharmony
cd openharmony

通过repo获取
方式一(推荐)
通过repo + ssh 下载(需注册公钥,请参考码云帮助中心)。

repo init -u git@gitee.com:ohos_nanopi_m1_plus/manifest.git -m devboard_nanopim1plus_tag.xml -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

方式二

通过repo + https 下载。

repo init -u https://gitee.com/ohos_nanopi_m1_plus/manifest.git -m devboard_nanopim1plus_tag.xml -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

4.2 执行prebuilts

在源码根目录下执行脚本,安装编译器及二进制工具。

bash build/prebuilts_download.sh

4.3 打入补丁解压toolchain

在源码根目录下执行

python3 projectpatch/patch.py
cp ohos/drivers/peripheral/camera/hal/adapter/chipset/gni/camera.rpi3.gni ohos/drivers/peripheral/camera/hal/adapter/chipset/gni/camera.nanopim1plus.gni
tar xvf toolchain/arm-cortexa9-linux-gnueabihf-4.9.3-20160512.tar.xz -C toolchain/

4.4 编译指令

在源码根目录下执行

export PATH="$PATH:$(pwd)/toolchain/4.9.3/bin"
export GCC_COLORS=auto
python3 build-nanopim1plus.py build

4.5 合成SD卡烧录档案

在源码根目录下执行拷贝system.img、vendor.img 、userdata.img、boot.img的动作,然后进入device/allwinner/allwinnerh3/oh-sd-fuse_h3/执行生成烧录档案。

cp -f out/ohos-arm-release/packages/phone/images/system.img device/allwinner/allwinnerh3/oh-sd-fuse_h3/friendlycore-focal_4.14_armhf/
cp -f out/ohos-arm-release/packages/phone/images/vendor.img device/allwinner/allwinnerh3/oh-sd-fuse_h3/friendlycore-focal_4.14_armhf/
cp -f out/ohos-arm-release/packages/phone/images/userdata.img device/allwinner/allwinnerh3/oh-sd-fuse_h3/friendlycore-focal_4.14_armhf/
cp -f out/ohos-arm-release/packages/phone/images/boot.img device/allwinner/allwinnerh3/oh-sd-fuse_h3/friendlycore-focal_4.14_armhf/
cd device/allwinner/allwinnerh3/oh-sd-fuse_h3/
sudo ./device/allwinner/allwinnerh3/oh-sd-fuse_h3/mk-sd-image.sh friendlycore-focal_4.14_armhf h3-sd-friendlycore.img

会在device/allwinner/allwinnerh3/oh-sd-fuse_h3/out生成可以烧录到SD 卡的h3-sd-friendlycore.img

以上NanoPi M1 Plus 移植 Openharmony 之建立自己的开发仓库的分享,祝大家新春愉快!

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
已于2022-2-8 09:11:21修改
6
收藏 3
回复
举报
2条回复
按时间正序
/
按时间倒序
红叶亦知秋
红叶亦知秋

楼主新年码字辛苦啦!

1
回复
2022-2-7 10:15:05
Soon_L
Soon_L 回复了 红叶亦知秋
楼主新年码字辛苦啦!

感谢支持~~~~~~

回复
2022-2-7 12:35:23
回复
    相关推荐