Skip to contentSkip to conversation

Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts

PATCH Superseded Ed Bartosh 2 participants 16 messages Jan 26, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

v2 cover Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts

Hi,

This patchset usage of hddimg from wic codebase due to planned deprecation of hddimg.

Wic used hddimg to get 2 types of artifacts - efi and iso artifacts. To get rid of using hddimg 2 new tasks was added to build efi and iso artifacts. This removes dependency to hddimg and also speeds up wic image creation as producing efi and iso artifacts is faster than building hddimg.

While working on this wic-related code in meta/classes/ has been moved to image-wic.bbclass to make it more maintainable.

Changes in v2: rebased on top of ross/mut

The following changes since commit 70c6fa0f9eefa2233cbdcbba5271d57a74393471:

selftest: wic: split test_debug test case (2017-01-26 13:27:34 +0200)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib ed/wic/wip
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/wip

Ed Bartosh (14):
image-wic: move wic code to image-wic.bbclass
grub-efi: set default desination dir
systemd-boot: set default desination dir
image-wic.bbclas: add task do_efi_populate
grub-efi: make do_efi_populate depend on do_deploy
systemd-boot: make do_efi_populate depend on do_deploy
wic: use EFI artifacts from $WORKDIR/efi
image-wic: add task do_build_iso
wic: use INITRD_LIVE in isoimage-isohybrid
wic: isoimage-isohybrid: stop using HDDDIR
image-wic: remove HDDDIR from WICVARS
isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH
selftest: stop using hddimg in the wic test suite
selftest: wic: fix test_iso_image test case

 meta/classes/grub-efi.bbclass                      |   3 +-
 meta/classes/image-wic.bbclass                     | 149 +++++++++++++++++++++
 meta/classes/image.bbclass                         |  25 +---
 meta/classes/image_types.bbclass                   |  95 -------------
 meta/classes/systemd-boot.bbclass                  |   3 +-
 meta/lib/oeqa/selftest/wic.py                      |   6 +-
 scripts/lib/wic/plugins/source/bootimg-efi.py      |   4 +-
 .../lib/wic/plugins/source/isoimage-isohybrid.py   |  20 +--
 8 files changed, 166 insertions(+), 139 deletions(-)
 create mode 100644 meta/classes/image-wic.bbclass

--
Regards,
Ed

author
#1 lore raw

PATCH v2 1/14 image-wic: move wic code to image-wic.bbclass

There is a lot of wic code in image.bbclass and image_types.bbclass Having all code separated in one file should make it more readable and easier to maintain.

---
 meta/classes/image-wic.bbclass   | 120 +++++++++++++++++++++++++++++++++++++++
 meta/classes/image.bbclass       |  25 +-------
 meta/classes/image_types.bbclass |  95 -------------------------------
 3 files changed, 122 insertions(+), 118 deletions(-)
 create mode 100644 meta/classes/image-wic.bbclass
meta/classes/image-wic.bbclass new file +120 -0
new file mode 100644
index 0000000..2acfd65
@@ -0,0 +1,120 @@
+# The WICVARS variable is used to define list of bitbake variables used in wic code
+# variables from this list is written to <image>.env file
+WICVARS ?= "\
+           BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES \
+           IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH RECIPE_SYSROOT_NATIVE \
+           ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS"
+
+WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
+WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
+WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/wic' % p for p in '${BBPATH}'.split(':'))}:${@':'.join('%s/scripts/lib/wic/canned-wks' % l for l in '${BBPATH}:${COREBASE}'.split(':'))}"
+WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or ''}"
+
+def wks_search(files, search_path):
+    for f in files:
+        if os.path.isabs(f):
+            if os.path.exists(f):
+                return f
+        else:
+            searched = bb.utils.which(search_path, f)
+            if searched:
+                return searched
+
+WIC_CREATE_EXTRA_ARGS ?= ""
+
+IMAGE_CMD_wic () {
+	out="${IMGDEPLOYDIR}/${IMAGE_NAME}"
+	wks="${WKS_FULL_PATH}"
+	if [ -z "$wks" ]; then
+		bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
+	fi
+
+	BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS}
+	mv "$out/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
+	rm -rf "$out/"
+}
+IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES"
+
+# Rebuild when the wks file or vars in WICVARS change
+USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
+WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
+do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
+do_image_wic[depends] += "wic-tools:do_build"
+
+python () {
+    if d.getVar('USING_WIC') and 'do_bootimg' in d:
+        bb.build.addtask('do_image_wic', '', 'do_bootimg', d)
+}
+
+python do_write_wks_template () {
+    """Write out expanded template contents to WKS_FULL_PATH."""
+    import re
+
+    template_body = d.getVar('_WKS_TEMPLATE')
+
+    # Remove any remnant variable references left behind by the expansion
+    # due to undefined variables
+    expand_var_regexp = re.compile(r"\${[^{}@\n\t :]+}")
+    while True:
+        new_body = re.sub(expand_var_regexp, '', template_body)
+        if new_body == template_body:
+            break
+        else:
+            template_body = new_body
+
+    wks_file = d.getVar('WKS_FULL_PATH')
+    with open(wks_file, 'w') as f:
+        f.write(template_body)
+}
+
+python () {
+    if d.getVar('USING_WIC'):
+        wks_file_u = d.getVar('WKS_FULL_PATH', False)
+        wks_file = d.expand(wks_file_u)
+        base, ext = os.path.splitext(wks_file)
+        if ext == '.in' and os.path.exists(wks_file):
+            wks_out_file = os.path.join(d.getVar('WORKDIR'), os.path.basename(base))
+            d.setVar('WKS_FULL_PATH', wks_out_file)
+            d.setVar('WKS_TEMPLATE_PATH', wks_file_u)
+            d.setVar('WKS_FILE_CHECKSUM', '${WKS_TEMPLATE_PATH}:True')
+
+            # We need to re-parse each time the file changes, and bitbake
+            # needs to be told about that explicitly.
+            bb.parse.mark_dependency(d, wks_file)
+
+            try:
+                with open(wks_file, 'r') as f:
+                    body = f.read()
+            except (IOError, OSError) as exc:
+                pass
+            else:
+                # Previously, I used expandWithRefs to get the dependency list
+                # and add it to WICVARS, but there's no point re-parsing the
+                # file in process_wks_template as well, so just put it in
+                # a variable and let the metadata deal with the deps.
+                d.setVar('_WKS_TEMPLATE', body)
+                bb.build.addtask('do_write_wks_template', 'do_image_wic', None, d)
+}
+
+#
+# Write environment variables used by wic
+# to tmp/sysroots/<machine>/imgdata/<image>.env
+#
+python do_rootfs_wicenv () {
+    wicvars = d.getVar('WICVARS')
+    if not wicvars:
+        return
+
+    stdir = d.getVar('STAGING_DIR')
+    outdir = os.path.join(stdir, d.getVar('MACHINE'), 'imgdata')
+    bb.utils.mkdirhier(outdir)
+    basename = d.getVar('IMAGE_BASENAME')
+    with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
+        for var in wicvars.split():
+            value = d.getVar(var)
+            if value:
+                envf.write('%s="%s"\n' % (var, value.strip()))
+}
+addtask do_rootfs_wicenv after do_image before do_image_wic
+do_rootfs_wicenv[vardeps] += "${WICVARS}"
+do_rootfs_wicenv[prefuncs] = 'set_image_size'
meta/classes/image.bbclass +2 -23
index 13fd996..1a549e9 100644
@@ -192,6 +192,8 @@ python () {
 IMAGE_CLASSES += "image_types"
 inherit ${IMAGE_CLASSES}
 
+inherit image-wic
+
 IMAGE_POSTPROCESS_COMMAND ?= ""
 
 # some default locales
@@ -332,29 +334,6 @@ fakeroot python do_image_qa () {
 }
 addtask do_image_qa after do_image_complete before do_build
 
-#
-# Write environment variables used by wic
-# to tmp/sysroots/<machine>/imgdata/<image>.env
-#
-python do_rootfs_wicenv () {
-    wicvars = d.getVar('WICVARS')
-    if not wicvars:
-        return
-
-    stdir = d.getVar('STAGING_DIR')
-    outdir = os.path.join(stdir, d.getVar('MACHINE'), 'imgdata')
-    bb.utils.mkdirhier(outdir)
-    basename = d.getVar('IMAGE_BASENAME')
-    with open(os.path.join(outdir, basename) + '.env', 'w') as envf:
-        for var in wicvars.split():
-            value = d.getVar(var)
-            if value:
-                envf.write('%s="%s"\n' % (var, value.strip()))
-}
-addtask do_rootfs_wicenv after do_image before do_image_wic
-do_rootfs_wicenv[vardeps] += "${WICVARS}"
-do_rootfs_wicenv[prefuncs] = 'set_image_size'
-
 def setup_debugfs_variables(d):
     d.appendVar('IMAGE_ROOTFS', '-dbg')
     d.appendVar('IMAGE_LINK_NAME', '-dbg')
meta/classes/image_types.bbclass +0 -95

104 lines not on this page · raw message

Signature · 1 line
2.1.4
author
#2 lore raw

PATCH v2 2/14 grub-efi: set default desination dir

In reply to Ed Bartosh

Function efi_populate requires mandatory parameter DESTDIR. It makes it impossible to call this function from python code using bb.build.exec_func as there is no way to pass parameters this way.

Set default value of DESTDIR to ${WORKDIR}/efi. This destination will be used in image-wic.bbclass to install EFI artifacts.

---
 meta/classes/grub-efi.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/grub-efi.bbclass +1 -1
index 3dc9146..48b4b34 100644
@@ -36,7 +36,7 @@ inherit fs-uuid
 efi_populate() {
 	# DEST must be the root of the image so that EFIDIR is not
 	# nested under a top level directory.
-	DEST=$1
+	DEST=${1-${WORKDIR}/efi}
 
 	install -d ${DEST}${EFIDIR}
 
Signature · 1 line
2.1.4
author
#3 lore raw

PATCH v2 3/14 systemd-boot: set default desination dir

In reply to Ed Bartosh

Function efi_populate requires mandatory parameter DESTDIR. It makes it impossible to call this function from python code using bb.build.exec_func as there is no way to pass parameters this way.

Set default value of DESTDIR to ${WORKDIR}/efi. This destination will be used in image-wic.bbclass to install EFI artifacts.

---
 meta/classes/systemd-boot.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/systemd-boot.bbclass +1 -1
index 6a2cbc8..1405310 100644
@@ -22,7 +22,7 @@ SYSTEMD_BOOT_TIMEOUT ?= "10"
 inherit fs-uuid
 
 efi_populate() {
-        DEST=$1
+        DEST=${1-${WORKDIR}/efi}
 
         EFI_IMAGE="systemd-bootia32.efi"
         DEST_EFI_IMAGE="bootia32.efi"
Signature · 1 line
2.1.4
author
#4 lore raw

PATCH v2 4/14 image-wic.bbclas: add task do_efi_populate

In reply to Ed Bartosh

Produce EFI artifacts by calling efi_populate function provided by current EFI provider.

This should eliminate dependency of wic image-efi plugin to hddimg. Instead of getting EFI artifacts from HDDDIR it can get it from $WORKDIR/efi.

[YOCTO #10835]

---
 meta/classes/image-wic.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
meta/classes/image-wic.bbclass +20 -0
index 2acfd65..41b406d 100644
@@ -118,3 +118,23 @@ python do_rootfs_wicenv () {
 addtask do_rootfs_wicenv after do_image before do_image_wic
 do_rootfs_wicenv[vardeps] += "${WICVARS}"
 do_rootfs_wicenv[prefuncs] = 'set_image_size'
+
+# Populate EFI artifacts
+
+EFI_PROVIDER ?= "grub-efi"
+
+EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
+inherit ${EFI_CLASS}
+
+python do_efi_populate() {
+    if d.getVar("EFI_CLASS"):
+        # set variables required for populating efi artifacts
+        for key, value in [('LABELS', "boot"), ('GRUB_CFG', "grub-wic.cfg")]:
+            if not d.getVar(key):
+                d.setVar(key, value)
+
+        bb.build.exec_func('build_efi_cfg', d)
+        bb.build.exec_func('efi_populate', d)
+}
+
+addtask do_efi_populate after do_rootfs before do_image
Signature · 1 line
2.1.4
author
#5 lore raw

PATCH v2 5/14 grub-efi: make do_efi_populate depend on do_deploy

In reply to Ed Bartosh

Added dependency do_efi_populate -> grub-efi:do_deploy to make sure EFI artifacts are depfloyed.

---
 meta/classes/grub-efi.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/grub-efi.bbclass +1 -0
index 48b4b34..d00fa6c 100644
@@ -18,6 +18,7 @@
 
 do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy"
 do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy"
+do_efi_populate[depends] += "${MLPREFIX}grub-efi:do_deploy"
 
 GRUB_SERIAL ?= "console=ttyS0,115200"
 GRUB_CFG_VM = "${S}/grub_vm.cfg"
Signature · 1 line
2.1.4
author
#6 lore raw

PATCH v2 6/14 systemd-boot: make do_efi_populate depend on do_deploy

In reply to Ed Bartosh

Added dependency do_efi_populate -> systemd-boot:do_deploy to make sure EFI artifacts are depfloyed.

---
 meta/classes/systemd-boot.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/systemd-boot.bbclass +1 -0
index 1405310..54b8790 100644
@@ -11,6 +11,7 @@
 
 do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
 do_bootdirectdisk[depends] += "${MLPREFIX}systemd-boot:do_deploy"
+do_efi_populate[depends] += "${MLPREFIX}systemd-boot:do_deploy"
 
 EFIDIR = "/EFI/BOOT"
 
Signature · 1 line
2.1.4
author
#7 lore raw

PATCH v2 7/14 wic: use EFI artifacts from $WORKDIR/efi

In reply to Ed Bartosh

Made bootimg-efi to use EFI artifacts from $WORKDIR/efi instead of $HDDDIR. This should eliminate its dependency on hddimg functionality which is going to be removed soon.

[YOCTO #10835]

---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
scripts/lib/wic/plugins/source/bootimg-efi.py +1 -3
index 305e910..1d5e73f 100644
@@ -167,9 +167,7 @@ class BootimgEFIPlugin(SourcePlugin):
         In this case, prepare content for an EFI (grub) boot partition.
         """
         if not bootimg_dir:
-            bootimg_dir = get_bitbake_var("HDDDIR")
-            if not bootimg_dir:
-                msger.error("Couldn't find HDDDIR, exiting\n")
+            bootimg_dir = os.path.join(get_bitbake_var("WORKDIR"), "efi")
             # just so the result notes display it
             creator.set_bootimg_dir(bootimg_dir)
 
Signature · 1 line
2.1.4
author
#8 lore raw

PATCH v2 8/14 image-wic: add task do_build_iso

In reply to Ed Bartosh

This task is needed to provide iso artifacts for isoimage-isohybrid wic plugin. Currently this pluing uses hddimg, which is going to be dropped from the codebase soon.

[YOCTO #10835]

---
 meta/classes/image-wic.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/image-wic.bbclass +9 -0
index 41b406d..bde17a3 100644
@@ -138,3 +138,12 @@ python do_efi_populate() {
 }
 
 addtask do_efi_populate after do_rootfs before do_image
+
+# Build iso artifacts
+
+python do_build_iso() {
+    # do_bootimage calls build_iso, check to avoid building twice
+    if 'do_bootimg' not in d and d.getVar('IMG_LIVE_CLASS'):
+        bb.build.exec_func('build_iso', d)
+}
+addtask do_build_iso after do_image before do_image_wic
Signature · 1 line
2.1.4
author
#9 lore raw

PATCH v2 9/14 wic: use INITRD_LIVE in isoimage-isohybrid

In reply to Ed Bartosh

INITRD variable is not set if hddimg is disabled. isoimage-isohybrid can't get correct name for initrd if INITRD variable is not set.

Added INITRD_LIVE to WICVARS and used it in isoimage-isohybrid code to get initrd artifact name. Used INITRD if INITRD_LIVE is not set.

---
 meta/classes/image-wic.bbclass                       | 4 ++--
 meta/lib/oeqa/selftest/wic.py                        | 2 +-
 scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
meta/classes/image-wic.bbclass +2 -2
index bde17a3..df9f33a 100644
@@ -2,8 +2,8 @@
 # variables from this list is written to <image>.env file
 WICVARS ?= "\
            BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES \
-           IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH RECIPE_SYSROOT_NATIVE \
-           ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS"
+           IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH \
+           RECIPE_SYSROOT_NATIVE ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS"
 
 WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
 WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
meta/lib/oeqa/selftest/wic.py +1 -1
index 9784a68..8415c69 100644
@@ -365,7 +365,7 @@ class Wic(oeSelfTest):
         wicvars = set(get_bb_var('WICVARS', image).split())
         # filter out optional variables
         wicvars = wicvars.difference(('HDDDIR', 'IMAGE_BOOT_FILES',
-                                      'INITRD', 'ISODIR'))
+                                      'INITRD', 'INITRD_LIVE', 'ISODIR'))
         with open(path) as envfile:
             content = dict(line.split("=", 1) for line in envfile)
             # test if variables used by wic present in the .env file
scripts/lib/wic/plugins/source/isoimage-isohybrid.py +1 -1
index a8a5dc0..fd25190 100644
@@ -144,7 +144,7 @@ class IsoImagePlugin(SourcePlugin):
         Create path for initramfs image
         """
 
-        initrd = get_bitbake_var("INITRD")
+        initrd = get_bitbake_var("INITRD_LIVE") or get_bitbake_var("INITRD")
         if not initrd:
             initrd_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
             if not initrd_dir:
Signature · 1 line
2.1.4
author
#10 lore raw

PATCH v2 10/14 wic: isoimage-isohybrid: stop using HDDDIR

In reply to Ed Bartosh

Stop using HDDDIR in isoimage-isohybrid wic plugin. This variable is set by hddimg code, which is going to be removed soon.

All required artifacts should be available from ISODIR. wic-image.bbclass has been modified to build iso artifacts, so it should be safe to remove usage of HDDDIR.

[YOCTO #10835]

---
 scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
scripts/lib/wic/plugins/source/isoimage-isohybrid.py +2 -8
index fd25190..a637ce5 100644
@@ -249,12 +249,8 @@ class IsoImagePlugin(SourcePlugin):
         part.rootfs_dir = rootfs_dir
 
         # Prepare rootfs.img
-        hdd_dir = get_bitbake_var("HDDDIR")
         img_iso_dir = get_bitbake_var("ISODIR")
-
-        rootfs_img = "%s/rootfs.img" % hdd_dir
-        if not os.path.isfile(rootfs_img):
-            rootfs_img = "%s/rootfs.img" % img_iso_dir
+        rootfs_img = "%s/rootfs.img" % img_iso_dir
         if not os.path.isfile(rootfs_img):
             # check if rootfs.img is in deploydir
             deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
@@ -283,9 +279,7 @@ class IsoImagePlugin(SourcePlugin):
             os.remove(part.source_file)
 
         # Prepare initial ramdisk
-        initrd = "%s/initrd" % hdd_dir
-        if not os.path.isfile(initrd):
-            initrd = "%s/initrd" % img_iso_dir
+        initrd = "%s/initrd" % img_iso_dir
         if not os.path.isfile(initrd):
             initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir)
 
Signature · 1 line
2.1.4
author
#11 lore raw

PATCH v2 11/14 image-wic: remove HDDDIR from WICVARS

In reply to Ed Bartosh

Removed HDDDIR as it's not used by wic anymore.
Stopped usage of HDDDIR in wic test suite.

---
 meta/classes/image-wic.bbclass | 2 +-
 meta/lib/oeqa/selftest/wic.py  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
meta/classes/image-wic.bbclass +1 -1
index df9f33a..be3e6d4 100644
@@ -1,7 +1,7 @@
 # The WICVARS variable is used to define list of bitbake variables used in wic code
 # variables from this list is written to <image>.env file
 WICVARS ?= "\
-           BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES \
+           BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \
            IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH \
            RECIPE_SYSROOT_NATIVE ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS"
 
meta/lib/oeqa/selftest/wic.py +2 -2
index 8415c69..4843060 100644
@@ -364,8 +364,8 @@ class Wic(oeSelfTest):
 
         wicvars = set(get_bb_var('WICVARS', image).split())
         # filter out optional variables
-        wicvars = wicvars.difference(('HDDDIR', 'IMAGE_BOOT_FILES',
-                                      'INITRD', 'INITRD_LIVE', 'ISODIR'))
+        wicvars = wicvars.difference(('IMAGE_BOOT_FILES', 'INITRD',
+                                      'INITRD_LIVE', 'ISODIR'))
         with open(path) as envfile:
             content = dict(line.split("=", 1) for line in envfile)
             # test if variables used by wic present in the .env file
Signature · 1 line
2.1.4
author
#12 lore raw

PATCH v2 12/14 isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH

In reply to Ed Bartosh

isoimage-sihybrid plugin uses MACHINE_ARCH to get the name of initrd image. It doesn't work for all machines, for example for quemux86-64 machine MACHINE_ARCH is quemux86_64 and initrd name is core-image-minimal-initramfs-qemux86-64.cpio.gz

Used TRANSLATED_TARGET_ARCH variable to get the initrd image name. Replaced MACHINE_ARCH->TRANSLATED_TARGET_ARCH in WICVARS variable to make it available from <image>.env file.

---
 meta/classes/image-wic.bbclass                       | 4 ++--
 scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
meta/classes/image-wic.bbclass +2 -2
index be3e6d4..264017f 100644
@@ -2,8 +2,8 @@
 # variables from this list is written to <image>.env file
 WICVARS ?= "\
            BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \
-           IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH \
-           RECIPE_SYSROOT_NATIVE ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS"
+           IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
+           ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH"
 
 WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
 WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
scripts/lib/wic/plugins/source/isoimage-isohybrid.py +4 -4
index a637ce5..afd6fa9 100644
@@ -158,11 +158,11 @@ class IsoImagePlugin(SourcePlugin):
             if not image_type:
                 msger.error("Couldn't find INITRAMFS_FSTYPES, exiting.\n")
 
-            machine_arch = get_bitbake_var("MACHINE_ARCH")
-            if not machine_arch:
-                msger.error("Couldn't find MACHINE_ARCH, exiting.\n")
+            target_arch = get_bitbake_var("TRANSLATED_TARGET_ARCH")
+            if not target_arch:
+                msger.error("Couldn't find TRANSLATED_TARGET_ARCH, exiting.\n")
 
-            initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, machine_arch, image_type))[0]
+            initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, target_arch, image_type))[0]
 
         if not os.path.exists(initrd):
             # Create initrd from rootfs directory
Signature · 1 line
2.1.4
author
#13 lore raw

PATCH v2 13/14 selftest: stop using hddimg in the wic test suite

In reply to Ed Bartosh

Removed hddimg from IMAGE_FEATURES as wic code doesn't use hddimg anymore.

[YOCTO #10835]

---
 meta/lib/oeqa/selftest/wic.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/lib/oeqa/selftest/wic.py +1 -2
index 4843060..7d5df57 100644
@@ -42,8 +42,7 @@ class Wic(oeSelfTest):
 
     def setUpLocal(self):
         """This code is executed before each test method."""
-        self.write_config('IMAGE_FSTYPES += " hddimg"\n'
-                          'MACHINE_FEATURES_append = " efi"\n')
+        self.write_config('MACHINE_FEATURES_append = " efi"\n')
 
         # Do this here instead of in setUpClass as the base setUp does some
         # clean up which can result in the native tools built earlier in
Signature · 1 line
2.1.4
author
#14 lore raw

PATCH v2 14/14 selftest: wic: fix test_iso_image test case

In reply to Ed Bartosh

Added "iso" to IMAGE_FSTYPES to build iso artifacts required to fix test of isoimage-isohybrid wic plugin.

---
 meta/lib/oeqa/selftest/wic.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/wic.py +2 -1
index 7d5df57..ea26200 100644
@@ -42,7 +42,8 @@ class Wic(oeSelfTest):
 
     def setUpLocal(self):
         """This code is executed before each test method."""
-        self.write_config('MACHINE_FEATURES_append = " efi"\n')
+        self.write_config('IMAGE_FSTYPES = "iso"\n'
+                          'MACHINE_FEATURES_append = " efi"\n')
 
         # Do this here instead of in setUpClass as the base setUp does some
         # clean up which can result in the native tools built earlier in
Signature · 1 line
2.1.4
#15 lore raw

✗ patchtest: failure for Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts (rev2)

In reply to Ed Bartosh

== Series Details ==

Series: Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts (rev2)
Revision: 2
URL : https://patchwork.openembedded.org/series/4802/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at a99cca0e8e)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe