diff --git a/documentation/source/quick-start/build-open-harmony.rst b/documentation/source/quick-start/build-open-harmony.rst index f6cf0d20620a945eb1436068ed6a66f588e6cd8c..5f07b48539b3ea3b00a1c0ca76aa5731a3ee5789 100644 --- a/documentation/source/quick-start/build-open-harmony.rst +++ b/documentation/source/quick-start/build-open-harmony.rst @@ -12,6 +12,8 @@ OpenHarmony is a distributed OS that is designed to run on top of variety of OS :align: center :alt: meta-ohos overview +Building and Running OpenHarmony image +************************************************ **Prerequisites** To start working with **meta-ohos** first install git repo: @@ -22,10 +24,9 @@ To start working with **meta-ohos** first install git repo: $ sudo apt-get update $ sudo apt-get install git-repo -Building and Running OpenHarmony image -************************************************ +**Procedure** -1. Once git repo has been installed, clone the necessary repositories using the following commands: +Once git repo has been installed, clone the necessary repositories using the following commands: .. code-block:: console @@ -33,9 +34,9 @@ Building and Running OpenHarmony image $ repo init -u https://git.ostc-eu.org/OSTC/manifest.git $ repo sync - Above commands creates the following directory structure: +Above commands creates the following directory structure: - .. code-block:: console + .. code-block:: console ./ohos/ └── sources @@ -43,128 +44,156 @@ Building and Running OpenHarmony image ├── meta-ohos ├── meta-openembedded ├── meta-zephyr + ├── <various yocto layers> └── poky -2. Build OHOS flavour of your choice. Currently OpenHarmony supports Linux, Zephyr, and FreeRTOS. +OpenHarmony can be hosted on top of variety of kernels. Currently supported kernels (a.k.a. OHOS flavours) are Linux, Zephyr, and FreeRTOS (experimental). - * **OHOS Linux flavour** - - Default Linux distro is poky-tiny. You can choose any of the following machines (default is qemux86): - * qemux86 - * qemux86-64 - * qemuarm - * qemuarmv5 - - To build Linux-based OHOS, execute following commands: +To build OHOS flavour, use the following command syntax: - .. code-block:: console +.. code-block:: console - $ TEMPLATECONF=../sources/meta-ohos/flavours/linux . ./sources/poky/oe-init-build-env build-poky-tiny-qemux86 - $ bitbake core-image-minimal + $ TEMPLATECONF=../sources/meta-ohos/flavours/<lower_case_flavour> . ./sources/poky/oe-init-build-env build-<flavour>-<target_machine> + $ bitbake <image-name> - DISTRO and MACHINE variables can be set up in *conf/local.conf* file under build directory or via command line. - - Example: - - .. code-block:: console - - $ DISTRO=poky MACHINE=qemux86-64 bitbake core-image-minimal - - - * **OHOS Zephyr flavour** - - For Zephyr you can choose any of the following machines (default is qemu-x86): - * acrn - * arduino-101-ble - * arduino-101 - * arduino-101-sss - * qemu-cortex-m3 - * qemu-nios2 - * qemu-x86 - - To build Zephyr-based OHOS, execute following commands: - - .. code-block:: console - - $ TEMPLATECONF=../sources/meta-ohos/flavours/zephyr . ./sources/poky/oe-init-build-env build-zephyr-qemux86 - $ bitbake zephyr-philosophers - - .. note:: - - `zephyr-philosophers` is one of the sample applications available in meta-zephyr layer by Yocto project. It's easy to build other samples using recipes available in `meta-zephyr/recipes-kernel/zephyr-kernel/` directory. - - * **OHOS FreeRTOS flavour** - - For FreeRTOS you can choose any of the following machines: - * qemuarmv5 +MACHINE variable can be set up in *conf/local.conf* file under build directory or via command line: - To build FreeRTOS-based OHOS, execute following commands: - - .. code-block:: console +**Example:** - $ TEMPLATECONF=../sources/meta-ohos/flavours/freertos . ./sources/poky/oe-init-build-env build-freertos-qemuarmv5 - $ bitbake freertos-demo +.. code-block:: console -3. Running OpenHarmony image. + $ MACHINE=<target_machine> bitbake <image-name> - When the build is finished, you can run the image by executing following command: - - * For poky-tiny: - - .. code-block:: console +OHOS Linux flavour +==================== - $ runqemu qemux86 ramfs qemuparams="-nographic" +OHOS Linux flavour is based on poky distribution. - After successful bootup, you should see following: - - .. code-block:: console - - qemux86 login: - # Default login is _root_ without a password. - # After login you should see prompt: - root@qemux86:~# +**Supported images:** - To exit qemu, you can either shut down the system: +* core-image-minimal +* core-image-full-cmdline - root@qemux86:~# poweroff -f +**Supported machines:** - or close qemu using key combination: +* qemux86-64 (default) +* qemux86 +* qemuarm +* qemuarm64 - Ctrl-a followed by 'x' - - - * For Zephyr: - - .. code-block:: console +**Example:** + +.. code-block:: console + + $ TEMPLATECONF=../sources/meta-ohos/flavours/linux . ./sources/poky/oe-init-build-env build-ohos-linux-qemux86-64 + $ bitbake core-image-minimal + +You can test the image built for the qemux86-64 target by issuing: + +.. code-block:: console + + $ runqemu qemux86-64 qemuparams="-nographic" + +After successful bootup, you should see following: + +.. code-block:: console + + Poky (Yocto Project Reference Distro) 3.1.4 qemux86-64 /dev/ttyS0 + qemux86-64 login: + +Default login is root without a password. After login you should see following prompt: + +.. code-block:: console + + root@qemux86-64:~# + +To exit qemu, you can either shut down the system: + +.. code-block:: console + + root@qemux86:~# poweroff -f + +or close qemu using key combination: + +Ctrl-a followed by 'x' + +OHOS Zephyr flavour +==================== + +OHOS Zephyr flavour is based on zephyr distribution and supports following images / machines: - $ DEPLOY_DIR_IMAGE=tmp-newlib/deploy/images/qemu-x86 runqemu qemu-x86 +**Supported images:** + +* zephyr-philosophers + +**Supported machines:** + +* qemu-cortex-m3 +* qemu-x86 (default) + +**Example:** + +.. code-block:: console + + $ TEMPLATECONF=../sources/meta-ohos/flavours/zephyr . ./sources/poky/oe-init-build-env build-ohos-zephyr-qemu-x86 + $ bitbake zephyr-philosophers + +You can test the image built for the qemu-x86 target by issuing: + +.. code-block:: console + + $ DEPLOY_DIR_IMAGE=tmp-newlib/deploy/images/qemu-x86 runqemu qemu-x86 + +After successful bootup, you should see following: + +.. code-block:: console - After successful bootup, you should see following: - - .. code-block:: console - Booting from ROM..*** Booting Zephyr OS build zephyr-v2.4.0 *** Philosopher 0 [P: 3] THINKING [ 300 ms ] Philosopher 1 [P: 2] EATING [ 575 ms ] Philosopher 2 [P: 1] STARVING Philosopher 3 [P: 0] EATING [ 525 ms ] Philosopher 4 [C: -1] THINKING [ 475 ms ] - - * For FreeRTOS: - .. code-block:: console - +To exit qemu, use key combination: + +**Ctrl-A** followed by 'x' + +OHOS FreeRTOS flavour +====================== + +OHOS FreeRTOS flavour is based on freertos distribution and supports following images / machines: + +**Supported images:** + +* freertos-demo + +**Supported machines:** + +* qemuarmv5 + +**Example:** + +.. code-block:: console + + $ TEMPLATECONF=../sources/meta-ohos/flavours/freertos . ./sources/poky/oe-init-build-env build-ohos-freertos-qemuarmv5 + $ bitbake freertos-demo + +You can test the image built for the qemuarmv5 target by issuing: + +.. code-block:: console + $ runqemu qemuarmv5 - After successful bootup, you should see following: - - .. code-block:: console - +After successful bootup, you should see following: + +.. code-block:: console + ###### - FreeRTOS sample application - ###### - - A text may be entered using a keyboard. + + A text may be entered using a keyboard. It will be displayed when 'Enter' is pressed. - + Periodic task 10 secs Waiting For Notification - Blocked... Task1 @@ -174,3 +203,6 @@ Building and Running OpenHarmony image Notification Received Waiting For Notification - Blocked... +To exit qemu, use key combination: + +**Ctrl-A** followed by 'x'