From 6bcbbd9ee3d2001cc26a4493aeb0d9cdd1b5239d Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Samaniego Date: Wed, 11 Jan 2023 21:34:44 -0700 Subject: 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 Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- .../baremetal-examples/baremetal-helloworld_git.bb | 71 --------------------- meta/conf/distro/include/maintainers.inc | 1 + .../baremetal-example/baremetal-helloworld_git.bb | 72 ++++++++++++++++++++++ 3 files changed, 73 insertions(+), 71 deletions(-) delete mode 100644 meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb create mode 100644 meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb diff --git a/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb b/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb deleted file mode 100644 index fede17b0f0..0000000000 --- a/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb +++ /dev/null @@ -1,71 +0,0 @@ -SUMMARY = "Baremetal examples to work with the several QEMU architectures supported on OpenEmbedded" -HOMEPAGE = "https://github.com/aehs29/baremetal-helloqemu" -DESCRIPTION = "These are introductory examples to showcase the use of QEMU to run baremetal applications." -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=39346640a23c701e4f459e05f56f4449" - -SRCREV = "22016ecbb9fb6c5f3a7a06698aea7ff8a701c166" -PV = "0.1+git${SRCPV}" - -SRC_URI = "git://github.com/aehs29/baremetal-helloqemu.git;protocol=https;branch=master" - -S = "${WORKDIR}/git" - -# The following variables should be set to accomodate each application -BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}" -IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}" -IMAGE_NAME_SUFFIX ?= "" - -# Baremetal-Image creates the proper wiring, assumes the output is provided in -# binary and ELF format, installed on ${base_libdir}/firmware/ , we want a -# package to be created since we might have some way of updating the baremetal -# firmware from Linux -inherit baremetal-image - - -# startup code for x86 uses NASM syntax -DEPENDS:qemux86:append = " nasm-native" - -# These parameters are app specific for this example -# This will be translated automatically to the architecture and -# machine that QEMU uses on OE, e.g. -machine virt -cpu cortex-a57 -# but the examples can also be run on other architectures/machines -# such as vexpress-a15 by overriding the setting on the machine.conf -COMPATIBLE_MACHINE = "qemuarmv5|qemuarm|qemuarm64|qemuriscv64|qemuriscv32|qemux86|qemux86-64" - -BAREMETAL_QEMUARCH ?= "" -BAREMETAL_QEMUARCH:qemuarmv5 = "versatile" -BAREMETAL_QEMUARCH:qemuarm = "arm" -BAREMETAL_QEMUARCH:qemuarm64 = "aarch64" -BAREMETAL_QEMUARCH:qemuriscv64 = "riscv64" -BAREMETAL_QEMUARCH:qemuriscv32 = "riscv32" -BAREMETAL_QEMUARCH:qemux86 = "x86" -BAREMETAL_QEMUARCH:qemux86-64 = "x86-64" - -EXTRA_OEMAKE:append = " QEMUARCH=${BAREMETAL_QEMUARCH} V=1" - -# qemux86-64 uses a different Makefile -do_compile:prepend:qemux86-64(){ - cd x86-64 -} - -# Install binaries on the proper location for baremetal-image to fetch and deploy -do_install(){ - install -d ${D}/${base_libdir}/firmware - install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.bin ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin - install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.elf ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf -} - -FILES:${PN} += " \ - ${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin \ - ${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf \ -" - -# qemux86-64 boots from iso rather than -kernel, create image to boot from -do_image:append:qemux86-64(){ - dd if=/dev/zero of=${B}/build/img.iso bs=1M count=10 status=none - dd if=${B}/build/stage1.bin of=${B}/build/img.iso bs=512 count=1 conv=notrunc - dd if=${B}/build/stage2.bin of=${B}/build/img.iso bs=512 seek=1 count=64 conv=notrunc - dd if=${B}/build/hello_baremetal_x86-64.bin of=${B}/build/img.iso bs=512 seek=65 conv=notrunc - install ${B}/build/img.iso ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.iso -} 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 " RECIPE_MAINTAINER:pn-avahi = "Yi Zhao " RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin " RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin " +RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez " RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal " RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal " RECIPE_MAINTAINER:pn-bash = "Hongxu Jia " 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 @@ +SUMMARY = "Baremetal examples to work with the several QEMU architectures supported on OpenEmbedded" +HOMEPAGE = "https://github.com/aehs29/baremetal-helloqemu" +DESCRIPTION = "These are introductory examples to showcase the use of QEMU to run baremetal applications." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=39346640a23c701e4f459e05f56f4449" + +SRCREV = "22016ecbb9fb6c5f3a7a06698aea7ff8a701c166" +PV = "0.1+git${SRCPV}" + +SRC_URI = "git://github.com/aehs29/baremetal-helloqemu.git;protocol=https;branch=master" +UPSTREAM_VERSION_UNKNOWN="1" + +S = "${WORKDIR}/git" + +# The following variables should be set to accomodate each application +BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}" +IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}" +IMAGE_NAME_SUFFIX ?= "" + +# Baremetal-Image creates the proper wiring, assumes the output is provided in +# binary and ELF format, installed on ${base_libdir}/firmware/ , we want a +# package to be created since we might have some way of updating the baremetal +# firmware from Linux +inherit baremetal-image + + +# startup code for x86 uses NASM syntax +DEPENDS:qemux86:append = " nasm-native" + +# These parameters are app specific for this example +# This will be translated automatically to the architecture and +# machine that QEMU uses on OE, e.g. -machine virt -cpu cortex-a57 +# but the examples can also be run on other architectures/machines +# such as vexpress-a15 by overriding the setting on the machine.conf +COMPATIBLE_MACHINE = "qemuarmv5|qemuarm|qemuarm64|qemuriscv64|qemuriscv32|qemux86|qemux86-64" + +BAREMETAL_QEMUARCH ?= "" +BAREMETAL_QEMUARCH:qemuarmv5 = "versatile" +BAREMETAL_QEMUARCH:qemuarm = "arm" +BAREMETAL_QEMUARCH:qemuarm64 = "aarch64" +BAREMETAL_QEMUARCH:qemuriscv64 = "riscv64" +BAREMETAL_QEMUARCH:qemuriscv32 = "riscv32" +BAREMETAL_QEMUARCH:qemux86 = "x86" +BAREMETAL_QEMUARCH:qemux86-64 = "x86-64" + +EXTRA_OEMAKE:append = " QEMUARCH=${BAREMETAL_QEMUARCH} V=1" + +# qemux86-64 uses a different Makefile +do_compile:prepend:qemux86-64(){ + cd x86-64 +} + +# Install binaries on the proper location for baremetal-image to fetch and deploy +do_install(){ + install -d ${D}/${base_libdir}/firmware + install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.bin ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin + install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.elf ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf +} + +FILES:${PN} += " \ + ${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin \ + ${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf \ +" + +# qemux86-64 boots from iso rather than -kernel, create image to boot from +do_image:append:qemux86-64(){ + dd if=/dev/zero of=${B}/build/img.iso bs=1M count=10 status=none + dd if=${B}/build/stage1.bin of=${B}/build/img.iso bs=512 count=1 conv=notrunc + dd if=${B}/build/stage2.bin of=${B}/build/img.iso bs=512 seek=1 count=64 conv=notrunc + dd if=${B}/build/hello_baremetal_x86-64.bin of=${B}/build/img.iso bs=512 seek=65 conv=notrunc + install ${B}/build/img.iso ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.iso +} -- cgit v1.2.3-54-g00ecf