zephyr-core/zephyr-kernel: Refactor zephyr-image and zephyr-sample

At the moment:
 * zephyr-image.inc depends on zephyr-sample.inc, which doesn't really
   make sense.
 * zephyr-image.inc inherits testimage, even though it may not be
   required.
 * Out-of-tree Zephyr apps have to include zephyr-sample.inc in order to
   deploy the binaries, which is confusingly named if your application
   isn't a "sample".

Do some minor refactoring to untangle the above. Now:
 * zephyr-sample.inc depends on zephyr-image.inc
 * zephyrtest.bbclass inherits testimage.
 * Out-of-tree Zephyr apps can include zephyr-image.inc

Additionally, remove QEMU_BIN_PATH, as recent Zephyr versions now pick
up the QEMU binary automatically from PATH.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
This commit is contained in:
Peter Hoyes
2022-09-30 17:34:36 +01:00
committed by Naveen Saini
parent 7d2cd41521
commit 6cf57189bf
3 changed files with 22 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
inherit rootfs-postcommands
inherit rootfs-postcommands testimage
python zephyrtest_virtclass_handler () {
variant = e.data.getVar("BBEXTENDVARIANT", True)
@@ -14,7 +14,7 @@ python zephyrtest_virtclass_handler () {
e.data.setVar("ZEPHYR_IMAGENAME", pn + ".elf")
# Most tests for Zephyr 1.6 are in the "legacy" folder
e.data.setVar("ZEPHYR_SRC_DIR", "tests/kernel/" + variant)
e.data.setVar("ZEPHYR_SRC_DIR", "${ZEPHYR_BASE}/tests/kernel/" + variant)
e.data.setVar("ZEPHYR_MAKE_OUTPUT", "zephyr.elf")
# Allow to build using both foo-some_test form as well as foo-some-test

View File

@@ -1,9 +1,22 @@
require zephyr-sample.inc
inherit testimage
require zephyr-kernel-src.inc
require zephyr-kernel-common.inc
inherit deploy
QEMU_BIN_PATH = "${STAGING_BINDIR_NATIVE}"
OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
OECMAKE_SOURCEPATH = "${ZEPHYR_BASE}/${ZEPHYR_SRC_DIR}"
addtask deploy after do_compile
do_install[noexec] = "1"
do_deploy() {
install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
if [ -f ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ]
then
install -D ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ${DEPLOYDIR}/${PN}.bin
fi
if [ -f ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ]
then
install -D ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ${DEPLOYDIR}/${PN}.efi
fi
}
addtask deploy after do_compile

View File

@@ -1,22 +1 @@
require zephyr-kernel-src.inc
require zephyr-kernel-common.inc
inherit deploy
OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
do_install[noexec] = "1"
do_deploy () {
install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf
if [ -f ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ]
then
install -D ${B}/zephyr/${ZEPHYR_MAKE_BIN_OUTPUT} ${DEPLOYDIR}/${PN}.bin
fi
if [ -f ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ]
then
install -D ${B}/zephyr/${ZEPHYR_MAKE_EFI_OUTPUT} ${DEPLOYDIR}/${PN}.efi
fi
}
addtask deploy after do_compile
require zephyr-image.inc