Building Oniro

Before beginning, ensure that git-lfs and repo are installed. It is recommended to have at least 100GB of free disk space available for the full build.

Obtaining the Source Code

To download the source code, execute the following commands in your terminal:

repo init -u https://github.com/eclipse-oniro4openharmony/manifest.git -b OpenHarmony-3.2-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

Fetching Prebuilt Tools

Once you have the source code run the following script to fetch the prebuilt tools:

./build/prebuilts_download.sh

Setting Up the Build Environment

For building the project, using an isolated Docker container is recommended for a clean and controlled build environment. Run the following command to start the Docker container:

docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0

Configuring and Starting the Build

Inside the Docker instance, set the target device for the build (e.g. rk3568):

hb set

Finally, initiate the build process with:

hb build

Flashing the HiHope HH-SCDAYU200 Development Kit

To begin, connect the board to your computer as outlined in the HiHope DAYU200 documentation. Use the USB-C and mini-USB cables included in the kit to connect to the USB 3.0 OTG port and the mini-USB DEBUG port, respectively.

Power on the device by attaching the power cable. Upon successful connection, your serial console should display output similar to:

Bus 002 Device 009: ID 2207:5000 Fuzhou Rockchip Electronics Company "HDC Device"
...
Bus 001 Device 069: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

Download the flash.py flashing tool from Gitee using the following commands:

git clone https://gitee.com/hihope_iot/docs.git hihope_iot_docs
mkdir flash && cp -r hihope_iot_docs/HiHope_DAYU200/烧写工具及指南/linux/* flash/
chmod +x flash/flash.py flash/bin/flash.x86_64

To ensure proper device recognition, install the udev rule:

sudo cp flash/etc/udev/rules.d/85-rk3568.rules /etc/udev/rules.d/85-rk3568.rules

Then, either reload udev rules or reboot your system:

udevadm control --reload-rules

After this setup, running flash/flash.py -q should produce the following output, indicating readiness:

maskrom

To enable programming mode on the device, perform the following steps:

  1. Press nad hold VOL/RECOVERY then RESET buttons.
  2. Release RESET button.

Confirm the mode by running lsusb, which should show:

...
Bus 001 Device 070: ID 2207:350a Fuzhou Rockchip Electronics Company USB download gadget
...

$ flash/flash.py -q
loader

Once the above steps are completed successfully, you can proceed to flash the board:

flash/flash.py -a -i ./out/rk3568/packages/phone/images

Additional Tips and Troubleshooting

Connecting to serial console

To read the serial output, ensure the board is correctly connected and powered on. The default baud rate for the HH-SCDAYU200 board is 1500000. You can use minicom or a similar serial terminal:

minicom -D /dev/ttyUSB0 -b 1500000

No HDC available in the system

If the hdc tool is not available on your host system, build it using the ohos-sdk:

./build.sh --product-name ohos-sdk --ccache

Find the hdc tool in out/sdk/ohos-sdk/linux/toolchains. To verify the connection with the device, run:

$ hdc list targets
150100424a544434520325874bb44900

For sending commands to the device:

hdc shell

To read hilog output:

hdc hilog