From 6d7b91924c66aa5785ec1a82a6eb25fc45575f52 Mon Sep 17 00:00:00 2001
From: Esben Haabendal <esben.haabendal@huawei.com>
Date: Wed, 20 Apr 2022 09:36:20 +0200
Subject: [PATCH] openharmony-standard-image: New recipe for trying out OH
 components

This provides an image which can be used with e.g. QEMU to try out the
OpenHarmony components build with openharmony-standard recipe.

Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
---
 README.md                                     |  7 ++++++
 recipes-openharmony/images/README.md          | 22 +++++++++++++++++++
 .../images/openharmony-standard-image.bb      | 22 +++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 recipes-openharmony/images/README.md
 create mode 100644 recipes-openharmony/images/openharmony-standard-image.bb

diff --git a/README.md b/README.md
index 3dde8d25..45c5e1bd 100644
--- a/README.md
+++ b/README.md
@@ -68,6 +68,13 @@ You can run these commands to do this:
 	repo init -u https://gitlab.eclipse.org/eclipse/oniro-core/meta-openharmony.git -b kirkstone
 	repo sync --no-clone-bundle
 
+## QEMU example image
+
+The meta-openharmony provides an example image recipe which can be used for
+quickly building and running OpenHarmony code in QEMU ARM simulator.
+
+See [recipes-openharmony/images/README.md](recipes-openharmony/images/README.md)
+for more information.
 
 ## OpenHarmony prebuilts
 
diff --git a/recipes-openharmony/images/README.md b/recipes-openharmony/images/README.md
new file mode 100644
index 00000000..1ebe5067
--- /dev/null
+++ b/recipes-openharmony/images/README.md
@@ -0,0 +1,22 @@
+<!--
+SPDX-FileCopyrightText: Huawei Inc.
+
+SPDX-License-Identifier: CC-BY-4.0
+-->
+
+# QEMU example image
+
+The `openharmony-standard-image` recipe provides an easy way to build and run
+OpenHarmony components. You can build the image for QEMU and run it using the
+following in your `build/conf/local.conf` file:
+
+    DISTRO = "oniro-openharmony-linux"
+    MACHINE = "qemuarma7"
+
+To build the image, run:
+
+    bitbake openharmony-standard-image
+
+To run it, run the this commands after successfully completing the above build command:
+
+    runqemu serialstdio nographic
diff --git a/recipes-openharmony/images/openharmony-standard-image.bb b/recipes-openharmony/images/openharmony-standard-image.bb
new file mode 100644
index 00000000..9bd4498c
--- /dev/null
+++ b/recipes-openharmony/images/openharmony-standard-image.bb
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+SUMMARY = "A console-only image with OpenHarmony first party components"
+
+IMAGE_FEATURES += "splash"
+
+LICENSE = "Apache-2.0"
+
+inherit core-image
+
+QEMU_USE_SLIRP = "1"
+
+# debug-tweaks provides password-less root account required by testimage
+EXTRA_IMAGE_FEATURES += "debug-tweaks"
+
+# ptest requires ptest-runner and sshd to be present in the image
+IMAGE_INSTALL += "sshd"
+
+# install OpenHarmony components and ptests
+IMAGE_INSTALL += "openharmony-standard-exes"
-- 
GitLab