NanoPi M1 Plus 移植 Openharmony 之建立自己的開(kāi)發(fā)倉(cāng)庫(kù)
原創(chuàng)??想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):??
??51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)??
??https://harmonyos.51cto.com??
1、前言
因?yàn)橹翱焖僖浦驳臅r(shí)候,除了boot.img用自己編譯的,其他img多用樹(shù)莓派3B的img就能正常點(diǎn)亮,所以為了能快速成功移植選用樹(shù)莓派3B作為參考。目前已經(jīng)可以編譯通過(guò),可以顯示畫(huà)面,并支持觸摸驅(qū)動(dòng),其他功能還很不完善。
2、 manifest base 的選擇
樹(shù)莓派3B的代碼下載可以參考以下官方鏈接:
樹(shù)莓派3B快速上手 OpenHarmony:https://gitee.com/openharmony-sig/devboard_vendor_rpi3b#預(yù)編譯固件
或者原作者xfan1024的Gitee 倉(cāng)庫(kù)
https://gitee.com/xfan1024/oh-rpi3b
也可參考朱偉老師的帖子
OpenHarmony3.0在樹(shù)莓派3B上的燒錄與通訊:https://harmonyos.51cto.com/posts/9379
樹(shù)莓派移植的主要倉(cāng)庫(kù)在:https://gitee.com/xfan1024/
我的編譯環(huán)境之前是參考朱偉老師的帖子下載的
repo init 指令如下:
repo init -u https://gitee.com/xfan1024/oh-rpi3b.git -m oh-rpi3b.xml -b
openharmony-3.0 --no-repo-verify
repo 參數(shù)說(shuō)明如下:
-u URL,指定manifest位置
-m 選擇倉(cāng)庫(kù)中的manifest文件,缺省為default.xml
-b 指定revision, 如一個(gè)特定的manifest分支.
從以上可以看出我用的樹(shù)莓派3B對(duì)應(yīng)的mainfest倉(cāng)庫(kù)為
https://gitee.com/xfan1024/oh-rpi3b.git
這個(gè)倉(cāng)庫(kù)的openharmony-3.0分支的oh-rpi3b.xml
如果參考o(jì)penharmony官方網(wǎng)站的則是
repo init -u https://gitee.com/openharmony-sig/manifest.git -m
devboard_rpi3b.xml -b master --no-repo-verify
對(duì)應(yīng)的mainfest倉(cāng)庫(kù)為
https://gitee.com/openharmony-sig/manifest.git
這個(gè)倉(cāng)庫(kù)的master 分支的devboard_rpi3b.xml文件
這兩個(gè)倉(cāng)庫(kù)版目前版本上差異不大只是vendor/rpi3這個(gè)倉(cāng)庫(kù)一個(gè)用sig下的一個(gè)是用xfan1024下的
3、參考樹(shù)莓派3B新增NanoPi M1 Plus 的倉(cāng)庫(kù)
3.1、克隆樹(shù)莓派3B倉(cāng)庫(kù)到自己的Gitee下
從oh-rpi3b.xml 中可以知道針對(duì)樹(shù)莓派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>
可以先將這幾個(gè)倉(cāng)庫(kù)從 https://gitee.com/xfan1024/ 克隆到自己的gitee下,我這邊新建了一個(gè)OHOS_nanopi_m1_plus組織,然后將以上6個(gè)倉(cāng)庫(kù)克隆過(guò)來(lái)。
OHOS_nanopi_m1_plus組織地址:https://gitee.com/ohos_nanopi_m1_plus
修改oh-rpi3b.xml中以下內(nèi)容:
將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”
相關(guān)修改如下
<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/或組織下建立一個(gè)manifest的倉(cāng)庫(kù),把這個(gè)文件上傳,將repo ini 指令中的url和manifest換成你自己的地址和文件,這樣子你就可以通過(guò)以下指令下載到可以編譯樹(shù)莓派3B的倉(cāng)庫(kù)。
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
首先我們列一個(gè)表格,填入信息如下
3.2.1、 建立NanoPi M1 Plus的 kernel 倉(cāng)庫(kù)
NanoPi M1 Plus的kernel 移植可以參考之前發(fā)的帖子 https://harmonyos.51cto.com/posts/9806
目前我移植使用的config是ohos_sunxi_defconfig可以比對(duì)sunxi_defconfig來(lái)查看差異部分,多開(kāi)的config如下
CONFIG_DRM_FBDEV_OVERALLOC=100#修改顯示問(wèn)題,具體原因還不清楚
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相關(guān)
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
移植后的倉(cāng)庫(kù)已上傳
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 的倉(cāng)庫(kù)替換好了。
3.2.2、 建立NanoPi M1 Plus的 vendor 倉(cāng)庫(kù)
Vendor 的倉(cāng)庫(kù)內(nèi)容暫時(shí)沒(méi)有做修改,但是為了后續(xù)修改方便,我拷貝了一份上傳到
https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-vendor
另外因?yàn)槲覀兌x的"產(chǎn)品制造商"是“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 倉(cāng)庫(kù)
device 目錄結(jié)構(gòu)是device\{SOC制造商}\{SOC名}
先拷貝一份device\rpi3為device\allwinner
修改如下
device\allwinner\build\ohos.build
{
"subsystem": "allwinner_products",
"parts": {
"allwinner_products": {
"module_list": [
"http://device/allwinner/build:products_group"
]
}
}
}
device\allwinner\build\BUILD.gn
import("http://build/ohos.gni")
device_type = "allwinnerh3"
group("products_group") {
if (device_type == "allwinnerh3") {
deps = [
"http://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("http://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",
"http://build/core/gn:images",
"http://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_”開(kāi)頭的內(nèi)容修改為“allwinnerh3_”
BUILD.gn還有修改的內(nèi)容參考如下
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 = "http://device/allwinner/allwinnerh3/hisi_lib/lib"
GPL_SDK_ETC_DIR = "http://device/allwinner/allwinnerh3/hisi_lib/etc"
另外將
device\allwinner\allwinnerh3\build\vendor\etc\fstab.rpi3
修改為fstab.allwinnerh3
并且device\allwinner\allwinnerh3\kernel\boot這個(gè)目錄替換為NanoPi M1 Plus的boot 分區(qū)
修改后的倉(cāng)庫(kù)上傳
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 倉(cāng)庫(kù)
之一部分主要修改如下
將projectpatch\patches\build\0001-build-support-rpi3.patch移除并在這個(gè)目錄下新增如下 0001-PATCH-Support-nanopim1plus.patch,這個(gè)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
復(fù)制修改后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倉(cāng)庫(kù)
toolchain 主要放編譯kernel的toolchain倉(cāng)庫(kù)路徑:https://gitee.com/ohos_nanopi_m1_plus/oh-nanopi-m1-plus-toolchain
oh-sd-fuse_h3 倉(cāng)庫(kù)路徑 https://gitee.com/ohos_nanopi_m1_plus/oh-sd-fuse_h3
4 NanoPi M1 Plus 項(xiàng)目編譯說(shuō)明
4.1 NanoPi M1 Plus 移植Openharmony項(xiàng)目源碼下載
mkdir ~/nanopim1plus
cd ~/nanopim1plus
mkdir openharmony
cd openharmony
通過(guò)repo獲取
方式一(推薦)
通過(guò)repo + ssh 下載(需注冊(cè)公鑰,請(qǐng)參考碼云幫助中心)。
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'
方式二
通過(guò)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 執(zhí)行prebuilts
在源碼根目錄下執(zhí)行腳本,安裝編譯器及二進(jìn)制工具。
bash build/prebuilts_download.sh
4.3 打入補(bǔ)丁解壓toolchain
在源碼根目錄下執(zhí)行
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 編譯指令
在源碼根目錄下執(zhí)行
export PATH="$PATH:$(pwd)/toolchain/4.9.3/bin"
export GCC_COLORS=auto
python3 build-nanopim1plus.py build
4.5 合成SD卡燒錄檔案
在源碼根目錄下執(zhí)行拷貝system.img、vendor.img 、userdata.img、boot.img的動(dòng)作,然后進(jìn)入device/allwinner/allwinnerh3/oh-sd-fuse_h3/執(zhí)行生成燒錄檔案。
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
會(huì)在device/allwinner/allwinnerh3/oh-sd-fuse_h3/out生成可以燒錄到SD 卡的h3-sd-friendlycore.img
以上NanoPi M1 Plus 移植 Openharmony 之建立自己的開(kāi)發(fā)倉(cāng)庫(kù)的分享!
??想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):??
??51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)??
??https://harmonyos.51cto.com??