openharmony-v4.0
1.为什么用build.sh
之前之前一直用hb编译openharmony。hb的版本与openharmony版本是绑定的。这种绑定很不方便。例如,我需要编译两个版本的openharmony(V3.2和V4.0)。需要来回切换hb的版本才能正常编译。听说用build,sh可以解决这个问题。因此,打算探索一下。
2.探索过程
openharmony根目录下执行:
++++++++++++++++++++++++++++++++++++++++
The system shell is bash 5.0.17(1)-release
++++++++++++++++++++++++++++++++++++++++
2024-02-18 19:10:11
Please execute the build/prebuilts_download.sh
根据提示操作。
~/ohos/openharmony-v4.0-release/build$ ./prebuilts_download
此时会自动安装一堆软件,等待结束。
......
WARNING: You are using pip version 21.2.4; however, version 23.0.1 is available.
You should consider upgrading via the '/home/xendless/ohos/openharmony-v4.0-release/prebuilts/python/linux-x86/3.10.2/bin/python3.10 -m pip install --upgrade pip' command.
======copy inside cxx finished!======
======update llvm ndk finished!======
======change rustlib name finished!======
Created /home/xendless/ohos/openharmony-v4.0-release/prebuilts/clang/ohos/linux-x86_64/llvm/bin/lldb-mi
Created /home/xendless/ohos/openharmony-v4.0-release/prebuilts/clang/ohos/windows-x86_64/llvm/bin/lldb-mi.exe
执行build.sh,openharmony-v4.0直接编译代码了,并没有输出./build.sh可以配置的参数。
./build.sh -h
查看build.sh文件也没有找到对应的代码,在openharmony-v3.2中有相关代码。
function help() {
echo
echo "Usage:"
echo " ./build.sh --product-name {product-name} [options]"
echo
echo "Examples:"
echo " ./build.sh --product-name rk3568 --ccache"
echo
echo "options"
echo " --ccache use ccache, default: false"
echo " --jobs N run N jobs in parallel"
echo " --build-target build target name"
echo " --gn-args specifies gn build arguments, eg: --gn-args=\"foo=\"bar\" enable=true blah=7\""
echo " --export-para export env"
echo " --help, -h print help info"
echo " --source-root-dir source root directory"
echo " --product-name build product name"
echo " --device-name build device name"
echo " --target-cpu select cpu"
echo " --target-os target os"
echo " --compile-config compile config"
echo " --ninja args ninja args"
echo " --verbose, -v show all command lines while building"
echo " --keep-ninja-going keeps ninja going until 1000000 jobs fail"
echo " --sparse-image sparse image, default: true"
echo " --build-only-gn only do gn parse, do not run ninja"
echo " --fast-rebuild it will skip prepare, preloader, gn_gen steps so we can enable it only"
echo " --log-level specifies the log level during compilation, three levels are optional: debug, info and error, default: info"
echo " --device-type specifies device type"
echo " --build-variant specifies device operating mode"
echo " --share-ccache it is customized path to place ccache, which allow one ccache shared with many project"
echo " --disable-post-build it will skip post build process, you can enable it if you do not need post build. Post build include post_build.patch_ohos_para,
post_build.package_image(), stat_ccache(), generate_ninja_trace(start_time), get_warning_list(), compute_overlap_rate()"
echo " --disable-package-image it will skip compress image process, you can enable it if you do not need compress image"
exit 1
}
初次探索失败,后续继续……