Skip to contentSkip to conversation

consolidated pull for Morty

PATCH New Juro Bystricky 1 participant 8 messages Feb 4, 2017

lore
Share & tools
lore
#0 lore raw

cover consolidated pull for Morty

The attached series of patches containes various improvements for meta-zephyr. These are intended for a new meta-zephyr branch "morty".

Juro Bystricky (7):
zephyr-kernel-common.inc: also build qemus if needed
zephyr-philosophers: use common naming conventions
zephyr-getchar: minor cleanup
zephyr-kernel-test-all: implement clean zephyrtest.bbclass: refactor
qemu-*.conf: support for qemuboot zephyr-qemuboot.bbclass

 classes/zephyr-qemuboot.bbclass                    | 39 ++++++++++++++++++++++
 classes/zephyrtest.bbclass                         | 10 +++---
 conf/machine/qemu-cortex-m3.conf                   |  8 +++--
 conf/machine/qemu-nios2.conf                       |  7 ++--
 conf/machine/qemu-x86.conf                         |  6 +++-
 .../zephyr-kernel/zephyr-kernel-common.inc         |  7 +++-
 .../zephyr-kernel/zephyr-kernel-test-all.bb        |  1 +
 recipes-kernel/zephyr-kernel/zephyr-kernel.inc     |  3 ++
 .../zephyr-kernel/zephyr-philosophers.bb           |  5 ++-
 .../zephyr-getchar/zephyr-getchar_git.bb           |  3 +-
 10 files changed, 72 insertions(+), 17 deletions(-)
 create mode 100644 classes/zephyr-qemuboot.bbclass
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/7 zephyr-kernel-common.inc: also build qemus if needed

Also build qemus if a recipe is built for a MACHINE=qemuXXX. Allow inheriting classes based on recipe context.

---
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +5 -1
index cb3c76b..078ea72 100644
@@ -1,6 +1,7 @@
 # Common settings for all Zephyr recipes
 
-inherit zephyr
+ZEPHYR_INHERIT_CLASSES += "zephyr"
+inherit ${ZEPHYR_INHERIT_CLASSES}
 
 # There shouldn't be a manifest for zephyr kernels since there is no root
 # filesystem.
@@ -16,6 +17,8 @@ INHIBIT_DEFAULT_DEPS = "1"
 DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc ${TOOLCHAIN_TARGET_TASK}"
 CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
 
+DEPENDS_append_qemuall = " qemu-native qemu-helper-native"
+
 do_configure[noexec] = "1"
 
 # The makefiles are explicit about the flags they want, so don't unset
@@ -35,3 +38,4 @@ OE_TERMINAL_EXPORTS += "ZEPHYR_SRC_DIR"
 OE_TERMINAL_EXPORTS += "ZEPHYR_BASE"
 OE_TERMINAL_EXPORTS += "ZEPHYR_SYSROOT"
 OE_TERMINAL_EXPORTS += "ZEPHYR_GCC_VARIANT"
+
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/7 zephyr-philosophers: use common naming conventions

In reply to Juro Bystricky

Derive the name of the resulting image based on PN.

---
 recipes-kernel/zephyr-kernel/zephyr-philosophers.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
recipes-kernel/zephyr-kernel/zephyr-philosophers.bb +2 -3
index babc453..425bebb 100644
@@ -11,9 +11,8 @@ do_compile () {
 }
 
 do_deploy () {
-    install -D samples/philosophers/outdir/${BOARD}/zephyr.elf ${DEPLOYDIR}/philosophers.elf
-    install -D samples/philosophers/outdir/${BOARD}/zephyr.bin ${DEPLOYDIR}/philosophers.bin
-    export DEPLOY_DIR_IMAGE=${DEPLOYDIR}/philosophers.elf
+    install -D samples/philosophers/outdir/${BOARD}/zephyr.elf ${DEPLOYDIR}/${PN}.elf
+    install -D samples/philosophers/outdir/${BOARD}/zephyr.bin ${DEPLOYDIR}/${PN}.bin
 }
 
 addtask deploy after do_compile
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/7 zephyr-getchar: minor cleanup

In reply to Juro Bystricky
---
 recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb +1 -2
index 3a34b22..f721033 100644
@@ -12,7 +12,7 @@ S = "${WORKDIR}/git/zephyr_getchar"
 ZEPHYR_SRC_DIR = "${S}"
 ZEPHYR_BASE="${STAGING_DIR_TARGET}/usr/src/zephyr"
 
-DEPENDS += " zephyr-kernel-src"
+DEPENDS += "zephyr-kernel-src"
 
 do_compile () {
     cd ${ZEPHYR_SRC_DIR}
@@ -21,7 +21,6 @@ do_compile () {
 
 do_deploy () {
     install -D ${S}/outdir/${BOARD}/zephyr.elf ${DEPLOYDIR}/${PN}.elf
-    export DEPLOY_DIR_IMAGE=${DEPLOYDIR}/${PN}.elf
 }
 
 addtask deploy after do_compile
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/7 zephyr-kernel-test-all: implement clean

In reply to Juro Bystricky

support for:

    $ bitbake zephyr-kernel-test-all -c clean
---
 recipes-kernel/zephyr-kernel/zephyr-kernel-test-all.bb | 1 +
 1 file changed, 1 insertion(+)
recipes-kernel/zephyr-kernel/zephyr-kernel-test-all.bb +1 -0
index 45f962e..c45124a 100644
@@ -16,3 +16,4 @@ do_testimage[depends] = '${@" ".join(["zephyr-kernel-test-" + x + ":do_testimage
 
 do_build[depends] = '${@" ".join(["zephyr-kernel-test-" + x + ":do_build" for x in d.getVar("ZEPHYRTESTS", True).split()])}'
 
+do_clean[depends] = '${@" ".join(["zephyr-kernel-test-" + x + ":do_clean" for x in d.getVar("ZEPHYRTESTS", True).split()])}'
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/7 zephyrtest.bbclass: refactor

In reply to Juro Bystricky

Only keep code/variables related to individual test/package names. Moved ZEPHYR_TEST_SRCDIR into zephyr-kernel.inc as it is zephyr kernel version specific.
Moved ZEPHYR_MAKE_OUTPUT into zephyr-kernel-common.inc as it is as it is not zephyr test specific but applicable to all zephyr images.
Additional minor cleanup.

---
 classes/zephyrtest.bbclass                            | 10 ++++------
 recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc |  1 +
 recipes-kernel/zephyr-kernel/zephyr-kernel.inc        |  3 +++
 3 files changed, 8 insertions(+), 6 deletions(-)
classes/zephyrtest.bbclass +4 -6
index e396bf7..aa9ee3c 100644
@@ -1,6 +1,5 @@
 
 python zephyrtest_virtclass_handler () {
-    cls = e.data.getVar("BBEXTENDCURR", True)
     variant = e.data.getVar("BBEXTENDVARIANT", True)
 
     # ipk doesn't like underscores in pacakges names. So just use dashes
@@ -11,13 +10,12 @@ python zephyrtest_virtclass_handler () {
     pn_underscores = e.data.getVar("PN", True) + "-" + variant
 
     e.data.setVar("PN", pn)
-    e.data.setVar("ZEPHYR_IMAGENAME", variant_dashes + ".elf")
+    e.data.setVar("ZEPHYR_IMAGENAME", pn + ".elf")
 
-    # Most tests for Zephyr 1.6 are in the "legacy" folder
-    e.data.setVar("ZEPHYR_IMAGE_SRCDIR", "tests/legacy/kernel/" + variant)
-    e.data.setVar("ZEPHYR_MAKE_OUTPUT", "zephyr.elf")
+    testsrc = e.data.getVar("ZEPHYR_TEST_SRCDIR", True)
+    e.data.setVar("ZEPHYR_IMAGE_SRCDIR", testsrc + variant)
 
-    # Allow to build using both foo-some_test form as well ass foo-some-test
+    # Allow to build using both foo-some_test form as well as foo-some-test
     e.data.setVar("PROVIDES", e.data.getVar("PROVIDES", True) + pn_underscores)
 }
 
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +1 -0
index 078ea72..f5106c1 100644
@@ -10,6 +10,7 @@ IMAGE_NO_MANIFEST = "1"
 ZEPHYR_GCC_VARIANT="yocto"
 ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}"
 
+ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
 ZEPHYR_MAKE_ARGS = " V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE} ZEPHYR_GCC_VARIANT=${ZEPHYR_GCC_VARIANT} ZEPHYR_BASE=${ZEPHYR_BASE} ZEPHYR_SYSROOT=${ZEPHYR_SYSROOT}"
 
 # We always need a toolchain to cross-compile.
recipes-kernel/zephyr-kernel/zephyr-kernel.inc +3 -0
index 71c7a29..59b0713 100644
@@ -8,6 +8,9 @@ SRC_URI += "file://Makefile.toolchain.yocto"
 
 PV = "1.6.0"
 
+# Most tests for Zephyr 1.6 are in the "legacy" folder
+ZEPHYR_TEST_SRCDIR = "tests/legacy/kernel/"
+
 S = "${WORKDIR}/git"
 
 do_compile_prepend() {
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/7 qemu-*.conf: support for qemuboot

In reply to Juro Bystricky

Add support to run qemus using runqemu.
All qemu machines will inherit the bbclass "zephyr-qemuboot", which is responsible to set up everything that is needed in order to use "runqemu".

---
 conf/machine/qemu-cortex-m3.conf | 8 ++++++--
 conf/machine/qemu-nios2.conf     | 7 +++++--
 conf/machine/qemu-x86.conf       | 6 +++++-
 3 files changed, 16 insertions(+), 5 deletions(-)
conf/machine/qemu-cortex-m3.conf +6 -2
index aeb9a69..6a6d45e 100644
@@ -5,7 +5,11 @@
 require conf/machine/include/qemu.inc
 require conf/machine/include/tune-cortexm3.inc
 
-# For runqemu (TBD)
+ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
+
+# For runqemu
 QB_SYSTEM_NAME = "qemu-system-arm"
 QB_MACHINE = "-machine lm3s6965evb"
-QB_OPT_APPEND = "-nographic -vga none -cpu=cortex-m3"
+QB_OPT_APPEND = "-nographic -vga none"
+QB_CPU = "-cpu cortex-m3"
+
conf/machine/qemu-nios2.conf +5 -2
index d74017f..abc9574 100644
@@ -5,7 +5,10 @@
 require conf/machine/include/qemu.inc
 require conf/machine/include/tune-nios2.inc
 
-# For runqemu (TBD)
+ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
+
+# For runqemu
 QB_SYSTEM_NAME = "qemu-system-nios2"
 QB_MACHINE = "-machine altera_10m50_zephyr"
-QB_OPT_APPEND = "-nographic -cpu=nios2"
+QB_OPT_APPEND = "-nographic"
+QB_CPU = "-cpu nios2"
conf/machine/qemu-x86.conf +5 -1
index 0d595a1..9a46809 100644
@@ -5,7 +5,11 @@
 require conf/machine/include/qemu.inc
 require conf/machine/include/tune-i586.inc
 
-# For runqemu (TBD)
+ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
+
+# For runqemu
 QB_SYSTEM_NAME = "qemu-system-i386"
 QB_MACHINE = "-machine pc-0.14"
 QB_OPT_APPEND = "-nographic -display none -clock dynticks -no-acpi -balloon none"
+QB_CPU_x86 = "-cpu qemu32"
+QB_CPU_KVM_x86 = "-cpu kvm32"
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/7 zephyr-qemuboot.bbclass

In reply to Juro Bystricky

A bbclass used to generate qemuboot.conf and various symbolic links needed to properly run "runqemu".

---
 classes/zephyr-qemuboot.bbclass | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 classes/zephyr-qemuboot.bbclass
classes/zephyr-qemuboot.bbclass new file +39 -0
new file mode 100644
index 0000000..2f9c4f1
@@ -0,0 +1,39 @@
+inherit qemuboot
+
+KERNEL_IMAGETYPE = "${PN}.elf"
+QB_DEFAULT_FSTYPE = "elf"
+QB_NETWORK_DEVICE = "none"
+QB_NET = "none"
+
+IMAGE_LINK_NAME = "${PN}-image-${MACHINE}"
+
+# Create a link with "-image-" in the name just to keep runqemu happy
+QEMU_IMAGE_LINK = "${DEPLOY_DIR_IMAGE}/${PN}-image-${MACHINE}.elf"
+
+# qemuboot writes into IMGDEPLOYDIR, force to write to DEPLOY_DIR_IMAGE
+IMGDEPLOYDIR = "${DEPLOY_DIR_IMAGE}"
+
+CLEANFUNCS += "bootconf_clean"
+
+python bootconf_clean() {
+    import glob
+    files = glob.glob(d.getVar('IMGDEPLOYDIR', True)+'/'+ d.getVar('PN', True) + '*.qemuboot.conf')
+    for f in files:
+        os.remove(f)
+
+    qemuimage_link = d.getVar('QEMU_IMAGE_LINK', True)
+    if os.path.lexists(qemuimage_link):
+        os.remove(qemuimage_link)
+}
+
+python do_bootconf_write() {
+    bb.build.exec_func("write_qemuboot_conf", d)
+
+    qemuimage = "%s/%s.elf" % (d.getVar('DEPLOY_DIR_IMAGE', True), d.getVar('PN', True))
+    qemuimage_link = d.getVar('QEMU_IMAGE_LINK', True)
+    if os.path.lexists(qemuimage_link):
+        os.remove(qemuimage_link)
+    os.symlink(os.path.basename(qemuimage), qemuimage_link)
+}
+
+addtask do_bootconf_write before do_build after do_deploy
Signature · 1 line
2.7.4