diff options
author | Alejandro Hernandez Samaniego <alejandro@enedino.org> | 2023-01-11 21:34:44 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-12 23:08:58 +0000 |
commit | 6bcbbd9ee3d2001cc26a4493aeb0d9cdd1b5239d (patch) | |
tree | 144d491b19d7ccde75658f599a264f7d16a43d65 /meta | |
parent | 1149b4fbb6002aa5a4cfe90bd404834721593968 (diff) | |
download | poky-6bcbbd9ee3d2001cc26a4493aeb0d9cdd1b5239d.tar.gz |
baremetal-helloworld: Move from skeleton to recipes-extended matching what rust-hello-world is doing
(From OE-Core rev: 13916de0145f83bb28323f0a6bde5c3d503c1319)
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/conf/distro/include/maintainers.inc | 1 | ||||
-rw-r--r-- | meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb | 72 |
2 files changed, 73 insertions, 0 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 508d10e091..8c2201c91b 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
@@ -54,6 +54,7 @@ RECIPE_MAINTAINER:pn-automake = "Robert Yang <liezhi.yang@windriver.com>" | |||
54 | RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>" | 54 | RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>" |
55 | RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>" | 55 | RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>" |
56 | RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>" | 56 | RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>" |
57 | RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>" | ||
57 | RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>" | 58 | RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>" |
58 | RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>" | 59 | RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>" |
59 | RECIPE_MAINTAINER:pn-bash = "Hongxu Jia <hongxu.jia@windriver.com>" | 60 | RECIPE_MAINTAINER:pn-bash = "Hongxu Jia <hongxu.jia@windriver.com>" |
diff --git a/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb b/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb new file mode 100644 index 0000000000..82b2901d51 --- /dev/null +++ b/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb | |||
@@ -0,0 +1,72 @@ | |||
1 | SUMMARY = "Baremetal examples to work with the several QEMU architectures supported on OpenEmbedded" | ||
2 | HOMEPAGE = "https://github.com/aehs29/baremetal-helloqemu" | ||
3 | DESCRIPTION = "These are introductory examples to showcase the use of QEMU to run baremetal applications." | ||
4 | LICENSE = "MIT" | ||
5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=39346640a23c701e4f459e05f56f4449" | ||
6 | |||
7 | SRCREV = "22016ecbb9fb6c5f3a7a06698aea7ff8a701c166" | ||
8 | PV = "0.1+git${SRCPV}" | ||
9 | |||
10 | SRC_URI = "git://github.com/aehs29/baremetal-helloqemu.git;protocol=https;branch=master" | ||
11 | UPSTREAM_VERSION_UNKNOWN="1" | ||
12 | |||
13 | S = "${WORKDIR}/git" | ||
14 | |||
15 | # The following variables should be set to accomodate each application | ||
16 | BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}" | ||
17 | IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}" | ||
18 | IMAGE_NAME_SUFFIX ?= "" | ||
19 | |||
20 | # Baremetal-Image creates the proper wiring, assumes the output is provided in | ||
21 | # binary and ELF format, installed on ${base_libdir}/firmware/ , we want a | ||
22 | # package to be created since we might have some way of updating the baremetal | ||
23 | # firmware from Linux | ||
24 | inherit baremetal-image | ||
25 | |||
26 | |||
27 | # startup code for x86 uses NASM syntax | ||
28 | DEPENDS:qemux86:append = " nasm-native" | ||
29 | |||
30 | # These parameters are app specific for this example | ||
31 | # This will be translated automatically to the architecture and | ||
32 | # machine that QEMU uses on OE, e.g. -machine virt -cpu cortex-a57 | ||
33 | # but the examples can also be run on other architectures/machines | ||
34 | # such as vexpress-a15 by overriding the setting on the machine.conf | ||
35 | COMPATIBLE_MACHINE = "qemuarmv5|qemuarm|qemuarm64|qemuriscv64|qemuriscv32|qemux86|qemux86-64" | ||
36 | |||
37 | BAREMETAL_QEMUARCH ?= "" | ||
38 | BAREMETAL_QEMUARCH:qemuarmv5 = "versatile" | ||
39 | BAREMETAL_QEMUARCH:qemuarm = "arm" | ||
40 | BAREMETAL_QEMUARCH:qemuarm64 = "aarch64" | ||
41 | BAREMETAL_QEMUARCH:qemuriscv64 = "riscv64" | ||
42 | BAREMETAL_QEMUARCH:qemuriscv32 = "riscv32" | ||
43 | BAREMETAL_QEMUARCH:qemux86 = "x86" | ||
44 | BAREMETAL_QEMUARCH:qemux86-64 = "x86-64" | ||
45 | |||
46 | EXTRA_OEMAKE:append = " QEMUARCH=${BAREMETAL_QEMUARCH} V=1" | ||
47 | |||
48 | # qemux86-64 uses a different Makefile | ||
49 | do_compile:prepend:qemux86-64(){ | ||
50 | cd x86-64 | ||
51 | } | ||
52 | |||
53 | # Install binaries on the proper location for baremetal-image to fetch and deploy | ||
54 | do_install(){ | ||
55 | install -d ${D}/${base_libdir}/firmware | ||
56 | install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.bin ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin | ||
57 | install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.elf ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf | ||
58 | } | ||
59 | |||
60 | FILES:${PN} += " \ | ||
61 | ${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin \ | ||
62 | ${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf \ | ||
63 | " | ||
64 | |||
65 | # qemux86-64 boots from iso rather than -kernel, create image to boot from | ||
66 | do_image:append:qemux86-64(){ | ||
67 | dd if=/dev/zero of=${B}/build/img.iso bs=1M count=10 status=none | ||
68 | dd if=${B}/build/stage1.bin of=${B}/build/img.iso bs=512 count=1 conv=notrunc | ||
69 | dd if=${B}/build/stage2.bin of=${B}/build/img.iso bs=512 seek=1 count=64 conv=notrunc | ||
70 | dd if=${B}/build/hello_baremetal_x86-64.bin of=${B}/build/img.iso bs=512 seek=65 conv=notrunc | ||
71 | install ${B}/build/img.iso ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.iso | ||
72 | } | ||