This action will force synchronization from OpenHarmony/build_lite, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
The compilation and building subsystem is a build framework based on Generate Ninja (GN) and Ninja, which supports component-based OpenHarmony development. This subsystem can be used to:
Build products.
Build chipset vendor components independently.
Build a single component independently.
It is considered best practice to learn the following basic concepts before you start development and build:
Component
A component is a reusable software unit that can contain source code, configuration files, resource files, and build scripts.
GN
GN is short for Generate Ninja, which is a build system used to generate Ninja files.
Ninja
Ninja is a small high-speed build system.
Build Process
The following figure shows the build process.
build/lite # Primary directory
├── components # Component description file
├── hb # hb pip installation package
├── make_rootfs # make script for the file system
├── config # Build configuration items
│ ├── component # Definitions of component-related templates, including static libraries, dynamic libraries, extension components, and emulator libraries
│ ├── kernel # Build configuration parameters of the kernel
│ └── subsystem # Subsystem template
├── ndk # NDK-related build scripts and configuration parameters
└── toolchain # Build toolchain, which contain the compiler directories, build options, and linking options
Prerequisites
Installing hb
Run the following command in the root directory of the source code:
python3 -m pip install --user build/lite
Run the hb -h command. If the following information is displayed, the installation is successful:
usage: hb
OHOS build system
positional arguments:
{build,set,env,clean}
build Build source code
set OHOS build settings
env Show OHOS build env
clean Clean output
optional arguments:
-h, --help Show this help message and exit
Uninstalling hb
Run the following command to uninstall hb:
python3 -m pip uninstall ohos-build
Build Commands
hb set
hb set -h
usage: hb set [-h] [-root [ROOT_PATH]] [-p]
optional arguments:
-h, --help Show this help message and exit.
-root [ROOT_PATH], --root_path [ROOT_PATH]
Set OHOS root path.
-p, --product Set OHOS board and kernel.
hb env
View the current configuration.
hb env
[OHOS INFO] root path: xxx
[OHOS INFO] board: hispark_taurus
[OHOS INFO] kernel: liteos
[OHOS INFO] product: ipcamera
[OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera
[OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19
hb build
hb build -h
usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]]
[--dmverity] [-p PRODUCT] [-f] [-n]
[component [component ...]]
positional arguments:
component Name of the component.
optional arguments:
-h, --help Show this help message and exit.
-b BUILD_TYPE, --build_type BUILD_TYPE
Release or debug version.
-c COMPILER, --compiler COMPILER
Specify compiler.
-t [TEST [TEST ...]], --test [TEST [TEST ...]]
Compile test suit.
--dmverity Enable dmverity.
-p PRODUCT, --product PRODUCT
Build a specified product with
{product_name}@{company}, eg: ipcamera@hisilcon.
-f, --full Full code compilation.
-T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]]
Compile single target
hb clean
Clear the build result of the product in the out directory, and leave the args.gn and build.log files only. To clear files in a specified directory, add the directory parameter to the command, for example, hb clean xxx/out/xxx.
hb clean
usage: hb clean [-h] [out_path]
positional arguments:
out_path Clean a specified path.
optional arguments:
-h, --help Show this help message and exit.
Compilation and building subsystem
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。