diff options
Diffstat (limited to 'yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py')
-rw-r--r-- | yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index 9472d8abb..bc9928314 100644 --- a/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -23,8 +23,9 @@ import os import re import shutil +import glob -from wic import kickstart, msger +from wic import msger from wic.pluginbase import SourcePlugin from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var @@ -64,13 +65,11 @@ class IsoImagePlugin(SourcePlugin): else: splashline = "" - options = creator.ks.handler.bootloader.appendLine - - timeout = kickstart.get_timeout(creator.ks, 10) + bootloader = creator.ks.bootloader syslinux_conf = "" syslinux_conf += "PROMPT 0\n" - syslinux_conf += "TIMEOUT %s \n" % timeout + syslinux_conf += "TIMEOUT %s \n" % (bootloader.timeout or 10) syslinux_conf += "\n" syslinux_conf += "ALLOWOPTIONS 1\n" syslinux_conf += "SERIAL 0 115200\n" @@ -82,7 +81,8 @@ class IsoImagePlugin(SourcePlugin): kernel = "/bzImage" syslinux_conf += "KERNEL " + kernel + "\n" - syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" % options + syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \ + % bootloader.append msger.debug("Writing syslinux config %s/ISO/isolinux/isolinux.cfg" \ % cr_workdir) @@ -100,14 +100,13 @@ class IsoImagePlugin(SourcePlugin): else: splashline = "" - options = creator.ks.handler.bootloader.appendLine + bootloader = creator.ks.bootloader grubefi_conf = "" grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " grubefi_conf += "--parity=no --stop=1\n" grubefi_conf += "default=boot\n" - timeout = kickstart.get_timeout(creator.ks, 10) - grubefi_conf += "timeout=%s\n" % timeout + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10) grubefi_conf += "\n" grubefi_conf += "search --set=root --label %s " % part.label grubefi_conf += "\n" @@ -116,7 +115,7 @@ class IsoImagePlugin(SourcePlugin): kernel = "/bzImage" grubefi_conf += "linux %s rootwait %s\n" \ - % (kernel, options) + % (kernel, bootloader.append) grubefi_conf += "initrd /initrd \n" grubefi_conf += "}\n" @@ -152,8 +151,7 @@ class IsoImagePlugin(SourcePlugin): if not machine_arch: msger.error("Couldn't find MACHINE_ARCH, exiting.\n") - initrd = "%s/%s-initramfs-%s.%s" \ - % (initrd_dir, image_name, machine_arch, image_type) + initrd = glob.glob('%s/%s*%s.%s' % (initrd_dir, image_name, machine_arch, image_type))[0] if not os.path.exists(initrd): # Create initrd from rootfs directory @@ -176,8 +174,8 @@ class IsoImagePlugin(SourcePlugin): else: msger.error("Couldn't find or build initrd, exiting.\n") - exec_cmd("cd %s && find . | cpio -o -H newc >%s/initrd.cpio " \ - % (initrd_dir, cr_workdir), as_shell=True) + exec_cmd("cd %s && find . | cpio -o -H newc -R +0:+0 >./initrd.cpio " \ + % initrd_dir, as_shell=True) exec_cmd("gzip -f -9 -c %s/initrd.cpio > %s" \ % (cr_workdir, initrd), as_shell=True) shutil.rmtree(initrd_dir) @@ -210,11 +208,14 @@ class IsoImagePlugin(SourcePlugin): if not os.path.exists("%s/syslinux" % syslinux_dir): msger.info("Building syslinux...\n") exec_cmd("bitbake syslinux") - msger.info("Building syslinux-native...\n") - exec_cmd("bitbake syslinux-native") if not os.path.exists("%s/syslinux" % syslinux_dir): msger.error("Please build syslinux first\n") + # Make sure syslinux is available in native sysroot + if not os.path.exists("%s/usr/bin/syslinux" % native_sysroot): + msger.info("Building syslinux-native...\n") + exec_cmd("bitbake syslinux-native") + #Make sure mkisofs is available in native sysroot if not os.path.isfile("%s/usr/bin/mkisofs" % native_sysroot): msger.info("Building cdrtools-native...\n") @@ -264,26 +265,26 @@ class IsoImagePlugin(SourcePlugin): isodir = "%s/ISO" % cr_workdir - if part.rootfs is None: + if part.rootfs_dir is None: if not 'ROOTFS_DIR' in rootfs_dir: msger.error("Couldn't find --rootfs-dir, exiting.\n") rootfs_dir = rootfs_dir['ROOTFS_DIR'] else: - if part.rootfs in rootfs_dir: - rootfs_dir = rootfs_dir[part.rootfs] - elif part.rootfs: - rootfs_dir = part.rootfs + if part.rootfs_dir in rootfs_dir: + rootfs_dir = rootfs_dir[part.rootfs_dir] + elif part.rootfs_dir: + rootfs_dir = part.rootfs_dir else: msg = "Couldn't find --rootfs-dir=%s connection " msg += "or it is not a valid path, exiting.\n" - msger.error(msg % part.rootfs) + msger.error(msg % part.rootfs_dir) if not os.path.isdir(rootfs_dir): rootfs_dir = get_bitbake_var("IMAGE_ROOTFS") if not os.path.isdir(rootfs_dir): msger.error("Couldn't find IMAGE_ROOTFS, exiting.\n") - part.set_rootfs(rootfs_dir) + part.rootfs_dir = rootfs_dir # Prepare rootfs.img hdd_dir = get_bitbake_var("HDDDIR") @@ -304,7 +305,7 @@ class IsoImagePlugin(SourcePlugin): # which contains rootfs du_cmd = "du -bks %s" % rootfs_dir out = exec_cmd(du_cmd) - part.set_size(int(out.split()[0])) + part.size = int(out.split()[0]) part.extra_space = 0 part.overhead_factor = 1.2 part.prepare_rootfs(cr_workdir, oe_builddir, rootfs_dir, \ @@ -504,8 +505,8 @@ class IsoImagePlugin(SourcePlugin): out = exec_cmd(du_cmd) isoimg_size = int(out.split()[0]) - part.set_size(isoimg_size) - part.set_source_file(iso_img) + part.size = isoimg_size + part.source_file = iso_img @classmethod def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir, |