[OE-core] [wic][PATCH 00/14] 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. This dependency is resolved by introducing new tasks to build efi and iso artifacts. This removes dependency to hddimg and also speeds up wic image creation as producing 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. The following changes since commit 2d1a68265cda3ad8f36f1d2138c308e9b08114f6: wic: _exec_cmd: produce error if exit code is not 0 (2017-01-16 17:26:21 +0200) are available in the git repository at: git://git.yoctoproject.org/poky-contrib ed/wic/dont-use-hddimg-10835 http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/dont-use-hddimg-10835 Ed Bartosh (14): image-wic: move wic-related code to image-wic 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 | 142 + meta/classes/image.bbclass | 25 +--- meta/classes/image_types.bbclass | 89 - 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, 159 insertions(+), 133 deletions(-) create mode 100644 meta/classes/image-wic.bbclass -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 01/14] image-wic: move wic-related code to image-wic
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 --- 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 000..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 .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
[OE-core] [wic][PATCH 02/14] grub-efi: set default desination dir
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 03/14] systemd-boot: set default desination dir
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 04/14] image-wic.bbclas: add task do_efi_populate
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 05/14] grub-efi: make do_efi_populate depend on do_deploy
Added dependency do_efi_populate -> grub-efi:do_deploy to make sure EFI artifacts are depfloyed. Signed-off-by: Ed Bartosh --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 08/14] image-wic: add task do_build_iso
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 06/14] systemd-boot: make do_efi_populate depend on do_deploy
Added dependency do_efi_populate -> systemd-boot:do_deploy to make sure EFI artifacts are depfloyed. Signed-off-by: Ed Bartosh --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 07/14] wic: use EFI artifacts from $WORKDIR/efi
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 10/14] wic: isoimage-isohybrid: stop using HDDDIR
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 09/14] wic: use INITRD_LIVE in isoimage-isohybrid
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 --- 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 .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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 11/14] image-wic: remove HDDDIR from WICVARS
Removed HDDDIR as it's not used by wic anymore. Stopped usage of HDDDIR in wic test suite. Signed-off-by: Ed Bartosh --- 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 .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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 12/14] isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH
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 .env file. Signed-off-by: Ed Bartosh --- 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 .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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 13/14] selftest: stop using hddimg in the wic test suite
Removed hddimg from IMAGE_FEATURES as wic code doesn't use hddimg anymore. [YOCTO #10835] Signed-off-by: Ed Bartosh --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [wic][PATCH 14/14] selftest: wic: fix test_iso_image test case
Added "iso" to IMAGE_FSTYPES to build iso artifacts required to fix test of isoimage-isohybrid wic plugin. Signed-off-by: Ed Bartosh --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] How to use WIC to generate raw flash images
On Fri, Jan 20, 2017 at 10:37:15AM -0800, Rick Altherr wrote: > For OpenBMC (based on Yocto), the target is an SoC that has an external > boot flash connected via SPI. Right now, we have a class ( > https://github.com/openbmc/openbmc/blob/master/meta-phosphor/classes/image-overlay.bbclass) > used by our top-level image recipe ( > https://github.com/openbmc/openbmc/blob/master/meta-phosphor/common/recipes-phosphor/images/obmc-phosphor-image.bb) > that manually constructs a flash image from the kernel, rootfs, etc. This is indeed very interesting work. We definitely need support of flash images in oe-core. > I'd like to move to an upstream-supported approach and I think that is WIC. > What I don't understand is: > - How do I build a raw flash image where it is divided into partitions but > has no partition table? Wic doesn't support this type of images, but it shouldn't be hard to add option to skip partitioning to .wks syntax and wic code. > - How do I set padding to be 0xFF instead of 0x00? The same thing here. Currently wic images are sparse files created by os.ftruncate, but it's not a big deal to fill them with 0xFF > - How do I include u-boot in the image? This can be done by using/extending rawcopy plugin or writing similar one. > Do I need to add a new imager plugin to support writing raw images with > non-zero padding and no partition table? For U-Boot, do I add a new > bootimg plugin? This sounds reasonable. Can you create a bug for this in bugzilla to discuss design and implementation details? -- Regards, Ed -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] How to use WIC to generate raw flash images
On Tue, Jan 24, 2017 at 09:56:17AM +0100, Mike Looijmans wrote: > On 23-01-17 11:34, Ed Bartosh wrote: > ... > >>- How do I set padding to be 0xFF instead of 0x00? > >The same thing here. Currently wic images are sparse files created by > >os.ftruncate, but it's not a big deal to fill them with 0xFF > > Correct me if I'm wrong here... > - All flash media (NOR, NAND) prefers padding with 0xFF because > that's equal to an erased sector. > - Other media (magnetic disks) don't care about what they're padded with. > > So I'd say it makes sense to make 0xFF the default padding for exerything? That would break image sparseness. -- Regards, Ed -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 0/8] Fix for #10783 wic should not be writing out to /var/tmp/wic
Hi, This patchset changes default output location for wic images from /var/tmp/wic/build to the current directory. It also includes a bit of refactoring of DirectImageCreator class. The following changes since commit 62d7d4130202d8ede16abf9e7d779361ca70847e: build-appliance-image: Update to master head revision (2017-01-23 23:32:23 +) are available in the git repository at: git://git.yoctoproject.org/poky-contrib ed/wic/default-output-dir-10783 http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/default-output-dir-10783 Ed Bartosh (8): wic: change default output directory wic: get rid of baseimager inheritance wic: make workdir a temporary directory wic: remove unused API DirectImageCreator.get_disk_names wic: direct.py: get rid of names with two underscores image_types: use correct output directory selftest: wic: explicitly specify output directory selftest: wic: test default output directory meta/classes/image_types.bbclass | 2 +- meta/lib/oeqa/selftest/wic.py| 94 - scripts/lib/wic/imager/baseimager.py | 191 --- scripts/lib/wic/imager/direct.py | 108 +--- scripts/wic | 2 +- 5 files changed, 96 insertions(+), 301 deletions(-) delete mode 100644 scripts/lib/wic/imager/baseimager.py -- Regards, Ed -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/8] wic: make workdir a temporary directory
Wic used hardcoded path /var/tmp/wic/ as a work directory, which caused conflicts if two wic instances run in parallel. Made work directory unique and temporary. Moved results from work directory to output directory when they're ready. [YOCTO #10783] Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/direct.py | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 825c9d7..63f1fa1 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -27,6 +27,7 @@ import os import shutil import uuid +import tempfile from wic import msger from wic.utils.oe.misc import get_bitbake_var @@ -79,16 +80,11 @@ class DirectImageCreator: This method takes the same arguments as ImageCreator.__init__() """ - self.name = creatoropts['name'] +self.outdir = image_output_dir +self.workdir = tempfile.mktemp(prefix='wic') self.ks = creatoropts['ks'] -self.tmpdir = "/var/tmp/wic" -self.workdir = "/var/tmp/wic/build" - -if not os.path.exists(self.tmpdir): -os.makedirs(self.tmpdir) - self.__image = None self.__disks = {} self.__disk_format = "direct" @@ -96,8 +92,6 @@ class DirectImageCreator: self.ptable_format = self.ks.bootloader.ptable self.oe_builddir = oe_builddir -if image_output_dir: -self.tmpdir = image_output_dir self.rootfs_dir = rootfs_dir self.bootimg_dir = bootimg_dir self.kernel_dir = kernel_dir @@ -270,9 +264,6 @@ class DirectImageCreator: fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) -shutil.rmtree(self.workdir) -os.mkdir(self.workdir) - for part in parts: # get rootfs size from bitbake variable if it's not set in .ks file if not part.size: @@ -425,3 +416,15 @@ class DirectImageCreator: except ImageError as err: msger.warning("%s" % err) +# Move results to the output dir +if not os.path.exists(self.outdir): +os.makedirs(self.outdir) + +for fname in os.listdir(self.workdir): +path = os.path.join(self.workdir, fname) +if os.path.isfile(path): +shutil.move(path, os.path.join(self.outdir, fname)) + +# remove work directory +shutil.rmtree(self.workdir, ignore_errors=True) + -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/8] wic: change default output directory
Set default output directory to current dir. [YOCTO #10783] Signed-off-by: Ed Bartosh --- scripts/wic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wic b/scripts/wic index 8918cb4..54cbe96 100755 --- a/scripts/wic +++ b/scripts/wic @@ -88,7 +88,7 @@ def wic_create_subcommand(args, usage_str): """ parser = optparse.OptionParser(usage=usage_str) -parser.add_option("-o", "--outdir", dest="outdir", +parser.add_option("-o", "--outdir", dest="outdir", default='.', help="name of directory to create image in") parser.add_option("-e", "--image-name", dest="image_name", help="name of the image to use the artifacts from " -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 6/8] image_types: use correct output directory
Wic put result images into /build, which was confusing. Now it's fixed in wic code and images are put into output directory. Changed code in image_types to reflect this. [YOCTO #10783] Signed-off-by: Ed Bartosh --- meta/classes/image_types.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 5b1746a..c457f38 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -217,7 +217,7 @@ IMAGE_CMD_wic () { fi BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} - mv "$out/build/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic" + mv "$out/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic" rm -rf "$out/" } IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES" -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 2/8] wic: get rid of baseimager inheritance
Simplified DirectImageCreator code by removing inheritance from BaseImageCreator. This inheritance doesn't make much sense as DirectImageCreator is the only class that was inherited from BaseImageCreator. Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/baseimager.py | 191 --- scripts/lib/wic/imager/direct.py | 19 ++-- 2 files changed, 13 insertions(+), 197 deletions(-) delete mode 100644 scripts/lib/wic/imager/baseimager.py diff --git a/scripts/lib/wic/imager/baseimager.py b/scripts/lib/wic/imager/baseimager.py deleted file mode 100644 index 1a52dd8..000 --- a/scripts/lib/wic/imager/baseimager.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2007 Red Hat Inc. -# Copyright (c) 2009, 2010, 2011 Intel, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -import os -import tempfile -import shutil - -from wic import msger -from wic.utils.errors import CreatorError -from wic.utils import runner - -class BaseImageCreator(): -"""Base class for image creation. - -BaseImageCreator is the simplest creator class available; it will -create a system image according to the supplied kickstart file. - -e.g. - - import wic.imgcreate as imgcreate - ks = imgcreate.read_kickstart("foo.ks") - imgcreate.ImageCreator(ks, "foo").create() -""" - -def __del__(self): -self.cleanup() - -def __init__(self, createopts=None): -"""Initialize an ImageCreator instance. - -ks -- a pykickstart.KickstartParser instance; this instance will be - used to drive the install by e.g. providing the list of packages - to be installed, the system configuration and %post scripts - -name -- a name for the image; used for e.g. image filenames or -filesystem labels -""" - -self.__builddir = None - -self.ks = None -self.name = "target" -self.tmpdir = "/var/tmp/wic" -self.workdir = "/var/tmp/wic/build" - -# setup tmpfs tmpdir when enabletmpfs is True -self.enabletmpfs = False - -if createopts: -# Mapping table for variables that have different names. -optmap = {"outdir" : "destdir", - } - -# update setting from createopts -for key in createopts: -if key in optmap: -option = optmap[key] -else: -option = key -setattr(self, option, createopts[key]) - -self.destdir = os.path.abspath(os.path.expanduser(self.destdir)) - -self._dep_checks = ["ls", "bash", "cp", "echo"] - -# Output image file names -self.outimage = [] - -# No ks provided when called by convertor, so skip the dependency check -if self.ks: -# If we have btrfs partition we need to check necessary tools -for part in self.ks.partitions: -if part.fstype and part.fstype == "btrfs": -self._dep_checks.append("mkfs.btrfs") -break - -# make sure the specified tmpdir and cachedir exist -if not os.path.exists(self.tmpdir): -os.makedirs(self.tmpdir) - - -# -# Hooks for subclasses -# -def _create(self): -"""Create partitions for the disk image(s) - -This is the hook where subclasses may create the partitions -that will be assembled into disk image(s). - -There is no default implementation. -""" -pass - -def _cleanup(self): -"""Undo anything performed in _create(). - -This is the hook where subclasses must undo anything which was -done in _create(). - -There is no default implementation. - -""" -pass - -# -# Actual implementation -# -def __ensure_builddir(self): -if not self.__builddir is None: -return - -try: -self.workdir = os.path.join(self.tmpdir, "build") -if not os.path.exists
[OE-core] [PATCH 5/8] wic: direct.py: get rid of names with two underscores
Attributes with two leading underscores are mangled in Python and used mainly for avoiding name clashes with names from subclasses. They're not needed in most of wic classes. Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/direct.py | 50 +++- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 6340a59..575fd95 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -99,7 +99,7 @@ class DirectImageCreator: self.compressor = compressor self.bmap = bmap -def __get_part_num(self, num, parts): +def _get_part_num(self, num, parts): """calculate the real partition number, accounting for partitions not in the partition table and logical partitions """ @@ -142,7 +142,7 @@ class DirectImageCreator: """Assume partition order same as in wks""" updated = False for num, part in enumerate(parts, 1): -pnum = self.__get_part_num(num, parts) +pnum = self._get_part_num(num, parts) if not pnum or not part.mountpoint \ or part.mountpoint in ("/", "/boot"): continue @@ -209,7 +209,7 @@ class DirectImageCreator: # # Actual implemention # -def _create(self): +def create(self): """ For 'wic', we already have our build artifacts - we just create filesystems from the artifacts directly and combine them into @@ -217,7 +217,7 @@ class DirectImageCreator: """ parts = self._get_parts() -self.__image = Image(self.native_sysroot) +self._image = Image(self.native_sysroot) disk_ids = {} for num, part in enumerate(parts, 1): @@ -234,7 +234,7 @@ class DirectImageCreator: if part.disk not in disk_ids: disk_ids[part.disk] = int.from_bytes(os.urandom(4), 'little') disk_id = disk_ids[part.disk] -part.uuid = '%0x-%02d' % (disk_id, self.__get_part_num(num, parts)) +part.uuid = '%0x-%02d' % (disk_id, self._get_part_num(num, parts)) fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) @@ -262,7 +262,7 @@ class DirectImageCreator: self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(part.disk_size, +self._image.add_partition(part.disk_size, part.disk, part.mountpoint, part.source_file, @@ -279,28 +279,27 @@ class DirectImageCreator: if fstab_path: shutil.move(fstab_path + ".orig", fstab_path) -self.__image.layout_partitions(self.ptable_format) +self._image.layout_partitions(self.ptable_format) -self.__imgdir = self.workdir -for disk_name, disk in self.__image.disks.items(): -full_path = self._full_path(self.__imgdir, disk_name, "direct") +for disk_name, disk in self._image.disks.items(): +full_path = self._full_path(self.workdir, disk_name, "direct") msger.debug("Adding disk %s as %s with size %s bytes" \ % (disk_name, full_path, disk['min_size'])) disk_obj = DiskImage(full_path, disk['min_size']) -self.__disks[disk_name] = disk_obj -self.__image.add_disk(disk_name, disk_obj, disk_ids.get(disk_name)) +#self._disks[disk_name] = disk_obj +self._image.add_disk(disk_name, disk_obj, disk_ids.get(disk_name)) -self.__image.create() +self._image.create() def assemble(self): """ Assemble partitions into disk image(s) """ -for disk_name, disk in self.__image.disks.items(): -full_path = self._full_path(self.__imgdir, disk_name, "direct") +for disk_name, disk in self._image.disks.items(): +full_path = self._full_path(self.workdir, disk_name, "direct") msger.debug("Assembling disk %s as %s with size %s bytes" \ % (disk_name, full_path, disk['min_size'])) -self.__image.assemble(full_path) +self._image.assemble(full_path) def finalize(self): """ @@ -308,12 +307,11 @@ class DirectImageCreator: For example, prepare the image to be bootable by e.g. creating and installing a bootloader configuration. - """ s
[OE-core] [PATCH 8/8] selftest: wic: test default output directory
As tests now explicitly specify output directory we don't need test_alternate_output_dir test case. However, we need to test wic output to default output location. Removed test_alternate_output_dir test case. Added test_default_output_dir test case. Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 7916071..8295b40 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -36,7 +36,6 @@ from oeqa.utils.decorators import testcase class Wic(oeSelfTest): """Wic test class.""" -alternate_resultdir = "/var/tmp/wic/build/alt/" resultdir = "/var/tmp/wic.oe-selftest/" image_is_ready = False wicenv_cache = {} @@ -202,20 +201,13 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct"))) @testcase(1562) -def test_alternate_output_dir(self): -"""Test alternate output directory""" -self.assertEqual(0, runCmd("wic create directdisk " - "-e core-image-minimal " - "-o %s" - % self.alternate_resultdir).status) -self.assertEqual(1, len(glob(self.alternate_resultdir + - "build/directdisk-*.direct"))) -self.assertEqual(0, runCmd("wic create mkefidisk -e " - "core-image-minimal " - "--outdir=%s" - % self.alternate_resultdir).status) -self.assertEqual(1, len(glob(self.alternate_resultdir + - "build/mkefidisk-*direct"))) +def test_default_output_dir(self): +"""Test default output location""" +for fname in glob("directdisk-*.direct"): +os.remove(fname) +cmd = "wic create directdisk -e core-image-minimal" +self.assertEqual(0, runCmd(cmd).status) +self.assertEqual(1, len(glob("directdisk-*.direct"))) @testcase(1212) def test_build_artifacts(self): -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 4/8] wic: remove unused API DirectImageCreator.get_disk_names
Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/direct.py | 26 -- 1 file changed, 26 deletions(-) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 63f1fa1..6340a59 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -185,32 +185,6 @@ class DirectImageCreator: # partitions list from kickstart file return self.ks.partitions -def get_disk_names(self): -""" Returns a list of physical target disk names (e.g., 'sdb') which -will be created. """ - -if self._disk_names: -return self._disk_names - -#get partition info from ks handler -parts = self._get_parts() - -for i in range(len(parts)): -if parts[i].disk: -disk_name = parts[i].disk -else: -raise CreatorError("Failed to create disks, no --ondisk " - "specified in partition line of ks file") - -if parts[i].mountpoint and not parts[i].fstype: -raise CreatorError("Failed to create disks, no --fstype " - "specified for partition with mountpoint " - "'%s' in the ks file") - -self._disk_names.append(disk_name) - -return self._disk_names - def _full_name(self, name, extention): """ Construct full file name for a file we generate. """ return "%s-%s.%s" % (self.name, name, extention) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 7/8] selftest: wic: explicitly specify output directory
wic started to use current directory as a default output dir. Specified output directory in wic command line to make tests more predictable and easier to maintain. Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 72 +-- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 11dc744..7916071 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -36,8 +36,8 @@ from oeqa.utils.decorators import testcase class Wic(oeSelfTest): """Wic test class.""" -resultdir = "/var/tmp/wic/build/" alternate_resultdir = "/var/tmp/wic/build/alt/" +resultdir = "/var/tmp/wic.oe-selftest/" image_is_ready = False wicenv_cache = {} @@ -56,6 +56,10 @@ class Wic(oeSelfTest): rmtree(self.resultdir, ignore_errors=True) +def tearDownLocal(self): +"""Remove resultdir as it may contain images.""" +rmtree(self.resultdir, ignore_errors=True) + @testcase(1552) def test_version(self): """Test wic --version""" @@ -134,14 +138,14 @@ class Wic(oeSelfTest): @testcase(1211) def test_build_image_name(self): """Test wic create directdisk --image-name=core-image-minimal""" -cmd = "wic create directdisk --image-name=core-image-minimal" +cmd = "wic create directdisk --image-name=core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1157) def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" -cmd = "wic create directdisk-gpt --image-name core-image-minimal" +cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @@ -152,7 +156,7 @@ class Wic(oeSelfTest): self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) -cmd = "wic create mkhybridiso --image-name core-image-minimal" +cmd = "wic create mkhybridiso --image-name core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct"))) self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) @@ -160,21 +164,21 @@ class Wic(oeSelfTest): @testcase(1348) def test_qemux86_directdisk(self): """Test creation of qemux-86-directdisk image""" -cmd = "wic create qemux86-directdisk -e core-image-minimal" +cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct"))) @testcase(1350) def test_mkefidisk(self): """Test creation of mkefidisk image""" -cmd = "wic create mkefidisk -e core-image-minimal" +cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct"))) @testcase(1385) def test_directdisk_bootloader_config(self): """Test creation of directdisk-bootloader-config image""" -cmd = "wic create directdisk-bootloader-config -e core-image-minimal" +cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-bootloader-config-*direct"))) @@ -185,14 +189,14 @@ class Wic(oeSelfTest): self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) -cmd = "wic create systemd-bootdisk -e core-image-minimal" +cmd = "wic create systemd-bootdisk -e core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct"))) @testcase(1561) def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image"
[OE-core] [PATCH] toolchain-shar-extract: compare SDK and host gcc versions
If ext sdk is built by gcc version higher than host gcc version and host gcc version is 4.8 or 4.9 the installation is known to fail due to the way uninative sstate package is built. It's a known issue and we don't have a way to fix it for above mentioned combinations of build and host gcc versions. Detected non-installable combinations of gcc versions and print an installation error. [YOCTO #10881] Signed-off-by: Ed Bartosh --- meta/classes/populate_sdk_base.bbclass | 1 + meta/files/toolchain-shar-extract.sh | 8 2 files changed, 9 insertions(+) diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index 5ad08c6..588a3cb 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass @@ -226,6 +226,7 @@ EOF -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \ -e '/@SDK_PRE_INSTALL_COMMAND@/d' \ -e '/@SDK_POST_INSTALL_COMMAND@/d' \ + -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d)}#g' \ ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh # add execution permission diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh index 9295ddc..3f54c96 100644 --- a/meta/files/toolchain-shar-extract.sh +++ b/meta/files/toolchain-shar-extract.sh @@ -11,6 +11,9 @@ export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'` INST_ARCH=$(uname -m | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/") SDK_ARCH=$(echo @SDK_ARCH@ | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/") +INST_GCC_VER=$(gcc --version | sed -ne 's/.* \([0-9]\+\.[0-9]\+\)\.[0-9]\+.*/\1/p') +SDK_GCC_VER='@SDK_GCC_VER@' + verlte () { [ "$1" = "`printf "$1\n$2" | sort -V | head -n1`" ] } @@ -112,6 +115,11 @@ fi # SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above if [ "$SDK_EXTENSIBLE" = "1" ]; then DEFAULT_INSTALL_DIR="@SDKEXTPATH@" + if [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '4.9' ] || [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '' ] || \ + [ "$INST_GCC_VER" = '4.9' -a "$SDK_GCC_VER" = '' ]; then + echo "Error: Incompatible SDK installer! Your host gcc version is $INST_GCC_VER and this SDK was built by gcc higher version." + exit 1 + fi fi if [ "$target_sdk_dir" = "" ]; then -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: change location of .env files
Current location of .env files $STAGING_DIR/imagedata. It doesn't depend on machine and be rewritten by the builds for different machines. Changed location to $STAGING_DIR/$MACHINE/imagedata to avoid .env files to be rewritten. Signed-off-by: Ed Bartosh --- meta/classes/image.bbclass | 2 +- meta/classes/image_types.bbclass| 2 +- meta/lib/oeqa/selftest/wic.py | 3 ++- meta/recipes-core/meta/wic-tools.bb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index fb0cce3..2c58f4b 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -343,7 +343,7 @@ python do_rootfs_wicenv () { return stdir = d.getVar('STAGING_DIR') -outdir = os.path.join(stdir, 'imgdata') +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: diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 5b1746a..7547227 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -216,7 +216,7 @@ IMAGE_CMD_wic () { 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}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} + BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/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/" } diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 11dc744..9158c05 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -340,7 +340,8 @@ class Wic(oeSelfTest): if image not in self.wicenv_cache: self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) stdir = get_bb_var('STAGING_DIR', image) -self.wicenv_cache[image] = os.path.join(stdir, 'imgdata') +machine = get_bb_var('MACHINE', image) +self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') return self.wicenv_cache[image] @testcase(1347) diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb index 0a53b73..aa09c82 100644 --- a/meta/recipes-core/meta/wic-tools.bb +++ b/meta/recipes-core/meta/wic-tools.bb @@ -14,7 +14,7 @@ python do_build_sysroot () { # Write environment variables used by wic # to tmp/sysroots//imgdata/wictools.env -outdir = os.path.join(d.getVar('STAGING_DIR'), 'imgdata') +outdir = os.path.join(d.getVar('STAGING_DIR'), d.getVar('MACHINE'), 'imgdata') bb.utils.mkdirhier(outdir) with open(os.path.join(outdir, "wic-tools.env"), 'w') as envf: for var in ('RECIPE_SYSROOT_NATIVE', 'STAGING_DATADIR', 'STAGING_LIBDIR'): -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2] wic: change location of .env files
Current location of .env files $STAGING_DIR/imagedata. It doesn't depend on machine and be rewritten by the builds for different machines. Changed location to $STAGING_DIR/$MACHINE/imagedata to avoid .env files to be rewritten. Signed-off-by: Ed Bartosh --- meta/classes/image.bbclass | 2 +- meta/classes/image_types.bbclass| 2 +- meta/lib/oeqa/selftest/wic.py | 3 ++- meta/recipes-core/meta/wic-tools.bb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index fb0cce3..2c58f4b 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -343,7 +343,7 @@ python do_rootfs_wicenv () { return stdir = d.getVar('STAGING_DIR') -outdir = os.path.join(stdir, 'imgdata') +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: diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index ddd52f1..e391f8b 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -216,7 +216,7 @@ IMAGE_CMD_wic () { 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}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} + 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/" } diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8295b40..8864af6 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -344,7 +344,8 @@ class Wic(oeSelfTest): if image not in self.wicenv_cache: self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) stdir = get_bb_var('STAGING_DIR', image) -self.wicenv_cache[image] = os.path.join(stdir, 'imgdata') +machine = get_bb_var('MACHINE', image) +self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') return self.wicenv_cache[image] @testcase(1347) diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb index 0a53b73..aa09c82 100644 --- a/meta/recipes-core/meta/wic-tools.bb +++ b/meta/recipes-core/meta/wic-tools.bb @@ -14,7 +14,7 @@ python do_build_sysroot () { # Write environment variables used by wic # to tmp/sysroots//imgdata/wictools.env -outdir = os.path.join(d.getVar('STAGING_DIR'), 'imgdata') +outdir = os.path.join(d.getVar('STAGING_DIR'), d.getVar('MACHINE'), 'imgdata') bb.utils.mkdirhier(outdir) with open(os.path.join(outdir, "wic-tools.env"), 'w') as envf: for var in ('RECIPE_SYSROOT_NATIVE', 'STAGING_DATADIR', 'STAGING_LIBDIR'): -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3] wic: change location of .env files
Current location of .env files $STAGING_DIR/imagedata. It doesn't depend on machine and be rewritten by the builds for different machines. Changed location to $STAGING_DIR/$MACHINE/imagedata to avoid .env files to be rewritten. Signed-off-by: Ed Bartosh --- meta/classes/image.bbclass | 2 +- meta/classes/image_types.bbclass| 2 +- meta/lib/oeqa/selftest/wic.py | 3 ++- meta/recipes-core/meta/wic-tools.bb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index fb0cce3..2c58f4b 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -343,7 +343,7 @@ python do_rootfs_wicenv () { return stdir = d.getVar('STAGING_DIR') -outdir = os.path.join(stdir, 'imgdata') +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: diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index ddd52f1..ca69823 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -216,7 +216,7 @@ IMAGE_CMD_wic () { 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}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} + 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/" } diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8295b40..8864af6 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -344,7 +344,8 @@ class Wic(oeSelfTest): if image not in self.wicenv_cache: self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) stdir = get_bb_var('STAGING_DIR', image) -self.wicenv_cache[image] = os.path.join(stdir, 'imgdata') +machine = get_bb_var('MACHINE', image) +self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') return self.wicenv_cache[image] @testcase(1347) diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb index 0a53b73..aa09c82 100644 --- a/meta/recipes-core/meta/wic-tools.bb +++ b/meta/recipes-core/meta/wic-tools.bb @@ -14,7 +14,7 @@ python do_build_sysroot () { # Write environment variables used by wic # to tmp/sysroots//imgdata/wictools.env -outdir = os.path.join(d.getVar('STAGING_DIR'), 'imgdata') +outdir = os.path.join(d.getVar('STAGING_DIR'), d.getVar('MACHINE'), 'imgdata') bb.utils.mkdirhier(outdir) with open(os.path.join(outdir, "wic-tools.env"), 'w') as envf: for var in ('RECIPE_SYSROOT_NATIVE', 'STAGING_DATADIR', 'STAGING_LIBDIR'): -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] selftest: wic: split test_debug test case
Splitted to test_debug_short and test_debug_long to make each of the test cases to run wic once. This is consistent with the rest of the test cases and ensures that test cases are set up properly. This also fixes the following test failure caused by the image left from the first wic run: FAIL: test_debug (oeqa.selftest.wic.Wic) Test debug -- Traceback (most recent call last): File "meta/lib/oeqa/utils/decorators.py", line 109, in wrapped_f return func(*args, **kwargs) File "meta/lib/oeqa/selftest/wic.py", line 270, in test_debug self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) AssertionError: 1 != 2 Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8864af6..9784a68 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -258,12 +258,15 @@ class Wic(oeSelfTest): ignore_status=True).status) @testcase(1558) -def test_debug(self): -"""Test debug""" +def test_debug_short(self): +"""Test -D option""" self.assertEqual(0, runCmd("wic create directdisk " "--image-name=core-image-minimal " "-D -o %s" % self.resultdir).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) + +def test_debug_long(self): +"""Test --debug option""" self.assertEqual(0, runCmd("wic create directdisk " "--image-name=core-image-minimal " "--debug -o %s" % self.resultdir).status) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 00/14] 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 01/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. Signed-off-by: Ed Bartosh --- 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 diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass new file mode 100644 index 000..2acfd65 --- /dev/null +++ b/meta/classes/image-wic.bbclass @@ -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 .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) + +tr
[OE-core] [PATCH v2 05/14] grub-efi: make do_efi_populate depend on do_deploy
Added dependency do_efi_populate -> grub-efi:do_deploy to make sure EFI artifacts are depfloyed. Signed-off-by: Ed Bartosh --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 02/14] grub-efi: set default desination dir
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 03/14] systemd-boot: set default desination dir
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 --- 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 6a2cbc8..1405310 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 04/14] image-wic.bbclas: add task do_efi_populate
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 --- 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 2acfd65..41b406d 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 06/14] systemd-boot: make do_efi_populate depend on do_deploy
Added dependency do_efi_populate -> systemd-boot:do_deploy to make sure EFI artifacts are depfloyed. Signed-off-by: Ed Bartosh --- 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 1405310..54b8790 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 08/14] image-wic: add task do_build_iso
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 --- 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 41b406d..bde17a3 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 07/14] wic: use EFI artifacts from $WORKDIR/efi
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 --- 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 09/14] wic: use INITRD_LIVE in isoimage-isohybrid
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 --- 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(-) diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass index bde17a3..df9f33a 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -2,8 +2,8 @@ # variables from this list is written to .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" diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 9784a68..8415c69 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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 diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index a8a5dc0..fd25190 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 12/14] isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH
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 .env file. Signed-off-by: Ed Bartosh --- meta/classes/image-wic.bbclass | 4 ++-- scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass index be3e6d4..264017f 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -2,8 +2,8 @@ # variables from this list is written to .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" diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index a637ce5..afd6fa9 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 10/14] wic: isoimage-isohybrid: stop using HDDDIR
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 --- 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 fd25190..a637ce5 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -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) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 11/14] image-wic: remove HDDDIR from WICVARS
Removed HDDDIR as it's not used by wic anymore. Stopped usage of HDDDIR in wic test suite. Signed-off-by: Ed Bartosh --- 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 df9f33a..be3e6d4 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -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 .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" diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8415c69..4843060 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 13/14] selftest: stop using hddimg in the wic test suite
Removed hddimg from IMAGE_FEATURES as wic code doesn't use hddimg anymore. [YOCTO #10835] Signed-off-by: Ed Bartosh --- 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 4843060..7d5df57 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 14/14] selftest: wic: fix test_iso_image test case
Added "iso" to IMAGE_FSTYPES to build iso artifacts required to fix test of isoimage-isohybrid wic plugin. Signed-off-by: Ed Bartosh --- 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 7d5df57..ea26200 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH] wic: partitionedfs: set partition name for gpt partitions
Hi Jukka, On Thu, Jan 26, 2017 at 05:43:33PM +0200, Jukka Laitinen wrote: > Set proper gpt partition name for the partitions in case given > in the configuration > > Signed-off-by: Jukka Laitinen > --- > scripts/lib/wic/utils/partitionedfs.py | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/scripts/lib/wic/utils/partitionedfs.py > b/scripts/lib/wic/utils/partitionedfs.py > index 721d514..ed67b9a 100644 > --- a/scripts/lib/wic/utils/partitionedfs.py > +++ b/scripts/lib/wic/utils/partitionedfs.py > @@ -316,6 +316,13 @@ class Image(): > (part['num'], part['uuid'], > disk['disk'].device), > self.native_sysroot) > > +if part['label'] and disk['ptable_format'] == "gpt": > +msger.debug("partition %d: set name to %s" % \ > +(part['num'], part['label'])) > +exec_native_cmd("parted -s %s name %d %s" % \ > +(disk['disk'].device, part['num'], > part['label']), > +self.native_sysroot) > + > if part['boot']: > flag_name = "legacy_boot" if disk['ptable_format'] == 'gpt' > else "boot" > msger.debug("Set '%s' flag for partition '%s' on disk '%s'" > % \ Thank you for the patch! +1 -- Regards, Ed -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 00/11] 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. 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 Changes in v3: removed patches that add tasks, fixed test cases, rebased on top of patches that make use of artifacts from DEPLOY_DIR_IMAGE, rebased on to pf ross/mut The following changes since commit 2624674adefd86d15bc0bec2bb2a3876f785b947: selftest: check results in test_image_vars_dir* (2017-01-27 17:27:30 +) 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 (10): image-wic: move wic code to image-wic.bbclass 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 grub-efi.bbclass: use 'grub-efi-' prefix wic-tools: add dependency to systemd-boot isoimage-isohybrid: renamed variable hdd_dir Tom Zanussi (1): wic: Look for image artifacts in a common location meta/classes/grub-efi.bbclass | 10 +- meta/classes/image-wic.bbclass | 120 + meta/classes/image.bbclass | 25 + meta/classes/image_types.bbclass | 95 meta/lib/oeqa/selftest/wic.py | 6 +- meta/recipes-core/meta/wic-tools.bb| 4 +- scripts/lib/wic/plugins/source/bootimg-efi.py | 39 +-- .../lib/wic/plugins/source/isoimage-isohybrid.py | 36 --- 8 files changed, 182 insertions(+), 153 deletions(-) create mode 100644 meta/classes/image-wic.bbclass -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 01/11] 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. Signed-off-by: Ed Bartosh --- 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 diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass new file mode 100644 index 000..2acfd65 --- /dev/null +++ b/meta/classes/image-wic.bbclass @@ -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 .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) + +tr
[OE-core] [PATCH v3 04/11] image-wic: remove HDDDIR from WICVARS
Removed HDDDIR as it's not used by wic anymore. Stopped usage of HDDDIR in wic test suite. Signed-off-by: Ed Bartosh --- 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 ab2e541..bd79073 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -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 .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" diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8eb77ae..ebbb280 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -372,8 +372,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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 11/11] isoimage-isohybrid: renamed variable hdd_dir
Renamed variable hdd_dir to deploy_dir as this variable is assigned to the value of DEPLOY_DIR_IMAGE. Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index e4637a3..bceaa84 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -249,7 +249,7 @@ class IsoImagePlugin(SourcePlugin): part.rootfs_dir = rootfs_dir # Prepare rootfs.img -hdd_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") +deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") img_iso_dir = get_bitbake_var("ISODIR") rootfs_img = "%s/rootfs.img" % img_iso_dir if not os.path.isfile(rootfs_img): @@ -282,12 +282,12 @@ class IsoImagePlugin(SourcePlugin): # Support using a different initrd other than default if source_params.get('initrd'): initrd = source_params['initrd'] -if not hdd_dir: +if not deploy_dir: msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") -cp_cmd = "cp %s/%s %s" % (hdd_dir, initrd, cr_workdir) +cp_cmd = "cp %s/%s %s" % (deploy_dir, initrd, cr_workdir) else: # Prepare initial ramdisk -initrd = "%s/initrd" % hdd_dir +initrd = "%s/initrd" % deploy_dir if not os.path.isfile(initrd): initrd = "%s/initrd" % img_iso_dir if not os.path.isfile(initrd): -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 03/11] wic: isoimage-isohybrid: stop using HDDDIR
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 --- 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 fd25190..a637ce5 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -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) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 02/11] wic: use INITRD_LIVE in isoimage-isohybrid
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 --- 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(-) diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass index 2acfd65..ab2e541 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -2,8 +2,8 @@ # variables from this list is written to .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" diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 53631fa..8eb77ae 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -373,7 +373,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 a8a5dc0..fd25190 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 06/11] isoimage-isohybrid: use TRANSLATED_TARGET_ARCH instead of MACHINE_ARCH
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 .env file. Signed-off-by: Ed Bartosh --- meta/classes/image-wic.bbclass | 4 ++-- scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic.bbclass index bd79073..3e98959 100644 --- a/meta/classes/image-wic.bbclass +++ b/meta/classes/image-wic.bbclass @@ -2,8 +2,8 @@ # variables from this list is written to .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" diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index b54a229..e4637a3 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 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 05/11] wic: Look for image artifacts in a common location
From: Tom Zanussi Rather than have each image type look for artifacts in image-specific locations, move towards having them look for artifacts in a common location, in this case DEPLOY_DIR_IMAGE Use the existing deploy.bbclass to have the bootloaders put their binaries in DEPLOY_DIR_IMAGE and then wic will find them and place them in the image Signed-off-by: Alejandro Hernandez Signed-off-by: Tom Zanussi Signed-off-by: Saul Wold Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 4 +-- scripts/lib/wic/plugins/source/bootimg-efi.py | 39 -- .../lib/wic/plugins/source/isoimage-isohybrid.py | 18 +++--- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index ebbb280..da68e25 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -372,8 +372,8 @@ class Wic(oeSelfTest): wicvars = set(get_bb_var('WICVARS', image).split()) # filter out optional variables -wicvars = wicvars.difference(('IMAGE_BOOT_FILES', 'INITRD', - 'INITRD_LIVE', 'ISODIR')) +wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', '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 diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 305e910..74a1557 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -42,7 +42,7 @@ class BootimgEFIPlugin(SourcePlugin): name = 'bootimg-efi' @classmethod -def do_configure_grubefi(cls, hdddir, creator, cr_workdir): +def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): """ Create loader-specific (grub-efi) config """ @@ -82,7 +82,7 @@ class BootimgEFIPlugin(SourcePlugin): cfg.close() @classmethod -def do_configure_systemdboot(cls, hdddir, creator, cr_workdir): +def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params): """ Create loader-specific systemd-boot/gummiboot config """ @@ -98,6 +98,19 @@ class BootimgEFIPlugin(SourcePlugin): loader_conf += "default boot\n" loader_conf += "timeout %d\n" % bootloader.timeout +initrd = source_params.get('initrd') + +if initrd: +# obviously we need to have a common common deploy var +bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") +if not bootimg_dir: +msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + +cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir) +exec_cmd(cp_cmd, True) +else: +msger.debug("Ignoring missing initrd") + msger.debug("Writing systemd-boot config %s/hdd/boot/loader/loader.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") @@ -127,6 +140,9 @@ class BootimgEFIPlugin(SourcePlugin): boot_conf += "options LABEL=Boot root=%s %s\n" % \ (creator.rootdev, bootloader.append) +if initrd: +boot_conf += "initrd /%s\n" % initrd + msger.debug("Writing systemd-boot config %s/hdd/boot/loader/entries/boot.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") @@ -148,9 +164,9 @@ class BootimgEFIPlugin(SourcePlugin): try: if source_params['loader'] == 'grub-efi': -cls.do_configure_grubefi(hdddir, creator, cr_workdir) +cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) elif source_params['loader'] == 'systemd-boot': -cls.do_configure_systemdboot(hdddir, creator, cr_workdir) +cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) else: msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader']) except KeyError: @@ -167,9 +183,9 @@ class BootimgEFIPlugin(SourcePlugin): In this case, prepare content for an EFI (grub) boot partition. """ if not bootimg_dir: -
[OE-core] [PATCH v3 09/11] grub-efi.bbclass: use 'grub-efi-' prefix
grub-efi recipe added 'grub-efi-' prefix to the file name of efi binary. Changed grub-efi.bbclass accordingly. Signed-off-by: Ed Bartosh --- meta/classes/grub-efi.bbclass | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass index 3dc9146..8adda09 100644 --- a/meta/classes/grub-efi.bbclass +++ b/meta/classes/grub-efi.bbclass @@ -40,13 +40,15 @@ efi_populate() { install -d ${DEST}${EFIDIR} - GRUB_IMAGE="bootia32.efi" + GRUB_IMAGE="grub-efi-bootia32.efi" + DEST_IMAGE="bootia32.efi" if [ "${TARGET_ARCH}" = "x86_64" ]; then - GRUB_IMAGE="bootx64.efi" + GRUB_IMAGE="grub-efi-bootx64.efi" + DEST_IMAGE="bootx64.efi" fi - install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR} + install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE} EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') - printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" >${DEST}/startup.nsh + printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg } -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 10/11] wic-tools: add dependency to systemd-boot
Added systemd-boot to the list of dependencies of wic-tools as wic bootimg-efi plugin depends on it. Signed-off-by: Ed Bartosh --- meta/recipes-core/meta/wic-tools.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb index aa09c82..1d9ea9c 100644 --- a/meta/recipes-core/meta/wic-tools.bb +++ b/meta/recipes-core/meta/wic-tools.bb @@ -3,8 +3,8 @@ SUMMARY = "A meta recipe to build native tools used by wic." LICENSE = "MIT" DEPENDS = "parted-native syslinux-native gptfdisk-native dosfstools-native mtools-native bmap-tools-native grub-efi-native cdrtools-native" -DEPENDS_append_x86 = " syslinux grub-efi" -DEPENDS_append_x86-64 = " syslinux grub-efi" +DEPENDS_append_x86 = " syslinux grub-efi systemd-boot" +DEPENDS_append_x86-64 = " syslinux grub-efi systemd-boot" INHIBIT_DEFAULT_DEPS = "1" inherit nopackages -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 08/11] selftest: wic: fix test_iso_image test case
Added "iso" to IMAGE_FSTYPES to build iso artifacts required to fix test of isoimage-isohybrid wic plugin. Signed-off-by: Ed Bartosh --- 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 dce83ba..6a6b54c 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 07/11] selftest: stop using hddimg in the wic test suite
Removed hddimg from IMAGE_FEATURES as wic code doesn't use hddimg anymore. [YOCTO #10835] Signed-off-by: Ed Bartosh --- 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 da68e25..dce83ba 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH v3 01/11] image-wic: move wic code to image-wic.bbclass
On Mon, Jan 30, 2017 at 10:25:12AM +, Ola x Nilsson wrote: > Please name the class image_wic.bbclass instead. > > As dashes are not allowed in function names, you cannot use > the image_wic_do_write_wks_template pattern of function > names if you use a class name with a dash in it. > Thanks for pointing out to it. Will fix it in the next versison of this patchset. > -- > Ola x Nilsson > > > -Original Message- > > From: openembedded-core-boun...@lists.openembedded.org > > [mailto:openembedded-core-boun...@lists.openembedded.org] On Behalf > > Of Ed Bartosh > > Sent: den 27 januari 2017 21:20 > > To: openembedded-core@lists.openembedded.org > > Subject: [OE-core] [PATCH v3 01/11] 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. > > > > Signed-off-by: Ed Bartosh > > --- > > 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 > > > > diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image- > > wic.bbclass new file mode 100644 index 000..2acfd65 > > --- /dev/null > > +++ b/meta/classes/image-wic.bbclass > > @@ -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 .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.a
Re: [OE-core] [PATCH v3 01/11] image-wic: move wic code to image-wic.bbclass
On Mon, Jan 30, 2017 at 09:27:54AM -0800, Rick Altherr wrote: > Why didn't you make this image_types_wic.bbclass and use IMAGE_CLASSES to > load it? Because of the following: - IMAGE_CLASSES[doc] = "A list of classes that all images should inherit." I'm not sure all images should include wic class. I'll probably make this inheritance conditional. - so far IMAGE_CLASSES is used for qemuboot, image_types, image_types_uboot and testimage, so the usage is more or less follows the description. wic is out of that usage scenario, I believe. - 'inherit image_wic' is more explicit than IMAGE_CLASSES += "image_types"\n inherit ${IMAGE_CLASSES} > > On Fri, Jan 27, 2017 at 12:19 PM, Ed Bartosh > wrote: > > > 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. > > > > Signed-off-by: Ed Bartosh > > --- > > 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 > > > > diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic. > > bbclass > > new file mode 100644 > > index 000..2acfd65 > > --- /dev/null > > +++ b/meta/classes/image-wic.bbclass > > @@ -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 .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',
Re: [OE-core] [PATCH v3 01/11] image-wic: move wic code to image-wic.bbclass
On Mon, Jan 30, 2017 at 09:47:42AM -0800, Rick Altherr wrote: > Hmm. In local.conf.sample.extended, I find: > > # Additional image generation features > # > # The following is a list of classes to import to use in the generation of > images > # currently an example class is image_types_uboot > # IMAGE_CLASSES = " image_types_uboot" > > Indeed, image_types_uboot isn't part of IMAGE_CLASSES by default. I'd > expect a machine config to add wic to IMAGE_CLASSES if it needs wic output. > So far all machine configs add wic to IMAGE_TYPES and it works just fine. Why to change? > On Mon, Jan 30, 2017 at 9:18 AM, Ed Bartosh > wrote: > > > On Mon, Jan 30, 2017 at 09:27:54AM -0800, Rick Altherr wrote: > > > Why didn't you make this image_types_wic.bbclass and use IMAGE_CLASSES to > > > load it? > > > > Because of the following: > > - IMAGE_CLASSES[doc] = "A list of classes that all images should > > inherit." I'm not sure all images should include wic class. I'll probably > > make this inheritance conditional. > > - so far IMAGE_CLASSES is used for qemuboot, image_types, > > image_types_uboot and testimage, > > so the usage is more or less follows the description. wic is out of > > that usage scenario, I believe. > > - 'inherit image_wic' is more explicit than IMAGE_CLASSES += > > "image_types"\n inherit ${IMAGE_CLASSES} > > > > > > > > > > On Fri, Jan 27, 2017 at 12:19 PM, Ed Bartosh > > > > > wrote: > > > > > > > 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. > > > > > > > > Signed-off-by: Ed Bartosh > > > > --- > > > > 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 > > > > > > > > diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image-wic. > > > > bbclass > > > > new file mode 100644 > > > > index 000..2acfd65 > > > > --- /dev/null > > > > +++ b/meta/classes/image-wic.bbclass > > > > @@ -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 .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" ];
Re: [OE-core] [PATCH v3 01/11] image-wic: move wic code to image-wic.bbclass
On Mon, Jan 30, 2017 at 10:25:59AM -0800, Rick Altherr wrote: > I'm not clear on which path is the preferred one. There are lots of bits > and pieces in image_types.bbclass that implement various image types. > uboot got added as a separate class at some point. The comments in > local.conf.sample.extended imply IMAGE_CLASSES should be used to load > additional image_types_* classes to add support for additional image > types. Having the wic image type implemented in a separate > image-wic.bbclass that is directly inherited by image.bbclass adds a 3rd > approach. Which one do we want contributors to use in the future? > I didn't want to create even more confusion. What I wanted is stated in the commit message - to put existing wic code into a file for better maintenance. If this is more confusing than having wic code in different places of image.class and image_types.class then we can just drop this patch. However, I personally find it more maintainable this way. Suggesting people to change machine configs just because wic code is moved to separate file doesn't look good to me either. > On Mon, Jan 30, 2017 at 9:45 AM, Ed Bartosh > wrote: > > > On Mon, Jan 30, 2017 at 09:47:42AM -0800, Rick Altherr wrote: > > > Hmm. In local.conf.sample.extended, I find: > > > > > > # Additional image generation features > > > # > > > # The following is a list of classes to import to use in the generation > > of > > > images > > > # currently an example class is image_types_uboot > > > # IMAGE_CLASSES = " image_types_uboot" > > > > > > Indeed, image_types_uboot isn't part of IMAGE_CLASSES by default. I'd > > > expect a machine config to add wic to IMAGE_CLASSES if it needs wic > > output. > > > > > > > So far all machine configs add wic to IMAGE_TYPES and it works just > > fine. Why to change? > > > > > On Mon, Jan 30, 2017 at 9:18 AM, Ed Bartosh > > > wrote: > > > > > > > On Mon, Jan 30, 2017 at 09:27:54AM -0800, Rick Altherr wrote: > > > > > Why didn't you make this image_types_wic.bbclass and use > > IMAGE_CLASSES to > > > > > load it? > > > > > > > > Because of the following: > > > > - IMAGE_CLASSES[doc] = "A list of classes that all images should > > > > inherit." I'm not sure all images should include wic class. I'll > > probably > > > > make this inheritance conditional. > > > > - so far IMAGE_CLASSES is used for qemuboot, image_types, > > > > image_types_uboot and testimage, > > > > so the usage is more or less follows the description. wic is out of > > > > that usage scenario, I believe. > > > > - 'inherit image_wic' is more explicit than IMAGE_CLASSES += > > > > "image_types"\n inherit ${IMAGE_CLASSES} > > > > > > > > > > > > > > > > > > On Fri, Jan 27, 2017 at 12:19 PM, Ed Bartosh < > > ed.bart...@linux.intel.com > > > > > > > > > > wrote: > > > > > > > > > > > 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. > > > > > > > > > > > > Signed-off-by: Ed Bartosh > > > > > > --- > > > > > > 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 > > > > > > > > > > > > diff --git a/meta/classes/image-wic.bbclass > > b/meta/classes/image-wic. > > > > > > bbclass > > > > > > new file mode 100644 > > > > > > index 000..2acfd65 > > > > > > --- /dev/null > > > > > > +++ b/meta/classes/image-wic.bbclass > > > > > > @@ -0,0 +1,120 @@ > > > > > > +# The WICVARS variable is used to define list of bitbake variables > > > > used > > > > > > in wic code > > > > > > +# variables from this list is
Re: [OE-core] [PATCH v3 01/11] image-wic: move wic code to image-wic.bbclass
On Mon, Jan 30, 2017 at 10:41:27AM -0800, Rick Altherr wrote: > Agreed. What if it was image_types_wic.bbclass and you did something > similar to build_uboot() in image.bbclass? > I can do this for now: IMAGE_TYPE_wic = "image_type_wic" inherit ${IMAGE_TYPE_wic} which is the same as 'inherit image_type_wic', just takes 2 lines, but looks more consistent. does this look ok? > On Mon, Jan 30, 2017 at 10:15 AM, Ed Bartosh > wrote: > > > On Mon, Jan 30, 2017 at 10:25:59AM -0800, Rick Altherr wrote: > > > I'm not clear on which path is the preferred one. There are lots of bits > > > and pieces in image_types.bbclass that implement various image types. > > > uboot got added as a separate class at some point. The comments in > > > local.conf.sample.extended imply IMAGE_CLASSES should be used to load > > > additional image_types_* classes to add support for additional image > > > types. Having the wic image type implemented in a separate > > > image-wic.bbclass that is directly inherited by image.bbclass adds a 3rd > > > approach. Which one do we want contributors to use in the future? > > > > > > > I didn't want to create even more confusion. What I wanted is stated in the > > commit message - to put existing wic code into a file for better > > maintenance. If this is more confusing than having wic code in different > > places of image.class and image_types.class then we can just drop this > > patch. However, I personally find it more maintainable this way. > > > > Suggesting people to change machine configs just because wic code is > > moved to separate file doesn't look good to me either. > > > > > On Mon, Jan 30, 2017 at 9:45 AM, Ed Bartosh > > > wrote: > > > > > > > On Mon, Jan 30, 2017 at 09:47:42AM -0800, Rick Altherr wrote: > > > > > Hmm. In local.conf.sample.extended, I find: > > > > > > > > > > # Additional image generation features > > > > > # > > > > > # The following is a list of classes to import to use in the > > generation > > > > of > > > > > images > > > > > # currently an example class is image_types_uboot > > > > > # IMAGE_CLASSES = " image_types_uboot" > > > > > > > > > > Indeed, image_types_uboot isn't part of IMAGE_CLASSES by default. > > I'd > > > > > expect a machine config to add wic to IMAGE_CLASSES if it needs wic > > > > output. > > > > > > > > > > > > > So far all machine configs add wic to IMAGE_TYPES and it works just > > > > fine. Why to change? > > > > > > > > > On Mon, Jan 30, 2017 at 9:18 AM, Ed Bartosh < > > ed.bart...@linux.intel.com> > > > > > wrote: > > > > > > > > > > > On Mon, Jan 30, 2017 at 09:27:54AM -0800, Rick Altherr wrote: > > > > > > > Why didn't you make this image_types_wic.bbclass and use > > > > IMAGE_CLASSES to > > > > > > > load it? > > > > > > > > > > > > Because of the following: > > > > > > - IMAGE_CLASSES[doc] = "A list of classes that all images should > > > > > > inherit." I'm not sure all images should include wic class. I'll > > > > probably > > > > > > make this inheritance conditional. > > > > > > - so far IMAGE_CLASSES is used for qemuboot, image_types, > > > > > > image_types_uboot and testimage, > > > > > > so the usage is more or less follows the description. wic is out > > of > > > > > > that usage scenario, I believe. > > > > > > - 'inherit image_wic' is more explicit than IMAGE_CLASSES += > > > > > > "image_types"\n inherit ${IMAGE_CLASSES} > > > > > > > > > > > > > > > > > > > > > > > > > > On Fri, Jan 27, 2017 at 12:19 PM, Ed Bartosh < > > > > ed.bart...@linux.intel.com > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > 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. > > > > > > > > &
[OE-core] [PATCH 00/18] #10619: refactor wic codebase (start)
Hi, This patchset consolidates wic APIs in a more maintainable way, removes unused APIs and cleans up wic code. This is a first series of a refactoring work. The changes in this patchset are relatively simple. They're a preparation for upcoming heavy work on making wic codebase less complex and more maintainable. The following changes since commit ec3d83f9a90288403b96be25da855fa280aadd8d: xmlto: Don't hardcode the path to tail (2017-01-31 23:47:33 +) are available in the git repository at: git://git.yoctoproject.org/poky-contrib ed/wic/refactoring-10619 http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/refactoring-10619 Ed Bartosh (18): wic: creator: stop using config manager wic: direct_plugin: stop using config manager wic: removed conf.py and empty config file. wic: moved content of direct.py to direct_plugin wic: get rid of __rootfs_dir_to_dict method wic: improve naming in direct_plugin classes wic: pylinted direct_plugin wic: simplified code of direct_plugin wic: renamd direct_plugin.py -> direct.py wic: removed test file wic: partition: simlify calling plugin methods wci: misc: removed build_name API wic: move 2 APIs to wic.engine wic: move oe/misc.py one level up wic: removed code from __init__.py wic: msger.py: remove unused APIs wic: code cleanup wic: remove syslinux.py scripts/lib/wic/__init__.py| 4 - scripts/lib/wic/__version__.py | 1 - scripts/lib/wic/conf.py| 103 scripts/lib/wic/config/wic.conf| 6 - scripts/lib/wic/creator.py | 19 -- scripts/lib/wic/engine.py | 39 ++- scripts/lib/wic/help.py| 4 +- scripts/lib/wic/imager/__init__.py | 0 scripts/lib/wic/ksparser.py| 2 +- scripts/lib/wic/msger.py | 26 -- scripts/lib/wic/partition.py | 66 ++--- scripts/lib/wic/plugin.py | 5 +- scripts/lib/wic/pluginbase.py | 1 - scripts/lib/wic/{ => plugins}/imager/direct.py | 139 ++- scripts/lib/wic/plugins/imager/direct_plugin.py| 103 scripts/lib/wic/plugins/source/bootimg-efi.py | 20 +- .../lib/wic/plugins/source/bootimg-partition.py| 6 +- scripts/lib/wic/plugins/source/bootimg-pcbios.py | 12 +- scripts/lib/wic/plugins/source/fsimage.py | 2 +- .../lib/wic/plugins/source/isoimage-isohybrid.py | 15 +- scripts/lib/wic/plugins/source/rawcopy.py | 3 +- scripts/lib/wic/plugins/source/rootfs.py | 6 +- .../lib/wic/plugins/source/rootfs_pcbios_ext.py| 46 +++- scripts/lib/wic/test | 1 - scripts/lib/wic/utils/misc.py | 274 +++-- scripts/lib/wic/utils/oe/misc.py | 247 --- scripts/lib/wic/utils/partitionedfs.py | 7 +- scripts/lib/wic/utils/syslinux.py | 58 - scripts/wic| 2 +- 29 files changed, 426 insertions(+), 791 deletions(-) delete mode 100644 scripts/lib/wic/__version__.py delete mode 100644 scripts/lib/wic/conf.py delete mode 100644 scripts/lib/wic/config/wic.conf delete mode 100644 scripts/lib/wic/imager/__init__.py rename scripts/lib/wic/{ => plugins}/imager/direct.py (80%) delete mode 100644 scripts/lib/wic/plugins/imager/direct_plugin.py delete mode 100644 scripts/lib/wic/test delete mode 100644 scripts/lib/wic/utils/oe/misc.py delete mode 100644 scripts/lib/wic/utils/syslinux.py -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 01/18] wic: creator: stop using config manager
This is a preparation to removing conf.py and config/wic.conf from the codebase. confmgr object is complicated for no reason and almost useless as all configuration info comes from command line and bitbake variables. It's used it creator.py to store information about output directory, logs and some never used functionality like tmpfs for future use, which doesn't actually happen. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/creator.py | 19 --- 1 file changed, 19 deletions(-) diff --git a/scripts/lib/wic/creator.py b/scripts/lib/wic/creator.py index 8f7d150..74db83c 100644 --- a/scripts/lib/wic/creator.py +++ b/scripts/lib/wic/creator.py @@ -20,10 +20,8 @@ from optparse import OptionParser, SUPPRESS_HELP from wic import msger from wic.utils import errors -from wic.conf import configmgr from wic.plugin import pluginmgr - class Creator(): """${name}: create an image @@ -89,23 +87,6 @@ class Creator(): os.makedirs(os.path.dirname(logfile_abs_path)) msger.set_interactive(False) msger.set_logfile(logfile_abs_path) -configmgr.create['logfile'] = options.logfile - -if options.config: -configmgr.reset() -configmgr._siteconf = options.config - -if options.outdir is not None: -configmgr.create['outdir'] = abspath(options.outdir) - -cdir = 'outdir' -if os.path.exists(configmgr.create[cdir]) \ - and not os.path.isdir(configmgr.create[cdir]): -msger.error('Invalid directory specified: %s' \ -% configmgr.create[cdir]) - -if options.enabletmpfs: -configmgr.create['enabletmpfs'] = options.enabletmpfs def main(self, argv=None): if argv is None: -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 04/18] wic: moved content of direct.py to direct_plugin
This move simplifies directory structure and makes further refactoring easier. The code from direct.py was used only in direct_plugin, so it's safe to move it there. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/__init__.py | 0 scripts/lib/wic/imager/direct.py| 402 scripts/lib/wic/plugins/imager/direct_plugin.py | 396 ++- 3 files changed, 380 insertions(+), 418 deletions(-) delete mode 100644 scripts/lib/wic/imager/__init__.py delete mode 100644 scripts/lib/wic/imager/direct.py diff --git a/scripts/lib/wic/imager/__init__.py b/scripts/lib/wic/imager/__init__.py deleted file mode 100644 index e69de29..000 diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py deleted file mode 100644 index ff06b50..000 --- a/scripts/lib/wic/imager/direct.py +++ /dev/null @@ -1,402 +0,0 @@ -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -# -# Copyright (c) 2013, Intel Corporation. -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# DESCRIPTION -# This implements the 'direct' image creator class for 'wic' -# -# AUTHORS -# Tom Zanussi -# - -import os -import shutil -import uuid -import tempfile - -from wic import msger -from wic.utils.oe.misc import get_bitbake_var -from wic.utils.partitionedfs import Image -from wic.utils.errors import CreatorError, ImageError -from wic.plugin import pluginmgr -from wic.utils.oe.misc import exec_cmd, exec_native_cmd - -disk_methods = { -"do_install_disk":None, -} - -class DiskImage(): -""" -A Disk backed by a file. -""" -def __init__(self, device, size): -self.size = size -self.device = device -self.created = False - -def exists(self): -return os.path.exists(self.device) - -def create(self): -if self.created: -return -# create sparse disk image -with open(self.device, 'w') as sparse: -os.ftruncate(sparse.fileno(), self.size) - -self.created = True - -class DirectImageCreator: -""" -Installs a system into a file containing a partitioned disk image. - -DirectImageCreator is an advanced ImageCreator subclass; an image -file is formatted with a partition table, each partition created -from a rootfs or other OpenEmbedded build artifact and dd'ed into -the virtual disk. The disk image can subsequently be dd'ed onto -media and used on actual hardware. -""" - -def __init__(self, image_name, ksobj, oe_builddir, image_output_dir, - rootfs_dir, bootimg_dir, kernel_dir, native_sysroot, - compressor, bmap=False): -""" -Initialize a DirectImageCreator instance. - -This method takes the same arguments as ImageCreator.__init__() -""" -self.name = image_name -self.outdir = image_output_dir -self.workdir = tempfile.mktemp(prefix='wic') -self.ks = ksobj - -self.__image = None -self.__disks = {} -self.__disk_format = "direct" -self._disk_names = [] -self.ptable_format = self.ks.bootloader.ptable - -self.oe_builddir = oe_builddir -self.rootfs_dir = rootfs_dir -self.bootimg_dir = bootimg_dir -self.kernel_dir = kernel_dir -self.native_sysroot = native_sysroot -self.compressor = compressor -self.bmap = bmap - -def _get_part_num(self, num, parts): -"""calculate the real partition number, accounting for partitions not -in the partition table and logical partitions -""" -realnum = 0 -for pnum, part in enumerate(parts, 1): -if not part.no_table: -realnum += 1 -if pnum == num: -if part.no_table: -return 0 -if self.ptable_format == 'msdos' and realnum > 3: -# account for logical partition numbering, ex. sda5.. -return realnum + 1 -return realnum - -def _write_fstab(self, ima
[OE-core] [PATCH 03/18] wic: removed conf.py and empty config file.
Removed as they're not used anymore in wic code. Signed-off-by: Ed Bartosh --- scripts/lib/wic/conf.py | 103 scripts/lib/wic/config/wic.conf | 6 --- 2 files changed, 109 deletions(-) delete mode 100644 scripts/lib/wic/conf.py delete mode 100644 scripts/lib/wic/config/wic.conf diff --git a/scripts/lib/wic/conf.py b/scripts/lib/wic/conf.py deleted file mode 100644 index 070ec30..000 --- a/scripts/lib/wic/conf.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2011 Intel, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -import os - -from wic.ksparser import KickStart, KickStartError -from wic import msger -from wic.utils import misc - - -def get_siteconf(): -wic_path = os.path.dirname(__file__) -eos = wic_path.find('scripts') + len('scripts') -scripts_path = wic_path[:eos] - -return scripts_path + "/lib/image/config/wic.conf" - -class ConfigMgr(object): -DEFAULTS = { -'common': { -"distro_name": "Default Distribution", -"plugin_dir": "/usr/lib/wic/plugins"}, # TODO use prefix also? -'create': { -"tmpdir": '/var/tmp/wic', -"outdir": './wic-output', -"release": None, -"logfile": None, -"name_prefix": None, -"name_suffix": None} -} - -# make the manager class as singleton -_instance = None -def __new__(cls, *args, **kwargs): -if not cls._instance: -cls._instance = super(ConfigMgr, cls).__new__(cls, *args, **kwargs) - -return cls._instance - -def __init__(self, ksconf=None, siteconf=None): -# reset config options -self.reset() - -if not siteconf: -siteconf = get_siteconf() - -# initial options from siteconf -self._siteconf = siteconf - -if ksconf: -self._ksconf = ksconf - -def reset(self): -self.__ksconf = None -self.__siteconf = None -self.create = {} - -# initialize the values with defaults -for sec, vals in self.DEFAULTS.items(): -setattr(self, sec, vals) - -def __set_ksconf(self, ksconf): -if not os.path.isfile(ksconf): -msger.error('Cannot find ks file: %s' % ksconf) - -self.__ksconf = ksconf -self._parse_kickstart(ksconf) -def __get_ksconf(self): -return self.__ksconf -_ksconf = property(__get_ksconf, __set_ksconf) - -def _parse_kickstart(self, ksconf=None): -if not ksconf: -return - -try: -ksobj = KickStart(ksconf) -except KickStartError as err: -msger.error(str(err)) - -self.create['ks'] = ksobj -self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0] - -self.create['name'] = misc.build_name(ksconf, - self.create['release'], - self.create['name_prefix'], - self.create['name_suffix']) - -configmgr = ConfigMgr() diff --git a/scripts/lib/wic/config/wic.conf b/scripts/lib/wic/config/wic.conf deleted file mode 100644 index a51bcb5..000 --- a/scripts/lib/wic/config/wic.conf +++ /dev/null @@ -1,6 +0,0 @@ -[common] -; general settings -distro_name = OpenEmbedded - -[create] -; settings for create subcommand -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 02/18] wic: direct_plugin: stop using config manager
This is a preparation to removing conf.py and config/wic.conf from the codebase. Got rid of using configmgr global object in direct_plugin and direct modules. It was used to implicitly parse kickstart file and set couple of variables. Replaced usage of configmgr by passing parameters directly to the DirectImageCreator. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/imager/direct.py| 10 +- scripts/lib/wic/plugins/imager/direct_plugin.py | 22 +++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 575fd95..ff06b50 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -72,18 +72,18 @@ class DirectImageCreator: media and used on actual hardware. """ -def __init__(self, oe_builddir, image_output_dir, rootfs_dir, - bootimg_dir, kernel_dir, native_sysroot, compressor, - creatoropts, bmap=False): +def __init__(self, image_name, ksobj, oe_builddir, image_output_dir, + rootfs_dir, bootimg_dir, kernel_dir, native_sysroot, + compressor, bmap=False): """ Initialize a DirectImageCreator instance. This method takes the same arguments as ImageCreator.__init__() """ -self.name = creatoropts['name'] +self.name = image_name self.outdir = image_output_dir self.workdir = tempfile.mktemp(prefix='wic') -self.ks = creatoropts['ks'] +self.ks = ksobj self.__image = None self.__disks = {} diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index 8fe3930..e839d2f 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py @@ -24,8 +24,12 @@ # Tom Zanussi # +from time import strftime + +from os.path import basename, splitext from wic.utils import errors -from wic.conf import configmgr +from wic.ksparser import KickStart, KickStartError +from wic import msger import wic.imager.direct as direct from wic.pluginbase import ImagerPlugin @@ -68,27 +72,31 @@ class DirectPlugin(ImagerPlugin): bootimg_dir = args[2] rootfs_dir = args[3] -creatoropts = configmgr.create ksconf = args[4] image_output_dir = args[5] oe_builddir = args[6] compressor = args[7] -krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir) +try: +ksobj = KickStart(ksconf) +except KickStartError as err: +msger.error(str(err)) -configmgr._ksconf = ksconf +image_name = "%s-%s" % (splitext(basename(ksconf))[0], + strftime("%Y%m%d%H%M")) +krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir) -creator = direct.DirectImageCreator(oe_builddir, +creator = direct.DirectImageCreator(image_name, +ksobj, +oe_builddir, image_output_dir, krootfs_dir, bootimg_dir, kernel_dir, native_sysroot, compressor, -creatoropts, opts.bmap) - try: creator.create() creator.assemble() -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 05/18] wic: get rid of __rootfs_dir_to_dict method
Replaced class method __rootfs_dir_to_dict with a list comprehension. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/imager/direct_plugin.py | 21 + 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index 91a9792..c6df5fb 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py @@ -53,21 +53,8 @@ class DirectPlugin(ImagerPlugin): name = 'direct' -@classmethod -def __rootfs_dir_to_dict(cls, rootfs_dirs): -""" -Gets a string that contain 'connection=dir' splitted by -space and return a dict -""" -krootfs_dir = {} -for rootfs_dir in rootfs_dirs.split(' '): -key, val = rootfs_dir.split('=') -krootfs_dir[key] = val - -return krootfs_dir - -@classmethod -def do_create(cls, opts, *args): +@staticmethod +def do_create(opts, *args): """ Create direct image, called from creator as 'direct' cmd """ @@ -92,7 +79,9 @@ class DirectPlugin(ImagerPlugin): image_name = "%s-%s" % (splitext(basename(ksconf))[0], strftime("%Y%m%d%H%M")) -krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir) + +# parse possible 'rootfs=name' items +krootfs_dir = dict(rdir.split('=') for rdir in rootfs_dir.split(' ')) creator = DirectImageCreator(image_name, ksobj, oe_builddir, image_output_dir, krootfs_dir, -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 09/18] wic: renamd direct_plugin.py -> direct.py
As this files is located in plugins/imager subdirectory it's obvious that it's an imager plugin. Renamed to direct.py to be consistent with plugin naming scheme. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/imager/{direct_plugin.py => direct.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/lib/wic/plugins/imager/{direct_plugin.py => direct.py} (100%) diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct.py similarity index 100% rename from scripts/lib/wic/plugins/imager/direct_plugin.py rename to scripts/lib/wic/plugins/imager/direct.py -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 08/18] wic: simplified code of direct_plugin
Removed unused methods. Got rid of get_default_source_plugin and _full_name methods. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/imager/direct_plugin.py | 24 ++-- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index 1d0d3ff..9cd7068 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py @@ -93,9 +93,6 @@ class DiskImage(): self.device = device self.created = False -def exists(self): -return os.path.exists(self.device) - def create(self): if self.created: return @@ -229,26 +226,9 @@ class DirectImageCreator: # partitions list from kickstart file return self.ks.partitions -def _full_name(self, name, extention): -""" Construct full file name for a file we generate. """ -return "%s-%s.%s" % (self.name, name, extention) - def _full_path(self, path, name, extention): """ Construct full file path to a file we generate. """ -return os.path.join(path, self._full_name(name, extention)) - -def get_default_source_plugin(self): -""" -The default source plugin i.e. the plugin that's consulted for -overall image generation tasks outside of any particular -partition. For convenience, we just hang it off the -bootloader handler since it's the one non-partition object in -any setup. By default the default plugin is set to the same -plugin as the /boot partition; since we hang it off the -bootloader object, the default can be explicitly set using the ---source bootloader param. -""" -return self.ks.bootloader.source +return os.path.join(path, "%s-%s.%s" % (self.name, name, extention)) # # Actual implemention @@ -346,7 +326,7 @@ class DirectImageCreator: For example, prepare the image to be bootable by e.g. creating and installing a bootloader configuration. """ -source_plugin = self.get_default_source_plugin() +source_plugin = self.ks.bootloader.source if source_plugin: name = "do_install_disk" methods = pluginmgr.get_source_plugin_methods(source_plugin, -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 07/18] wic: pylinted direct_plugin
Fixed wrong continued indentation, unused import and trailing new line pyling warnings. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/imager/direct_plugin.py | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index 48588db..1d0d3ff 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py @@ -27,7 +27,6 @@ import os import shutil import uuid import tempfile -import time from time import strftime from os.path import basename, splitext @@ -307,19 +306,13 @@ class DirectImageCreator: self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self._image.add_partition(part.disk_size, - part.disk, - part.mountpoint, - part.source_file, - part.fstype, - part.label, - fsopts=part.fsopts, - boot=part.active, - align=part.align, - no_table=part.no_table, - part_type=part.part_type, - uuid=part.uuid, - system_id=part.system_id) +self._image.add_partition(part.disk_size, part.disk, + part.mountpoint, part.source_file, + part.fstype, part.label, + fsopts=part.fsopts, boot=part.active, + align=part.align, no_table=part.no_table, + part_type=part.part_type, uuid=part.uuid, + system_id=part.system_id) if fstab_path: shutil.move(fstab_path + ".orig", fstab_path) @@ -443,4 +436,3 @@ class DirectImageCreator: # remove work directory shutil.rmtree(self.workdir, ignore_errors=True) - -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 06/18] wic: improve naming in direct_plugin classes
Synchronized attribure names in DirectImageCreator and DirectPlugin for better readability. Simplified code, removed unneeded global variable disk_methods. Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/imager/direct_plugin.py | 62 + 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index c6df5fb..48588db 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py @@ -58,50 +58,33 @@ class DirectPlugin(ImagerPlugin): """ Create direct image, called from creator as 'direct' cmd """ -if len(args) != 8: -raise errors.Usage("Extra arguments given") - -native_sysroot = args[0] -kernel_dir = args[1] -bootimg_dir = args[2] -rootfs_dir = args[3] - -ksconf = args[4] - -image_output_dir = args[5] -oe_builddir = args[6] -compressor = args[7] +native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, ksconf, \ +outdir, oe_builddir, compressor = args try: ksobj = KickStart(ksconf) except KickStartError as err: msger.error(str(err)) -image_name = "%s-%s" % (splitext(basename(ksconf))[0], +name = "%s-%s" % (splitext(basename(ksconf))[0], strftime("%Y%m%d%H%M")) # parse possible 'rootfs=name' items krootfs_dir = dict(rdir.split('=') for rdir in rootfs_dir.split(' ')) -creator = DirectImageCreator(image_name, ksobj, oe_builddir, - image_output_dir, krootfs_dir, - bootimg_dir, kernel_dir, native_sysroot, - compressor, opts.bmap) +creator = DirectImageCreator(name, ksobj, oe_builddir, outdir, + krootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, compressor, opts.bmap) try: creator.create() creator.assemble() creator.finalize() -creator.print_outimage_info() - +creator.print_info() except errors.CreatorError: raise finally: creator.cleanup() -disk_methods = { -"do_install_disk":None, -} - class DiskImage(): """ A Disk backed by a file. @@ -134,22 +117,22 @@ class DirectImageCreator: media and used on actual hardware. """ -def __init__(self, image_name, ksobj, oe_builddir, image_output_dir, - rootfs_dir, bootimg_dir, kernel_dir, native_sysroot, - compressor, bmap=False): +def __init__(self, name, ksobj, oe_builddir, outdir, + rootfs_dir, bootimg_dir, kernel_dir, + native_sysroot, compressor, bmap=False): """ Initialize a DirectImageCreator instance. This method takes the same arguments as ImageCreator.__init__() """ -self.name = image_name -self.outdir = image_output_dir +self.name = name +self.outdir = outdir self.workdir = tempfile.mktemp(prefix='wic') self.ks = ksobj -self.__image = None -self.__disks = {} -self.__disk_format = "direct" +self._image = None +self._disks = {} +self._disk_format = "direct" self._disk_names = [] self.ptable_format = self.ks.bootloader.ptable @@ -372,14 +355,13 @@ class DirectImageCreator: """ source_plugin = self.get_default_source_plugin() if source_plugin: -self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods) +name = "do_install_disk" +methods = pluginmgr.get_source_plugin_methods(source_plugin, + {name: None}) for disk_name, disk in self._image.disks.items(): -self._source_methods["do_install_disk"](disk, disk_name, self, -self.workdir, -self.oe_builddir, -self.bootimg_dir, -self.kernel_dir, -self.native_sysroot) +methods["do_install_disk"](disk, disk_name, self, self.workdir, + self.oe_builddir, self.bootimg_dir, +
[OE-core] [PATCH 10/18] wic: removed test file
This file is not used anywhere in the wic code. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 scripts/lib/wic/test diff --git a/scripts/lib/wic/test b/scripts/lib/wic/test deleted file mode 100644 index 9daeafb..000 --- a/scripts/lib/wic/test +++ /dev/null @@ -1 +0,0 @@ -test -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 11/18] wic: partition: simlify calling plugin methods
Replaced parse_sourceparams function with list comprehension. Used local variables instead of attributes. Moved global variable to the local scope. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/partition.py | 53 +++- scripts/lib/wic/utils/oe/misc.py | 23 - 2 files changed, 25 insertions(+), 51 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 49d1327..094a8c3 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -27,16 +27,10 @@ import os import tempfile -from wic.utils.oe.misc import msger, parse_sourceparams +from wic.utils.oe.misc import msger from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var from wic.plugin import pluginmgr -partition_methods = { -"do_stage_partition":None, -"do_prepare_partition":None, -"do_configure_partition":None, -} - class Partition(): def __init__(self, args, lineno): @@ -129,9 +123,6 @@ class Partition(): Prepare content for individual partitions, depending on partition command parameters. """ -if self.sourceparams: -self.sourceparams_dict = parse_sourceparams(self.sourceparams) - if not self.source: if not self.size and not self.fixed_size: msger.error("The %s partition has a size of zero. Please " @@ -164,24 +155,30 @@ class Partition(): "details on adding a new source plugin." % \ (self.source, self.mountpoint)) -self._source_methods = pluginmgr.get_source_plugin_methods(\ - self.source, partition_methods) -self._source_methods["do_configure_partition"](self, self.sourceparams_dict, - creator, cr_workdir, - oe_builddir, - bootimg_dir, - kernel_dir, - native_sysroot) -self._source_methods["do_stage_partition"](self, self.sourceparams_dict, - creator, cr_workdir, - oe_builddir, - bootimg_dir, kernel_dir, - native_sysroot) -self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, - creator, cr_workdir, - oe_builddir, - bootimg_dir, kernel_dir, rootfs_dir, - native_sysroot) +srcparams_dict = {} +if self.sourceparams: +# Split sourceparams string of the form key1=val1[,key2=val2,...] +# into a dict. Also accepts valueless keys i.e. without = +splitted = self.sourceparams.split(',') +srcparams_dict = dict(par.split('=') for par in splitted if par) + +partition_methods = { +"do_stage_partition": None, +"do_prepare_partition": None, +"do_configure_partition": None +} + +methods = pluginmgr.get_source_plugin_methods(self.source, + partition_methods) +methods["do_configure_partition"](self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, native_sysroot) +methods["do_stage_partition"](self, srcparams_dict, creator, + cr_workdir, oe_builddir, bootimg_dir, + kernel_dir, native_sysroot) +methods["do_prepare_partition"](self, srcparams_dict, creator, +cr_workdir, oe_builddir, bootimg_dir, +kernel_dir, rootfs_dir, native_sysroot) # further processing required Partition.size to be an integer, make # sure that it is one diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py index 3737c4b..6781d83 100644 --- a/scripts/lib/wic/utils/oe/misc.py +++ b/scripts/lib/wic/utils/oe/misc.py @@ -222,26 +222,3 @@ def get_bitbake_var(var, image=None, cache=True): get_var method of BB_VARS singleton. """ return BB_VARS.get_var(var, image, cache) - -def parse_sourceparams(sourceparams): -""&qu
[OE-core] [PATCH 13/18] wic: move 2 APIs to wic.engine
Moved find_canned and get_custom_config APIs to engine module. Removed empty wic.utils.misc module. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/engine.py | 33 - scripts/lib/wic/ksparser.py| 2 +- scripts/lib/wic/plugins/source/bootimg-efi.py | 2 +- scripts/lib/wic/plugins/source/bootimg-pcbios.py | 4 +- .../lib/wic/plugins/source/isoimage-isohybrid.py | 2 +- scripts/lib/wic/utils/misc.py | 56 -- 6 files changed, 37 insertions(+), 62 deletions(-) delete mode 100644 scripts/lib/wic/utils/misc.py diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 2adef2f..4abea87 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -32,7 +32,6 @@ import os import sys from wic import msger, creator -from wic.utils import misc from wic.plugin import pluginmgr from wic.utils.oe import misc @@ -226,3 +225,35 @@ def wic_list(args, scripts_path): return True return False + +def find_canned(scripts_path, file_name): +""" +Find a file either by its path or by name in the canned files dir. + +Return None if not found +""" +if os.path.exists(file_name): +return file_name + +layers_canned_wks_dir = build_canned_image_list(scripts_path) +for canned_wks_dir in layers_canned_wks_dir: +for root, dirs, files in os.walk(canned_wks_dir): +for fname in files: +if fname == file_name: +fullpath = os.path.join(canned_wks_dir, fname) +return fullpath + +def get_custom_config(boot_file): +""" +Get the custom configuration to be used for the bootloader. + +Return None if the file can't be found. +""" +# Get the scripts path of poky +scripts_path = os.path.abspath("%s/../.." % os.path.dirname(__file__)) + +cfg_file = find_canned(scripts_path, boot_file) +if cfg_file: +with open(cfg_file, "r") as f: +config = f.read() +return config diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 62c4902..41d3cc6 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -30,8 +30,8 @@ import shlex from argparse import ArgumentParser, ArgumentError, ArgumentTypeError from wic import msger +from wic.engine import find_canned from wic.partition import Partition -from wic.utils.misc import find_canned class KickStartError(Exception): """Custom exception.""" diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 74a1557..28b941e 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -28,8 +28,8 @@ import os import shutil from wic import msger +from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.utils.misc import get_custom_config from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \ BOOTDD_EXTRA_SPACE diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index cff8aec..283b834 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -26,10 +26,10 @@ import os -from wic.utils.errors import ImageError from wic import msger +from wic.engine import get_custom_config from wic.utils import runner -from wic.utils.misc import get_custom_config +from wic.utils.errors import ImageError from wic.pluginbase import SourcePlugin from wic.utils.oe.misc import exec_cmd, exec_native_cmd, \ get_bitbake_var, BOOTDD_EXTRA_SPACE diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index bceaa84..4979d8e 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -26,8 +26,8 @@ import shutil import glob from wic import msger +from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.utils.misc import get_custom_config from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var class IsoImagePlugin(SourcePlugin): diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py deleted file mode 100644 index 7d09f6f..000 --- a/scripts/lib/wic/utils/misc.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2010, 2011 Intel Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This progra
[OE-core] [PATCH 12/18] wci: misc: removed build_name API
This API is not used in wic code. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/utils/misc.py | 39 --- 1 file changed, 39 deletions(-) diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py index 1415ae9..7d09f6f 100644 --- a/scripts/lib/wic/utils/misc.py +++ b/scripts/lib/wic/utils/misc.py @@ -19,45 +19,6 @@ import os import time import wic.engine -def build_name(kscfg, release=None, prefix=None, suffix=None): -"""Construct and return an image name string. - -This is a utility function to help create sensible name and fslabel -strings. The name is constructed using the sans-prefix-and-extension -kickstart filename and the supplied prefix and suffix. - -kscfg -- a path to a kickstart file -release -- a replacement to suffix for image release -prefix -- a prefix to prepend to the name; defaults to None, which causes - no prefix to be used -suffix -- a suffix to append to the name; defaults to None, which causes - a MMDDHHMM suffix to be used - -Note, if maxlen is less then the len(suffix), you get to keep both pieces. - -""" -name = os.path.basename(kscfg) -idx = name.rfind('.') -if idx >= 0: -name = name[:idx] - -if release is not None: -suffix = "" -if prefix is None: -prefix = "" -if suffix is None: -suffix = time.strftime("%Y%m%d%H%M") - -if name.startswith(prefix): -name = name[len(prefix):] - -prefix = "%s-" % prefix if prefix else "" -suffix = "-%s" % suffix if suffix else "" - -ret = prefix + name + suffix - -return ret - def find_canned(scripts_path, file_name): """ Find a file either by its path or by name in the canned files dir. -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 15/18] wic: removed code from __init__.py
The code deals with non-existing directory and can be removed. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/__init__.py | 4 1 file changed, 4 deletions(-) diff --git a/scripts/lib/wic/__init__.py b/scripts/lib/wic/__init__.py index 63c1d9c..e69de29 100644 --- a/scripts/lib/wic/__init__.py +++ b/scripts/lib/wic/__init__.py @@ -1,4 +0,0 @@ -import os, sys - -cur_path = os.path.dirname(__file__) or '.' -sys.path.insert(0, cur_path + '/3rdparty') -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 14/18] wic: move oe/misc.py one level up
Flattened directory structure: moved wic/utils/oe/misc.py -> wic/utils/misc.py [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/engine.py| 4 ++-- scripts/lib/wic/partition.py | 4 ++-- scripts/lib/wic/plugin.py| 2 +- scripts/lib/wic/plugins/imager/direct.py | 2 +- scripts/lib/wic/plugins/source/bootimg-efi.py| 4 ++-- scripts/lib/wic/plugins/source/bootimg-partition.py | 2 +- scripts/lib/wic/plugins/source/bootimg-pcbios.py | 4 ++-- scripts/lib/wic/plugins/source/fsimage.py| 2 +- scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 2 +- scripts/lib/wic/plugins/source/rawcopy.py| 2 +- scripts/lib/wic/plugins/source/rootfs.py | 2 +- scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py | 8 scripts/lib/wic/utils/{oe => }/misc.py | 0 scripts/lib/wic/utils/partitionedfs.py | 2 +- scripts/wic | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) rename scripts/lib/wic/utils/{oe => }/misc.py (100%) diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 4abea87..685bc88 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -33,7 +33,7 @@ import sys from wic import msger, creator from wic.plugin import pluginmgr -from wic.utils.oe import misc +from wic.utils.misc import get_bitbake_var def verify_build_env(): @@ -54,7 +54,7 @@ SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR WIC_DIR = "wic" def build_canned_image_list(path): -layers_path = misc.get_bitbake_var("BBLAYERS") +layers_path = get_bitbake_var("BBLAYERS") canned_wks_layer_dirs = [] if layers_path is not None: diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 094a8c3..31a0350 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -27,8 +27,8 @@ import os import tempfile -from wic.utils.oe.misc import msger -from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var +from wic import msger +from wic.utils.misc import exec_cmd, exec_native_cmd, get_bitbake_var from wic.plugin import pluginmgr class Partition(): diff --git a/scripts/lib/wic/plugin.py b/scripts/lib/wic/plugin.py index 306b324..6b06ed6 100644 --- a/scripts/lib/wic/plugin.py +++ b/scripts/lib/wic/plugin.py @@ -20,7 +20,7 @@ import os, sys from wic import msger from wic import pluginbase from wic.utils import errors -from wic.utils.oe.misc import get_bitbake_var +from wic.utils.misc import get_bitbake_var __ALL__ = ['PluginMgr', 'pluginmgr'] diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 9cd7068..592412a 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -37,7 +37,7 @@ from wic.plugin import pluginmgr from wic.pluginbase import ImagerPlugin from wic.utils import errors from wic.utils.errors import CreatorError, ImageError -from wic.utils.oe.misc import get_bitbake_var, exec_cmd, exec_native_cmd +from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd from wic.utils.partitionedfs import Image class DirectPlugin(ImagerPlugin): diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 28b941e..2b66a58 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -30,8 +30,8 @@ import shutil from wic import msger from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var, \ - BOOTDD_EXTRA_SPACE +from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, +BOOTDD_EXTRA_SPACE) class BootimgEFIPlugin(SourcePlugin): """ diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index b76c121..f94dfab 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -28,7 +28,7 @@ import re from wic import msger from wic.pluginbase import SourcePlugin -from wic.utils.oe.misc import exec_cmd, get_bitbake_var +from wic.utils.misc import exec_cmd, get_bitbake_var from glob import glob class BootimgPartitionPlugin(SourcePlugin): diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 283b834..d796433 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -31,8 +31,8 @@ from wic.engine import get_custom_config from wic.utils import runner fr
[OE-core] [PATCH 16/18] wic: msger.py: remove unused APIs
Removed unused enable_logstderr and disable_logstderr APIs. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/msger.py | 26 -- 1 file changed, 26 deletions(-) diff --git a/scripts/lib/wic/msger.py b/scripts/lib/wic/msger.py index fb8336d..dc9b734 100644 --- a/scripts/lib/wic/msger.py +++ b/scripts/lib/wic/msger.py @@ -207,29 +207,3 @@ def set_logfile(fpath): import atexit atexit.register(_savelogf) - -def enable_logstderr(fpath): -global CATCHERR_BUFFILE_FD -global CATCHERR_BUFFILE_PATH -global CATCHERR_SAVED_2 - -if os.path.exists(fpath): -os.remove(fpath) -CATCHERR_BUFFILE_PATH = fpath -CATCHERR_BUFFILE_FD = os.open(CATCHERR_BUFFILE_PATH, os.O_RDWR|os.O_CREAT) -CATCHERR_SAVED_2 = os.dup(2) -os.dup2(CATCHERR_BUFFILE_FD, 2) - -def disable_logstderr(): -global CATCHERR_BUFFILE_FD -global CATCHERR_BUFFILE_PATH -global CATCHERR_SAVED_2 - -raw(msg=None) # flush message buffer and print it. -os.dup2(CATCHERR_SAVED_2, 2) -os.close(CATCHERR_SAVED_2) -os.close(CATCHERR_BUFFILE_FD) -os.unlink(CATCHERR_BUFFILE_PATH) -CATCHERR_BUFFILE_FD = -1 -CATCHERR_BUFFILE_PATH = None -CATCHERR_SAVED_2 = -1 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 17/18] wic: code cleanup
Fixed indentation, unused imports, trailing lines etc. [YOCTO #10619] Signed-off-by: Ed Bartosh --- scripts/lib/wic/__version__.py | 1 - scripts/lib/wic/engine.py| 2 +- scripts/lib/wic/help.py | 4 ++-- scripts/lib/wic/partition.py | 11 +++ scripts/lib/wic/plugin.py| 3 ++- scripts/lib/wic/pluginbase.py| 1 - scripts/lib/wic/plugins/imager/direct.py | 3 +-- scripts/lib/wic/plugins/source/bootimg-efi.py| 14 +++--- scripts/lib/wic/plugins/source/bootimg-partition.py | 4 ++-- scripts/lib/wic/plugins/source/bootimg-pcbios.py | 4 +--- scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 11 +-- scripts/lib/wic/plugins/source/rawcopy.py| 1 - scripts/lib/wic/plugins/source/rootfs.py | 4 ++-- scripts/lib/wic/utils/misc.py| 9 +++-- scripts/lib/wic/utils/partitionedfs.py | 7 +++ 15 files changed, 36 insertions(+), 43 deletions(-) delete mode 100644 scripts/lib/wic/__version__.py diff --git a/scripts/lib/wic/__version__.py b/scripts/lib/wic/__version__.py deleted file mode 100644 index 5452a46..000 --- a/scripts/lib/wic/__version__.py +++ /dev/null @@ -1 +0,0 @@ -VERSION = "2.00" diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 685bc88..592ef77 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -190,7 +190,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, crobj = creator.Creator() cmdline = ["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, -wks_file, image_output_dir, oe_builddir, compressor or ""] + wks_file, image_output_dir, oe_builddir, compressor or ""] if bmap: cmdline.append('--bmap') diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index daa11bf..1bd411d 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -31,7 +31,7 @@ import logging from wic.plugin import pluginmgr, PLUGIN_TYPES def subcommand_error(args): -logging.info("invalid subcommand %s" % args[0]) +logging.info("invalid subcommand %s", args[0]) def display_help(subcommand, subcommands): @@ -87,7 +87,7 @@ def invoke_subcommand(args, parser, main_command_usage, subcommands): elif args[0] == "help": wic_help(args, main_command_usage, subcommands) elif args[0] not in subcommands: -logging.error("Unsupported subcommand %s, exiting\n" % (args[0])) +logging.error("Unsupported subcommand %s, exiting\n", args[0]) parser.print_help() return 1 else: diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 31a0350..69b369c 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -182,7 +182,7 @@ class Partition(): # further processing required Partition.size to be an integer, make # sure that it is one -if type(self.size) is not int: +if not isinstance(self.size, int): msger.error("Partition %s internal size is not an integer. " \ "This a bug in source plugin %s and needs to be fixed." \ % (self.mountpoint, self.source)) @@ -242,7 +242,10 @@ class Partition(): # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE rsize_bb = get_bitbake_var('ROOTFS_SIZE') if rsize_bb: -msger.warning('overhead-factor was specified, but size was not, so bitbake variables will be used for the size. In this case both IMAGE_OVERHEAD_FACTOR and --overhead-factor will be applied') +msger.warning('overhead-factor was specified, but size was not,' + ' so bitbake variables will be used for the size.' + ' In this case both IMAGE_OVERHEAD_FACTOR and ' + '--overhead-factor will be applied') self.size = int(round(float(rsize_bb))) for prefix in ("ext", "btrfs", "vfat", "squashfs"): @@ -402,7 +405,8 @@ class Partition(): "Proceeding as requested." % self.mountpoint) path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) -os.path.isfile(path) and os.remove(path) +if os.path.isfile(path): +os.remove(path) # it is not possible to create a squashfs without source data, # thus prepare an empty temp dir that is used as source @@ -436,4 +440,3 @@ class Partition(): label_str = "-L
[OE-core] [PATCH 18/18] wic: remove syslinux.py
This module contains singe function serial_console_form_kargs, which is used only by rootfs_pcbios_ext plugin. Moved it there and removed syslinux module to make it easy to find and mainain plugin code. [YOCTO #10619] Signed-off-by: Ed Bartosh --- .../lib/wic/plugins/source/rootfs_pcbios_ext.py| 38 +- scripts/lib/wic/utils/syslinux.py | 58 -- 2 files changed, 37 insertions(+), 59 deletions(-) delete mode 100644 scripts/lib/wic/utils/syslinux.py diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py index 1032019..bd6fd6c 100644 --- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py +++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py @@ -19,13 +19,49 @@ # import os +import re + from wic import msger -from wic.utils import syslinux from wic.utils import runner from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd from wic.utils.errors import ImageError from wic.pluginbase import SourcePlugin +def serial_console_form_kargs(kernel_args): +""" +Create SERIAL... line from kernel parameters + +syslinux needs a line SERIAL port [baudrate [flowcontrol]] +in the syslinux.cfg file. The config line is generated based +on kernel boot parameters. The the parameters of the first +ttyS console are considered for syslinux config. +@param kernel_args kernel command line +@return line for syslinux config file e.g. "SERIAL 0 115200" +""" +syslinux_conf = "" +for param in kernel_args.split(): +param_match = re.match("console=ttyS([0-9]+),?([0-9]*)([noe]?)([0-9]?)(r?)", param) +if param_match: +syslinux_conf += "SERIAL " + param_match.group(1) +# baudrate +if param_match.group(2): +syslinux_conf += " " + param_match.group(2) +# parity +if param_match.group(3) and param_match.group(3) != 'n': +msger.warning("syslinux does not support parity for console. {} is ignored." + .format(param_match.group(3))) +# number of bits +if param_match.group(4) and param_match.group(4) != '8': +msger.warning("syslinux supports 8 bit console configuration only. {} is ignored." + .format(param_match.group(4))) +# flow control +if param_match.group(5) and param_match.group(5) != '': +msger.warning("syslinux console flowcontrol configuration. {} is ignored." + .format(param_match.group(5))) +break + +return syslinux_conf + # pylint: disable=no-init class RootfsPlugin(SourcePlugin): diff --git a/scripts/lib/wic/utils/syslinux.py b/scripts/lib/wic/utils/syslinux.py deleted file mode 100644 index aace286..000 --- a/scripts/lib/wic/utils/syslinux.py +++ /dev/null @@ -1,58 +0,0 @@ -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# AUTHOR -# Adrian Freihofer - - -import re -from wic import msger - - -def serial_console_form_kargs(kernel_args): -""" -Create SERIAL... line from kernel parameters - -syslinux needs a line SERIAL port [baudrate [flowcontrol]] -in the syslinux.cfg file. The config line is generated based -on kernel boot parameters. The the parameters of the first -ttyS console are considered for syslinux config. -@param kernel_args kernel command line -@return line for syslinux config file e.g. "SERIAL 0 115200" -""" -syslinux_conf = "" -for param in kernel_args.split(): -param_match = re.match("console=ttyS([0-9]+),?([0-9]*)([noe]?)([0-9]?)(r?)", param) -if param_match: -syslinux_conf += "SERIAL " + param_match.group(1) -# baudrate -if param_match.group(2): -syslinux_conf += " " + param_match.group(2) -# parity -if param_match.group(3) and param_match.group(3) != 'n': -
Re: [OE-core] [PATCH v3 01/11] image-wic: move wic code to image-wic.bbclass
BTW, to be consistent with this approach we also need to rename image-live and image-vm, right? Actually, image-live name was the reason for me to name image-wic. On Mon, Jan 30, 2017 at 11:07:22AM -0800, Rick Altherr wrote: > LGTM > > On Mon, Jan 30, 2017 at 10:42 AM, Ed Bartosh > wrote: > > > On Mon, Jan 30, 2017 at 10:41:27AM -0800, Rick Altherr wrote: > > > Agreed. What if it was image_types_wic.bbclass and you did something > > > similar to build_uboot() in image.bbclass? > > > > > > > I can do this for now: > > IMAGE_TYPE_wic = "image_type_wic" > > inherit ${IMAGE_TYPE_wic} > > > > which is the same as 'inherit image_type_wic', just takes 2 lines, but > > looks more consistent. > > > > does this look ok? > > > > > On Mon, Jan 30, 2017 at 10:15 AM, Ed Bartosh > > > > > wrote: > > > > > > > On Mon, Jan 30, 2017 at 10:25:59AM -0800, Rick Altherr wrote: > > > > > I'm not clear on which path is the preferred one. There are lots of > > bits > > > > > and pieces in image_types.bbclass that implement various image types. > > > > > uboot got added as a separate class at some point. The comments in > > > > > local.conf.sample.extended imply IMAGE_CLASSES should be used to load > > > > > additional image_types_* classes to add support for additional image > > > > > types. Having the wic image type implemented in a separate > > > > > image-wic.bbclass that is directly inherited by image.bbclass adds a > > 3rd > > > > > approach. Which one do we want contributors to use in the future? > > > > > > > > > > > > > I didn't want to create even more confusion. What I wanted is stated > > in the > > > > commit message - to put existing wic code into a file for better > > > > maintenance. If this is more confusing than having wic code in > > different > > > > places of image.class and image_types.class then we can just drop this > > > > patch. However, I personally find it more maintainable this way. > > > > > > > > Suggesting people to change machine configs just because wic code is > > > > moved to separate file doesn't look good to me either. > > > > > > > > > On Mon, Jan 30, 2017 at 9:45 AM, Ed Bartosh < > > ed.bart...@linux.intel.com> > > > > > wrote: > > > > > > > > > > > On Mon, Jan 30, 2017 at 09:47:42AM -0800, Rick Altherr wrote: > > > > > > > Hmm. In local.conf.sample.extended, I find: > > > > > > > > > > > > > > # Additional image generation features > > > > > > > # > > > > > > > # The following is a list of classes to import to use in the > > > > generation > > > > > > of > > > > > > > images > > > > > > > # currently an example class is image_types_uboot > > > > > > > # IMAGE_CLASSES = " image_types_uboot" > > > > > > > > > > > > > > Indeed, image_types_uboot isn't part of IMAGE_CLASSES by default. > > > > I'd > > > > > > > expect a machine config to add wic to IMAGE_CLASSES if it needs > > wic > > > > > > output. > > > > > > > > > > > > > > > > > > > So far all machine configs add wic to IMAGE_TYPES and it works just > > > > > > fine. Why to change? > > > > > > > > > > > > > On Mon, Jan 30, 2017 at 9:18 AM, Ed Bartosh < > > > > ed.bart...@linux.intel.com> > > > > > > > wrote: > > > > > > > > > > > > > > > On Mon, Jan 30, 2017 at 09:27:54AM -0800, Rick Altherr wrote: > > > > > > > > > Why didn't you make this image_types_wic.bbclass and use > > > > > > IMAGE_CLASSES to > > > > > > > > > load it? > > > > > > > > > > > > > > > > Because of the following: > > > > > > > > - IMAGE_CLASSES[doc] = "A list of classes that all images > > should > > > > > > > > inherit." I'm not sure all images should include wic class. > > I'll > > > > > > probably > > > > > > > > make this inheritance conditional. > > > > &
[OE-core] [PATCH] image: rename image-wic -> image_types_wic
Make name of the wic image type class consistent with existing naming scheme for image types. Signed-off-by: Ed Bartosh --- meta/classes/image.bbclass | 5 +++-- meta/classes/{image-wic.bbclass => image_types_wic.bbclass} | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename meta/classes/{image-wic.bbclass => image_types_wic.bbclass} (100%) diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 613cd92..b5a4fb4 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -151,6 +151,9 @@ def build_uboot(d): IMAGE_TYPE_uboot = "${@build_uboot(d)}" inherit ${IMAGE_TYPE_uboot} +IMAGE_TYPE_wic = "image_types_wic" +inherit ${IMAGE_TYPE_wic} + python () { deps = " " + imagetypes_getdepends(d) d.appendVarFlag('do_rootfs', 'depends', deps) @@ -187,8 +190,6 @@ python () { IMAGE_CLASSES += "image_types" inherit ${IMAGE_CLASSES} -inherit image-wic - IMAGE_POSTPROCESS_COMMAND ?= "" # some default locales diff --git a/meta/classes/image-wic.bbclass b/meta/classes/image_types_wic.bbclass similarity index 100% rename from meta/classes/image-wic.bbclass rename to meta/classes/image_types_wic.bbclass -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] selftest: wic: stop using hddimg in FSTYPES
Removed hddimg from FSTYPES in wic test suite as wic doesn't depend on hddimg anymore. [YOCTO #10835] Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 6a6b54c..ebf3d18 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -151,7 +151,7 @@ class Wic(oeSelfTest): @testcase(1346) def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" -config = 'IMAGE_FSTYPES += " hddimg "\nMACHINE_FEATURES_append = " efi"\n' +config = 'MACHINE_FEATURES_append = " efi"\n' self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) @@ -184,7 +184,7 @@ class Wic(oeSelfTest): @testcase(1560) def test_systemd_bootdisk(self): """Test creation of systemd-bootdisk image""" -config = 'IMAGE_FSTYPES += " hddimg "\nMACHINE_FEATURES_append = " efi"\n' +config = 'MACHINE_FEATURES_append = " efi"\n' self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) @@ -406,7 +406,7 @@ class Wic(oeSelfTest): @testcase(1351) def test_wic_image_type(self): """Test building wic images by bitbake""" -config = 'IMAGE_FSTYPES += " hddimg wic"\nWKS_FILE = "wic-image-minimal"\n'\ +config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ 'MACHINE_FEATURES_append = " efi"\n' self.append_config(config) self.assertEqual(0, bitbake('wic-image-minimal').status) @@ -425,7 +425,7 @@ class Wic(oeSelfTest): @testcase(1422) def test_qemu(self): """Test wic-image-minimal under qemu""" -config = 'IMAGE_FSTYPES += " hddimg wic"\nWKS_FILE = "wic-image-minimal"\n'\ +config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ 'MACHINE_FEATURES_append = " efi"\n' self.append_config(config) self.assertEqual(0, bitbake('wic-image-minimal').status) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 0/3] wic: fix creation of working directory
Hi, Changed working directory to be subdirectory of output dir. This should fix several possible issues: - current code uses mktemp which doesn't create anything - default temporary directory is created in /tmp, which can cause wic to take long time to move result image as output directory can be on another partition - possible disk space issues due to the /tmp usage The following changes since commit 7d75fd29296a9c411881b4288bff2e02cb145a25: wic: remove syslinux.py (2017-02-01 12:46:17 +0200) are available in the git repository at: git://git.yoctoproject.org/poky-contrib ed/wic/refactoring-10619 http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/refactoring-10619 Ed Bartosh (3): wic: engine: create output dir wic: direct: fix creation of work directory wic: get rid of image_output_dir variable scripts/lib/wic/engine.py| 3 +++ scripts/lib/wic/plugins/imager/direct.py | 2 +- scripts/wic | 6 +- 3 files changed, 5 insertions(+), 6 deletions(-) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/3] wic: engine: create output dir
Make sure output directory exists before creating an image. Create it if it doesn't exist. Signed-off-by: Ed Bartosh --- scripts/lib/wic/engine.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 592ef77..7fb6f13 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -187,6 +187,9 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, if debug: msger.set_loglevel('debug') +if not os.path.exists(image_output_dir): +os.makedirs(image_output_dir) + crobj = creator.Creator() cmdline = ["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/3] wic: get rid of image_output_dir variable
Used options.outdir instead of image_output_dir. There is no sense to use extra variable for this. Signed-off-by: Ed Bartosh --- scripts/wic | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/wic b/scripts/wic index 33355ee..17e8231 100755 --- a/scripts/wic +++ b/scripts/wic @@ -203,10 +203,6 @@ def wic_create_subcommand(args, usage_str): "kickstart (.wks) filename)\n" % args[0]) sys.exit(1) -image_output_dir = "" -if options.outdir: -image_output_dir = options.outdir - if not options.image_name: rootfs_dir = '' if 'ROOTFS_DIR' in options.rootfs_dir: @@ -254,7 +250,7 @@ def wic_create_subcommand(args, usage_str): print("Creating image(s)...\n") engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, - native_sysroot, scripts_path, image_output_dir, + native_sysroot, scripts_path, options.outdir, options.compressor, options.bmap, options.debug) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 2/3] wic: direct: fix creation of work directory
It was a typo in current code: mktemp was used instead of mkdtemp to create work directory. This is fixed by using mkdtemp. Create work directory as a subdirectory of output directory to make sure both are on the same partition to make moving of result image faster. This also fixes possible disk space issues as mkdtemp uses TMPDIR, TEMP or TMP environment variables to get default value of its 'dir' parameter. Those variables are usually pointing to /tmp, which is not the best location to create huge images. Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/imager/direct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 4637fbf3..b38e876 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -122,7 +122,7 @@ class DirectImageCreator: """ self.name = name self.outdir = outdir -self.workdir = tempfile.mktemp(prefix='wic') +self.workdir = tempfile.mkdtemp(dir=outdir, prefix='tmp.wic.') self.ks = ksobj self._image = None -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] image_types_wic: remove dependency to do_bootimg
Removing task dependency do_wic -> do_bootimg as wic doesn't depend on hddimg/booimg anymore. Signed-off-by: Ed Bartosh --- meta/classes/image_types_wic.bbclass | 5 - 1 file changed, 5 deletions(-) diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass index 3e98959..ec6c14d 100644 --- a/meta/classes/image_types_wic.bbclass +++ b/meta/classes/image_types_wic.bbclass @@ -41,11 +41,6 @@ WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH} 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 -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: isoimage-isohybrid: use wic-tools to get syslinux path
wic-tools recipe specific sysroot contains syslinux as wic-tools depends on it. Used wic-tools target to get syslinux path should guarantee that syslinux is installed there and can be used. Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index 56bb62d..ca28bc0 100644 --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -410,7 +410,7 @@ class IsoImagePlugin(SourcePlugin): exec_cmd(chmod_cmd) # Prepare files for legacy boot -syslinux_dir = get_bitbake_var("STAGING_DATADIR") +syslinux_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") if not syslinux_dir: msger.error("Couldn't find STAGING_DATADIR, exiting.\n") -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] selftest: wic: use wic-tools recipe to get STAGING_DIR
STAGING_DIR variable is used to get path to a boot dir. It's better to use wic-tools recipe to it as it contains all bootloader artifacts. Modified test_build_artifacts and test_rootfs_artifacts to use wic-tools target to get STAGING_DIR. Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 39ec5a2..417ba3d 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -212,9 +212,12 @@ class Wic(oeSelfTest): @testcase(1212) def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" -bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) - for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS')) -bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') +variables = (('STAGING_DATADIR', 'wic-tools'), + ('RECIPE_SYSROOT_NATIVE', 'wic-tools'), + ('DEPLOY_DIR_IMAGE', 'core-image-minimal'), + ('IMAGE_ROOTFS', 'core-image-minimal')) +bbvars = {var.lower(): get_bb_var(var, recipe) \ + for var, recipe in variables} bbvars['resultdir'] = self.resultdir status = runCmd("wic create directdisk " "-b %(staging_datadir)s " @@ -318,9 +321,12 @@ class Wic(oeSelfTest): @testcase(1269) def test_rootfs_artifacts(self): """Test usage of rootfs plugin with rootfs paths""" -bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) - for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS')) -bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') +variables = (('STAGING_DATADIR', 'wic-tools'), + ('RECIPE_SYSROOT_NATIVE', 'wic-tools'), + ('DEPLOY_DIR_IMAGE', 'core-image-minimal'), + ('IMAGE_ROOTFS', 'core-image-minimal')) +bbvars = {var.lower(): get_bb_var(var, recipe) \ + for var, recipe in variables} bbvars['wks'] = "directdisk-multi-rootfs" bbvars['resultdir'] = self.resultdir status = runCmd("wic create %(wks)s " -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] selftest: wic: stop using iso image type
Removed 'IMAGE_FSTYPES = "iso" as this functionality depends on do_bootimg, which is going to be obsoleted soon. As wic doesn't depend on bootimg it's safe to remove this. Signed-off-by: Ed Bartosh --- meta/lib/oeqa/selftest/wic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 07b8312..417ba3d 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -42,8 +42,7 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES = "iso"\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 @@ -151,7 +150,8 @@ class Wic(oeSelfTest): @testcase(1346) def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" -config = 'MACHINE_FEATURES_append = " efi"\n' +config = 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\ + 'MACHINE_FEATURES_append = " efi"\n' self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: fix call of serial_console_form_kargs
As syslinux module has been recently removed and serial_consloe_form_kargs became local API in rootfs_pcbios_ext plugin it should be called without syslinux. prefix. Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py index bd6fd6c..cb1da93 100644 --- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py +++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py @@ -122,7 +122,7 @@ class RootfsPlugin(SourcePlugin): syslinux_conf += "ALLOWOPTIONS 1\n" # Derive SERIAL... line from from kernel boot parameters -syslinux_conf += syslinux.serial_console_form_kargs(options) + "\n" +syslinux_conf += serial_console_form_kargs(options) + "\n" syslinux_conf += "DEFAULT linux\n" syslinux_conf += "LABEL linux\n" -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: flatten imager class hierarchy
wic code is hard to follow due to deep and twiggy class inheritance tree. Flatten imager tree: wic -> wic_create -> Creator -> DirectPlugin -> DirectImageCreator to wic -> wic_create -> DirectPlugin by removing Creator class and creator module merging DirectImageCreator into DirectPlugin Changed APIs to use the same parameters names. Passed parsed command line options as an object down the stack. Signed-off-by: Ed Bartosh --- scripts/lib/wic/creator.py | 106 -- scripts/lib/wic/engine.py| 32 - scripts/lib/wic/plugins/imager/direct.py | 108 +++ scripts/wic | 3 +- 4 files changed, 56 insertions(+), 193 deletions(-) delete mode 100644 scripts/lib/wic/creator.py diff --git a/scripts/lib/wic/creator.py b/scripts/lib/wic/creator.py deleted file mode 100644 index 74db83c..000 --- a/scripts/lib/wic/creator.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python -tt -# -# Copyright (c) 2011 Intel, Inc. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the Free -# Software Foundation; version 2 of the License -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., 59 -# Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -import os, sys -from optparse import OptionParser, SUPPRESS_HELP - -from wic import msger -from wic.utils import errors -from wic.plugin import pluginmgr - -class Creator(): -"""${name}: create an image - -Usage: -${name} SUBCOMMAND [OPTS] - -${command_list} -${option_list} -""" - -name = 'wic create(cr)' - -def __init__(self, *args, **kwargs): -self._subcmds = {} - -# get cmds from pluginmgr -# mix-in do_subcmd interface -for subcmd, klass in pluginmgr.get_plugins('imager').items(): -if not hasattr(klass, 'do_create'): -msger.warning("Unsupported subcmd: %s" % subcmd) -continue - -func = getattr(klass, 'do_create') -self._subcmds[subcmd] = func - -def get_optparser(self): -optparser = OptionParser() -optparser.add_option('-d', '--debug', action='store_true', - dest='debug', - help=SUPPRESS_HELP) -optparser.add_option('-v', '--verbose', action='store_true', - dest='verbose', - help=SUPPRESS_HELP) -optparser.add_option('', '--logfile', type='string', dest='logfile', - default=None, - help='Path of logfile') -optparser.add_option('-c', '--config', type='string', dest='config', - default=None, - help='Specify config file for wic') -optparser.add_option('-o', '--outdir', type='string', action='store', - dest='outdir', default=None, - help='Output directory') -optparser.add_option('', '--tmpfs', action='store_true', dest='enabletmpfs', - help='Setup tmpdir as tmpfs to accelerate, experimental' - ' feature, use it if you have more than 4G memory') -optparser.add_option('', '--bmap', action='store_true', help='generate .bmap') -return optparser - -def postoptparse(self, options): -abspath = lambda pth: os.path.abspath(os.path.expanduser(pth)) - -if options.verbose: -msger.set_loglevel('verbose') -if options.debug: -msger.set_loglevel('debug') - -if options.logfile: -logfile_abs_path = abspath(options.logfile) -if os.path.isdir(logfile_abs_path): -raise errors.Usage("logfile's path %s should be file" - % options.logfile) -if not os.path.exists(os.path.dirname(logfile_abs_path)): -os.makedirs(os.path.dirname(logfile_abs_path)) -msger.set_in
Re: [OE-core] [PATCH v4 2/2] selftest/wic: Add tests for --exclude-dir option.
On Mon, Feb 06, 2017 at 05:16:45PM +0100, Kristian Amlie wrote: > > Rebased and reran tests. Changes since last patchset: > > - Because of recipe specific sysroots we now need to import the PATH > used by wic-tools into the test in order to use its tools. > > - Add specific '-o' parameter while testing wic so that we write into > resultdir. > > - Several unrelated changes to poky now means that we need to use an > absolute path for new_rootfs in the rootfs.py implementation. This > would have been a good idea from the start anyway. > > I hope there are no more outstanding issues with this patchset. > The patchset looks good to me. All wic test cases have been passed. -- Regards, Ed -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 0/9] #10619: refactor wic codebase (continuation)
Hi, This patchset simplifies interfaces of DirectPlugin and underlying set of APIs located in partitionedfs module. It also removes one of two different structures for partitioning info. The following changes since commit a624cf7f95c8cf4ff764cc997fd1db4601b97dcc: oeqa/selftest/pkgdata: use m4 instead of bash (2017-02-07 14:50:10 +) 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 (9): wic: partitionedfs: merged __format_disks and create wic: partitionedfs: get rid of __add_partition wic: partitionedfs: rename __create_partition and __add_disk wic: direct: get rid of _get_parts getter wic: use the same partition object in direct and partitionedfs wic: make sure layout_partitions is called once wic: direct: remove unused plugin attributes wic: direct: remove unused import wic: remove unused argument scripts_path scripts/lib/wic/engine.py| 7 +- scripts/lib/wic/partition.py | 2 + scripts/lib/wic/plugins/imager/direct.py | 54 ++--- scripts/lib/wic/utils/partitionedfs.py | 197 --- scripts/wic | 2 +- 5 files changed, 95 insertions(+), 167 deletions(-) -- Regards, Ed -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 2/9] wic: partitionedfs: get rid of __add_partition
3 lines long private method __add_partition is called only from add_partition method. Merged them together to increase readability. Signed-off-by: Ed Bartosh --- scripts/lib/wic/utils/partitionedfs.py | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 08ae52f..2cfdf70 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -80,15 +80,6 @@ class Image(): self.disks[disk_name]['disk'] = disk_obj self.disks[disk_name]['identifier'] = identifier -def __add_partition(self, part): -""" This is a helper function for 'add_partition()' which adds a -partition to the internal list of partitions. """ - -assert not self._partitions_layed_out - -self.partitions.append(part) -self.__add_disk(part['disk_name']) - def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None, label=None, fsopts=None, boot=False, align=None, no_table=False, part_type=None, uuid=None, system_id=None): @@ -117,7 +108,10 @@ class Image(): 'uuid': uuid, # Partition UUID 'system_id': system_id} # Partition system id -self.__add_partition(part) +assert not self._partitions_layed_out + +self.partitions.append(part) +self._add_disk(part['disk_name']) def layout_partitions(self, ptable_format="msdos"): """ Layout the partitions, meaning calculate the position of every -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/9] wic: partitionedfs: merged __format_disks and create
Private method __format_disks is called only from create method making the code less readable. Merged the code into one method. Signed-off-by: Ed Bartosh --- scripts/lib/wic/utils/partitionedfs.py | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 5fc5765..08ae52f 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -238,7 +238,11 @@ class Image(): return exec_native_cmd(cmd, self.native_sysroot) -def __format_disks(self): +def create(self): +for dev in self.disks: +disk = self.disks[dev] +disk['disk'].create() + self.layout_partitions() for dev in self.disks: @@ -375,12 +379,3 @@ class Image(): partimage = image_file + '.p%d' % part['num'] os.rename(source, partimage) self.partimages.append(partimage) - -def create(self): -for dev in self.disks: -disk = self.disks[dev] -disk['disk'].create() - -self.__format_disks() - -return -- 2.1.4 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core