* [wic][PATCH 01/14] image-wic: move wic-related code to image-wic
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 02/14] grub-efi: set default desination dir Ed Bartosh
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
There is a lot of wic code in image.bbclass and image_types.bbclass
Having all code in one place should make it more readable and easier
to maintain.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/image-wic.bbclass | 113 +++++++++++++++++++++++++++++++++++++++
meta/classes/image.bbclass | 25 +--------
meta/classes/image_types.bbclass | 89 ------------------------------
3 files changed, 115 insertions(+), 112 deletions(-)
create mode 100644 meta/classes/image-wic.bbclass
diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass
new file mode 100644
index 0000000..bf94e2d
--- /dev/null
+++ b/meta/classes/image-wic.bbclass
@@ -0,0 +1,113 @@
+WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
+WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
+WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.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 ''}"
+
+# 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 HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS WORKDIR"
+
+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_TARGET}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS}
+ mv "$out/build/$(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}"
+
+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')
+
+ 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_TARGET')
+ outdir = os.path.join(stdir, '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'
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 04fd5f9..0deef54 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -189,6 +189,8 @@ python () {
IMAGE_CLASSES += "image_types"
inherit ${IMAGE_CLASSES}
+inherit image-wic
+
IMAGE_POSTPROCESS_COMMAND ?= ""
# some default locales
@@ -329,29 +331,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_TARGET')
- outdir = os.path.join(stdir, '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')
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 8f04849..4f81d1a 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -184,92 +184,6 @@ IMAGE_CMD_ubi () {
IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ubifs ${MKUBIFS_ARGS}"
-WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
-WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
-WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.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_TARGET}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS}
- mv "$out/build/$(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}"
-
-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')
-
- 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)
-}
-
EXTRA_IMAGECMD = ""
inherit siteinfo
@@ -367,6 +281,3 @@ IMAGE_EXTENSION_live = "hddimg iso"
# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hdddirect, hddimg, iso, etc.
IMAGE_TYPES_MASKED ?= ""
-# 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 HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS"
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 02/14] grub-efi: set default desination dir
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 01/14] image-wic: move wic-related code to image-wic Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 03/14] systemd-boot: " Ed Bartosh
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/grub-efi.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 3dc9146..48b4b34 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -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}
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 03/14] systemd-boot: set default desination dir
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 01/14] image-wic: move wic-related code to image-wic Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 02/14] grub-efi: set default desination dir Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 04/14] image-wic.bbclas: add task do_efi_populate Ed Bartosh
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/systemd-boot.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 6718783..6746886 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -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"
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 04/14] image-wic.bbclas: add task do_efi_populate
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (2 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 03/14] systemd-boot: " Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 05/14] grub-efi: make do_efi_populate depend on do_deploy Ed Bartosh
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/image-wic.bbclass | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass
index bf94e2d..ba6d8ae 100644
--- a/meta/classes/image-wic.bbclass
+++ b/meta/classes/image-wic.bbclass
@@ -111,3 +111,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
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 05/14] grub-efi: make do_efi_populate depend on do_deploy
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (3 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 04/14] image-wic.bbclas: add task do_efi_populate Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 06/14] systemd-boot: " Ed Bartosh
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
Added dependency do_efi_populate -> grub-efi:do_deploy to make
sure EFI artifacts are depfloyed.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/grub-efi.bbclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 48b4b34..d00fa6c 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -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"
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 06/14] systemd-boot: make do_efi_populate depend on do_deploy
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (4 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 05/14] grub-efi: make do_efi_populate depend on do_deploy Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 07/14] wic: use EFI artifacts from $WORKDIR/efi Ed Bartosh
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
Added dependency do_efi_populate -> systemd-boot:do_deploy to make
sure EFI artifacts are depfloyed.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/systemd-boot.bbclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 6746886..b2c808d 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -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"
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 07/14] wic: use EFI artifacts from $WORKDIR/efi
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (5 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 06/14] systemd-boot: " Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 08/14] image-wic: add task do_build_iso Ed Bartosh
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 305e910..1d5e73f 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -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)
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 08/14] image-wic: add task do_build_iso
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (6 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 07/14] wic: use EFI artifacts from $WORKDIR/efi Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 09/14] wic: use INITRD_LIVE in isoimage-isohybrid Ed Bartosh
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/image-wic.bbclass | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass
index ba6d8ae..370eba8 100644
--- a/meta/classes/image-wic.bbclass
+++ b/meta/classes/image-wic.bbclass
@@ -131,3 +131,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
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 09/14] wic: use INITRD_LIVE in isoimage-isohybrid
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (7 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 08/14] image-wic: add task do_build_iso Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 10/14] wic: isoimage-isohybrid: stop using HDDDIR Ed Bartosh
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/image-wic.bbclass | 2 +-
meta/lib/oeqa/selftest/wic.py | 2 +-
scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass
index 370eba8..df021ec 100644
--- a/meta/classes/image-wic.bbclass
+++ b/meta/classes/image-wic.bbclass
@@ -5,7 +5,7 @@ WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or
# 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 HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS WORKDIR"
+WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS WORKDIR"
def wks_search(files, search_path):
for f in files:
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 49bbfe3..b187d4f 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -351,7 +351,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
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 3858fd4..3c43f5b 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -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:
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 10/14] wic: isoimage-isohybrid: stop using HDDDIR
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (8 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 09/14] wic: use INITRD_LIVE in isoimage-isohybrid Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 11/14] image-wic: remove HDDDIR from WICVARS Ed Bartosh
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 3c43f5b..8bc9dea 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -298,12 +298,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")
@@ -332,9 +328,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)
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 11/14] image-wic: remove HDDDIR from WICVARS
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (9 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 10/14] wic: isoimage-isohybrid: stop using HDDDIR Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 12/14] isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH Ed Bartosh
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
Removed HDDDIR as it's not used by wic anymore.
Stopped usage of HDDDIR in wic test suite.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/image-wic.bbclass | 2 +-
meta/lib/oeqa/selftest/wic.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass
index df021ec..c2a3981 100644
--- a/meta/classes/image-wic.bbclass
+++ b/meta/classes/image-wic.bbclass
@@ -5,7 +5,7 @@ WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or
# 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 HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS WORKDIR"
+WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS WORKDIR"
def wks_search(files, search_path):
for f in files:
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index b187d4f..82f4206 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -350,8 +350,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
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 12/14] isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (10 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 11/14] image-wic: remove HDDDIR from WICVARS Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 13/14] selftest: stop using hddimg in the wic test suite Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 14/14] selftest: wic: fix test_iso_image test case Ed Bartosh
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/classes/image-wic.bbclass | 2 +-
scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass
index c2a3981..7478f76 100644
--- a/meta/classes/image-wic.bbclass
+++ b/meta/classes/image-wic.bbclass
@@ -5,7 +5,7 @@ WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or
# 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 IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS WORKDIR"
+WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH WORKDIR"
def wks_search(files, search_path):
for f in files:
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 8bc9dea..f90bfce 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -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
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 13/14] selftest: stop using hddimg in the wic test suite
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (11 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 12/14] isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
2017-01-16 15:46 ` [wic][PATCH 14/14] selftest: wic: fix test_iso_image test case Ed Bartosh
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
Removed hddimg from IMAGE_FEATURES as wic code doesn't
use hddimg anymore.
[YOCTO #10835]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/lib/oeqa/selftest/wic.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 82f4206..3ccd1c4 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -43,8 +43,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'
'WKS_FILE = "wic-image-minimal"\n')
# Do this here instead of in setUpClass as the base setUp does some
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread* [wic][PATCH 14/14] selftest: wic: fix test_iso_image test case
2017-01-16 15:46 [wic][PATCH 00/14] Fix for #10835 - WIC should not rely on hddimg creation for finding all needed artifacts Ed Bartosh
` (12 preceding siblings ...)
2017-01-16 15:46 ` [wic][PATCH 13/14] selftest: stop using hddimg in the wic test suite Ed Bartosh
@ 2017-01-16 15:46 ` Ed Bartosh
13 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-01-16 15:46 UTC (permalink / raw)
To: openembedded-core
Added "iso" to IMAGE_FSTYPES to build iso artifacts required
to fix test of isoimage-isohybrid wic plugin.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
meta/lib/oeqa/selftest/wic.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 3ccd1c4..f18eaaf 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -43,7 +43,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'
'WKS_FILE = "wic-image-minimal"\n')
# Do this here instead of in setUpClass as the base setUp does some
--
2.1.4
^ permalink raw reply related [flat|nested] 15+ messages in thread