本文介紹了如何下載開源鴻蒙(OpenHarmony)操作系統(tǒng) 4.1 Release版本的源代碼,該方法同樣可以用于下載OpenHarmony最新開發(fā)版本(master分支)或者4.0 Release、3.2 Release等發(fā)布版本的源代碼。
本文基于Ubuntu 22.04操作,主要考慮到官方推薦使用Ubuntu發(fā)行版進(jìn)行OpenHarmony源碼編譯構(gòu)建。使用Ubuntu 20.04也可以,更老的版本就不推薦了;因?yàn)閁buntu偶數(shù)年份的04版本是LTS版,官方維護(hù)時(shí)間通常是5年。
3月底(2024年3月30日晚),OpenHarmony發(fā)布了最新穩(wěn)定版本——OpenHarmony 4.1 Realse,官方代碼倉(cāng)的公告內(nèi)容如下(詳細(xì)內(nèi)容可以看鏈接):
社區(qū)已于2024-03-30發(fā)布OpenHarmony-v4.1-Release版本, 詳情請(qǐng)參考https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v4.1-release.md
一、準(zhǔn)備命令工具
本節(jié)介紹如何準(zhǔn)備命令行工具,具體包括git/repo/python。
OpenHarmony代碼托管在碼云服務(wù)器上,下載單個(gè)代碼倉(cāng)通常使用git命令行工具,下載所有代碼倉(cāng)需要使用repo命令行工具。repo命令行工具是由Python開發(fā)的,因此開始之前,需要線安裝git/git-lfs/python等命令行工具。
安裝git/git-lfs/python/curl,執(zhí)行如下命令:
sudo apt install git git-lfs python3-pip curl
安裝repo命令,執(zhí)行如下命令:
# 創(chuàng)建目錄
mkdir ~/bin
# 下載repo腳本
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > ~/bin/repo
# 下載repo依賴的軟件包
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
二、配置用戶信息
本節(jié)介紹如何配置本地git用戶名和郵箱,以及如何配置碼云SSH公鑰(使用ssh協(xié)議下載必須配置):
- 注冊(cè)碼云gitee帳號(hào)。
- 注冊(cè)碼云SSH公鑰,請(qǐng)參考[碼云幫助中心]。
- 配置git用戶信息,執(zhí)行如下命令:
git config --global user.name "yourname" git config --global user.email "your-email-address" git config --global credential.helper store
- 創(chuàng)建目錄,用于存放OpenHarmony源碼,執(zhí)行如下命令:
mkdir -p ~/ohos/openharmony cd ~/ohos/openharmony
三、下載OpenHarmony源碼
3.1 使用ssh協(xié)議下載(推薦)
通過(guò)repo + ssh 下載(需注冊(cè)公鑰,請(qǐng)參考[碼云幫助中心])。
- 從版本分支獲取源碼。可獲取該版本分支的最新源碼,包括版本發(fā)布后在該分支的合入。
repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-4.1-Release --no-repo-verify repo sync -c repo forall -c 'git lfs pull'
- 從版本發(fā)布Tag節(jié)點(diǎn)獲取源碼。可獲取與版本發(fā)布時(shí)完全一致的源碼。
repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v4.1-Release --no-repo-verify repo sync -c repo forall -c 'git lfs pull'
3.2 使用https協(xié)議下載
通過(guò)repo + https 下載。
- 從版本分支獲取源碼。可獲取該版本分支的最新源碼,包括版本發(fā)布后在該分支的合入。
repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-4.0-Release --no-repo-verify repo sync -c repo forall -c 'git lfs pull'
- 從版本發(fā)布Tag節(jié)點(diǎn)獲取源碼。可獲取與版本發(fā)布時(shí)完全一致的源碼。
repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v4.0-Release --no-repo-verify repo sync -c repo forall -c 'git lfs pull'
四、下載編譯工具鏈
代碼下載完成后,還需要執(zhí)行prebuilts_download.sh腳本,下載編譯工具鏈,執(zhí)行如下命令:
bash build/prebuilts_download.sh
這個(gè)腳本會(huì)創(chuàng)建prebuilts目錄,并將邊回憶工具鏈下載、解壓到這個(gè)目錄下。
以上全部完成后,磁盤空間占用52G:
五、參考鏈接
本文主要參考了OpenHarmony文檔倉(cāng),里面由其他版本的發(fā)布說(shuō)明(Release Note),根據(jù)其他版本的發(fā)布說(shuō)明,也可以下載其他版本的源代碼。
- [https://gitee.com/openharmony/docs/tree/master/zh-cn/release-notes]
- [https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v4.1-release.md]
審核編輯 黃宇
-
開源
+關(guān)注
關(guān)注
3文章
3502瀏覽量
43130 -
源代碼
+關(guān)注
關(guān)注
96文章
2948瀏覽量
67385 -
Git
+關(guān)注
關(guān)注
0文章
203瀏覽量
15952 -
鴻蒙
+關(guān)注
關(guān)注
57文章
2459瀏覽量
43506 -
OpenHarmony
+關(guān)注
關(guān)注
25文章
3787瀏覽量
17502
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
【貝啟科技BQ3568HM開源鴻蒙開發(fā)板深度試用報(bào)告】系統(tǒng)鏡像編譯和燒錄
基于 OpenHarmony,國(guó)內(nèi)首個(gè)輕鴻蒙手表 OS 發(fā)行版出爐
openharmony是什么 OpenHarmony開源代碼在哪下載
openharmony代碼質(zhì)量如何 openharmony源代碼下載地址
鴻蒙操作系統(tǒng)開源代碼
華為openharmony鴻蒙 2.0
openharmony 開源 openharmony l2代碼開源
openharmony分支代碼開源
華為開發(fā)者分論壇HarmonyOS學(xué)生公開課-如何提交到開源鴻蒙OpenHarmony代碼倉(cāng)

OpenAtom OpenHarmony 4.1 Release版本正式發(fā)布
已適配開源鴻蒙OpenHarmony 4.1,Purple Pi OH開發(fā)板與時(shí)俱進(jìn)

如何在開源鴻蒙OpenHarmony開啟SELinux模式?RK3566鴻蒙開發(fā)板演示

開源鴻蒙操作系統(tǒng)5.0 Release版本發(fā)布
鴻蒙北向開發(fā)OpenHarmony4.1 DevEco Studio開發(fā)工具安裝與配置

OpenHarmony4.1系統(tǒng)WiFi藍(lán)牙打不開時(shí),教你如何排查解決問(wèn)題

評(píng)論