开源鸿蒙(OpenHarmonyOS)代码下载及编译

发布时间 2023-06-13 10:36:01作者: Justin_Hu

开源鸿蒙的代码仓在码云上,可以通过以下命令下载源码并编译

  • 本机安装虚拟机

如本地已经安装可以忽略此步

安装指导:https://thoughts.teambition.com/share/614c499bc9174900411c637b#title=OpenHarmony

  • 主干代码获取

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

repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c "git lfs pull"

方式二:通过repo + https下载。

repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
  • 强制同步代码
repo sync --force-sync
  • 代码编译
./build/prebuilts_download.sh --no-check-certificatie -skip-ssl(首次编译需要执行,预编译)
./build.sh --product-name rk3568 --ccache
  • 用例编译
./build.sh --product-name rk3568 --build-target 用例名称

例如:

./build.sh --product-name rk3568 --build-target InputManagerTest