Skip to content
Snippets Groups Projects
Commit d6253983 authored by Gururaj Shetty's avatar Gururaj Shetty
Browse files

modified as per the latest changes

parent 3475e102
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,8 @@
Building OpenHarmony Image
##########################
OpenHarmony is a distributed OS that is designed to run on top of variety of OS kernels. Currently the supported kernels are Zephyr, Yocto, and FreeRTOS. To build OpenHarmony image, you need to add multiple layers called meta-ohos. The meta-ohos is an umbrella meta layer containing all layers required to build OpenHarmony Image based on existing kernel meta-layers. This section describes how to build, add layers, and run the OpenHarmony image.
OpenHarmony is a distributed OS that is designed to run on top of variety of OS kernels ranging from RTOSs to Linux. To build OpenHarmony image, you need to add multiple layers called **meta-ohos**. The **meta-ohos** is a set of bitbake layers for building OpenHarmony images using the bitbake infrastructure, it is a _umbrella_ meta layer containing all layers required to build. This section describes the architecture of **meta-ohos** and procedures invloved in building and running the OpenHarmony image using supported kernels.
* `Build and Run Using Zephyr <using zypher>`_
* `Build and Run Using Linux <using linux>`_
* `Build and Run Using FreeRTOS <using freertos>`_
**Figure 1 meta-ohos overview**
......@@ -16,7 +13,6 @@ OpenHarmony is a distributed OS that is designed to run on top of variety of OS
:alt: meta-ohos overview
Prerequisites
s
To start working with **meta-ohos** first install git repo:
......@@ -26,221 +22,155 @@ To start working with **meta-ohos** first install git repo:
$ sudo apt-get update
$ sudo apt-get install git-repo
.. _using zypher:
Building and Running OpenHarmony image
************************************************
Build and Run Using Zypher
-----------------------------------------
1. Once git repo has been installed, clone the necessary repositories.
1. Once git repo has been installed, clone the necessary repositories using the following commands:
.. code-block:: console
$ mkdir ohos; cd ohos
$ repo init -u https://git.ostc-eu.org/incubate/meta-ohos/manifest.git
$ repo init -u https://git.ostc-eu.org/OSTC/manifest.git
$ repo sync
$ cd poky
poky$ . oe-init-build-env
2. Add layers for other kernels.
.. code-block:: console
build$ bitbake-layers add-layer ../meta-openembedded/meta-oe
build$ bitbake-layers add-layer ../meta-openembedded/meta-python
build$ bitbake-layers add-layer ../meta-zephyr
3. Build distro by selecting the prefered board:
* For Nitrogen
.. code-block:: console
build$ DISTRO=zephyr MACHINE=96b-nitrogen bitbake zephyr-philosophers
* For Avenger96
.. code-block:: console
Above commands creates the following directory structure:
build$ DISTRO=zephyr MACHINE=96b-avenger96 bitbake zephyr-philosophers
.. note::
For Zephyr, 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.
.. code-block:: console
./ohos/
└── sources
├── meta-freertos
├── meta-ohos
├── meta-openembedded
├── meta-zephyr
└── poky
2. Build OHOS flavour of your choice. Currently OpenHarmony supports Linux, Zephyr, and FreeRTOS.
* **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
4. After the build is successful, run the image by executing the following command:
To build Linux-based OHOS, execute following commands:
* For Nitrogen
.. code-block:: console
build$ DEPLOY_DIR_IMAGE=tmp-newlib/deploy/images/96b-nitrogen runqemu 96b-nitrogen
* For Avenger96
.. code-block:: console
build$ DEPLOY_DIR_IMAGE=tmp-newlib/deploy/images/96b-avenger96 runqemu 96b-avenger96
After successful bootup, the following message should be displayed:
.. 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 ]
.. _using linux:
$ TEMPLATECONF=../sources/meta-ohos/flavours/linux . ./sources/poky/oe-init-build-env build-poky-tiny-qemux86
$ bitbake core-image-minimal
Build and Run Using Linux
----------------------------------------
1. Once git repo has been installed, clone the necessary repositories.
.. code-block:: console
$ mkdir ohos; cd ohos
$ repo init -u https://git.ostc-eu.org/incubate/meta-ohos/manifest.git
$ repo sync
$ cd poky
poky$ . oe-init-build-env
2. In Linux, layers for poky is added automatically by sourcing oe-init-build-env. Working directory will automatically change to ./poky/build.
DISTRO and MACHINE variables can be set up in *conf/local.conf* file under build directory or via command line.
Example:
3. Build distro by selecting the prefered board:
* For Nitrogen
.. code-block:: console
build$ DISTRO=poky-tiny MACHINE=96b-nitrogen bitbake core-image-minimal
* For Avenger96
.. code-block:: console
build$ DISTRO=poky-tiny MACHINE=96b-avenger96 bitbake core-image-minimal
$ DISTRO=poky MACHINE=qemux86-64 bitbake core-image-minimal
4. After the build is successful, run the image by executing the following command:
* For Nitrogen
.. code-block:: console
build$ runqemu 96b-nitrogen ramfs qemuparams="-nographic"
* For Avenger96
.. code-block:: console
build$ runqemu 96b-avenger96 ramfs qemuparams="-nographic"
After successful bootup, the following message should be displayed:
* For Nitrogen
.. code-block:: console
# For poky
96b-nitrogen login:
# Default login is _root_ without a password.
# After login you should see prompt:
root@96b-nitrogen:~#
* For Avenger96
.. code-block:: console
# For poky
96b-avenger96 login:
# Default login is _root_ without a password.
# After login you should see prompt:
root@96b-avenger96:~#
.. _using freertos:
Build and Run Using FreeRTOS
-----------------------------------------------
1. Once git repo has been installed, clone the necessary repositories.
.. code-block:: console
$ mkdir ohos; cd ohos
$ repo init -u https://git.ostc-eu.org/incubate/meta-ohos/manifest.git
$ repo sync
$ cd poky
poky$ . oe-init-build-env
2. Add layers for other kernels.
.. code-block:: console
build$ bitbake-layers add-layer ../meta-openembedded/meta-oe
build$ bitbake-layers add-layer ../meta-openembedded/meta-python
build$ bitbake-layers add-layer ../meta-freertos
3. Build distro by selecting the prefered board.
.. Note::
Currently FreeRTOS supports *qemu* boards only.
.. code-block:: console
build$ DISTRO=freertos MACHINE=qemuarmv5 bitbake freertos-demo
4. After the build is successful, run the image by executing the following command:
.. code-block:: console
* **OHOS Zephyr flavour**
build$ runqemu 96b-nitrogen
After successful bootup, the following message should be displayed:
.. code-block:: console
###### - FreeRTOS sample application -######
A text may be entered using a keyboard.
It will be displayed when 'Enter' is pressed.
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
Periodic task 10 secs
Waiting For Notification - Blocked...
Task1
Task1
You entered: "HelloFreeRTOS"
Unblocked
Notification Received
Waiting For Notification - Blocked...
$ 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
To build FreeRTOS-based OHOS, execute following commands:
.. code-block:: console
$ TEMPLATECONF=../sources/meta-ohos/flavours/freertos . ./sources/poky/oe-init-build-env build-freertos-qemuarmv5
$ bitbake freertos-demo
3. Running OpenHarmony image.
When the build is finished, you can run the image by executing following command:
* For poky-tiny:
.. code-block:: console
$ runqemu qemux86 ramfs qemuparams="-nographic"
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:~#
To exit qemu, you can either shut down the system:
root@qemux86:~# poweroff -f
or close qemu using key combination:
Ctrl-a followed by 'x'
* For Zephyr:
.. 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
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
$ runqemu qemuarmv5
After successful bootup, you should see following:
.. code-block:: console
###### - FreeRTOS sample application - ######
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
Task1
You entered: "HelloFreeRTOS"
Unblocked
Notification Received
Waiting For Notification - Blocked...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment