Skip to contentSkip to conversation

mcextend: Add helper class useful for multiconfig

PATCH New Richard Purdie 1 participant 2 messages Mar 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mcextend: Add helper class useful for multiconfig

This class allows users to easily create multiconfig BBCLASSEXTEND recipes and is generally useful. It will be used by new tests so add as a general feature.

---
 meta/classes/mcextend.bbclass | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 meta/classes/mcextend.bbclass
meta/classes/mcextend.bbclass new file +16 -0
new file mode 100644
index 00000000000..0f8f9622986
@@ -0,0 +1,16 @@
+python mcextend_virtclass_handler () {
+    cls = e.data.getVar("BBEXTENDCURR")
+    variant = e.data.getVar("BBEXTENDVARIANT")
+    if cls != "mcextend" or not variant:
+        return
+
+    override = ":virtclass-mcextend-" + variant
+
+    e.data.setVar("PN", e.data.getVar("PN", False) + "-" + variant)
+    e.data.setVar("MCNAME", variant)
+    e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
+}
+
+addhandler mcextend_virtclass_handler
+mcextend_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
+
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 selftest: Add multiconfig test

Add a test for a multiconfig build which mixes tiny and musl builds along with using the mcextend class to combine and package multiple images into another image. This gives the multiconfig a decent test in a scenario users may use.

---
 .../multiconfig-image-packager_0.1.bb         | 25 +++++++++++
 meta/lib/oeqa/selftest/cases/multiconfig.py   | 43 +++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 meta-selftest/recipes-test/mulitconfig/multiconfig-image-packager_0.1.bb
 create mode 100644 meta/lib/oeqa/selftest/cases/multiconfig.py
meta-selftest/recipes-test/mulitconfig/multiconfig-image-packager_0.1.bb new file +25 -0
new file mode 100644
index 00000000000..ad18d865c82
@@ -0,0 +1,25 @@
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+MCMACHINE_virtclass-mcextend-musl = "qemux86-64"
+MCMACHINE_virtclass-mcextend-tiny = "qemux86"
+MCIMGTYPE_virtclass-mcextend-musl = "ext4"
+MCIMGTYPE_virtclass-mcextend-tiny = "cpio.gz"
+
+MC_DEPLOY_DIR_IMAGE = "${TOPDIR}/tmp-mc-${MCNAME}/deploy/images/${MCMACHINE}"
+
+do_install[mcdepends] += "multiconfig::${MCNAME}:core-image-minimal:do_image_complete multiconfig::${MCNAME}:virtual/kernel:do_deploy"
+
+do_install () {
+    install -d ${D}/var/lib/machines/${MCNAME}
+    install ${MC_DEPLOY_DIR_IMAGE}/core-image-minimal-${MCMACHINE}.${MCIMGTYPE} ${D}/var/lib/machines/${MCNAME}/core-image-minimal.${MCIMGTYPE}
+    install ${MC_DEPLOY_DIR_IMAGE}/bzImage ${D}/var/lib/machines/${MCNAME}
+}
+
+python () {
+    mcname = d.getVar('MCNAME')
+    if not mcname:
+        raise bb.parse.SkipRecipe("Not a multiconfig target")
+}
+
+BBCLASSEXTEND = "mcextend:tiny mcextend:musl"
\ No newline at end of file
meta/lib/oeqa/selftest/cases/multiconfig.py new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.20.1