diff options
Diffstat (limited to 'import-layers/yocto-poky/scripts/lib/wic/plugins/source')
4 files changed, 47 insertions, 48 deletions
diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py index a4734c9b3..8bc362254 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -84,7 +84,7 @@ class BootimgEFIPlugin(SourcePlugin): @classmethod def do_configure_gummiboot(cls, hdddir, creator, cr_workdir): """ - Create loader-specific (gummiboot) config + Create loader-specific systemd-boot/gummiboot config """ install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) @@ -149,7 +149,8 @@ class BootimgEFIPlugin(SourcePlugin): try: if source_params['loader'] == 'grub-efi': cls.do_configure_grubefi(hdddir, creator, cr_workdir) - elif source_params['loader'] == 'gummiboot': + elif source_params['loader'] == 'gummiboot' \ + or source_params['loader'] == 'systemd-boot': cls.do_configure_gummiboot(hdddir, creator, cr_workdir) else: msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader']) @@ -189,7 +190,8 @@ class BootimgEFIPlugin(SourcePlugin): exec_cmd(cp_cmd, True) shutil.move("%s/grub.cfg" % cr_workdir, "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) - elif source_params['loader'] == 'gummiboot': + elif source_params['loader'] == 'gummiboot' \ + or source_params['loader'] == 'systemd-boot': cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (bootimg_dir, hdddir) exec_cmd(cp_cmd, True) else: @@ -197,6 +199,11 @@ class BootimgEFIPlugin(SourcePlugin): except KeyError: msger.error("bootimg-efi requires a loader, none specified") + startup = os.path.join(bootimg_dir, "startup.nsh") + if os.path.exists(startup): + cp_cmd = "cp %s %s/" % (startup, hdddir) + exec_cmd(cp_cmd, True) + du_cmd = "du -bks %s" % hdddir out = exec_cmd(du_cmd) blocks = int(out.split()[0]) @@ -211,12 +218,6 @@ class BootimgEFIPlugin(SourcePlugin): msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ (extra_blocks, part.mountpoint, blocks)) - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - blocks += (16 - (blocks % 16)) - # dosfs image, created by mkdosfs bootimg = "%s/boot.img" % cr_workdir diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 5b719bf3b..f204daa32 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -179,12 +179,6 @@ class BootimgPcbiosPlugin(SourcePlugin): msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ (extra_blocks, part.mountpoint, blocks)) - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - blocks += (16 - (blocks % 16)) - # dosfs image, created by mkdosfs bootimg = "%s/boot.img" % cr_workdir diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index bc9928314..3858fd439 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -27,6 +27,7 @@ import glob from wic import msger 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): @@ -59,7 +60,7 @@ class IsoImagePlugin(SourcePlugin): """ Create loader-specific (syslinux) config """ - splash = os.path.join(cr_workdir, "/ISO/boot/splash.jpg") + splash = os.path.join(cr_workdir, "ISO/boot/splash.jpg") if os.path.exists(splash): splashline = "menu background splash.jpg" else: @@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin): """ Create loader-specific (grub-efi) config """ - splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg") - if os.path.exists(splash): - splashline = "menu background splash.jpg" + configfile = creator.ks.bootloader.configfile + if configfile: + grubefi_conf = get_custom_config(configfile) + if grubefi_conf: + msger.debug("Using custom configuration file " + "%s for grub.cfg" % configfile) + else: + msger.error("configfile is specified but failed to " + "get it from %s." % configfile) else: - splashline = "" + splash = os.path.join(cr_workdir, "EFI/boot/splash.jpg") + if os.path.exists(splash): + splashline = "menu background splash.jpg" + else: + splashline = "" - bootloader = creator.ks.bootloader + 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" - grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10) - grubefi_conf += "\n" - grubefi_conf += "search --set=root --label %s " % part.label - grubefi_conf += "\n" - grubefi_conf += "menuentry 'boot'{\n" + grubefi_conf = "" + grubefi_conf += "serial --unit=0 --speed=115200 --word=8 " + grubefi_conf += "--parity=no --stop=1\n" + grubefi_conf += "default=boot\n" + grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10) + grubefi_conf += "\n" + grubefi_conf += "search --set=root --label %s " % part.label + grubefi_conf += "\n" + grubefi_conf += "menuentry 'boot'{\n" - kernel = "/bzImage" + kernel = "/bzImage" - grubefi_conf += "linux %s rootwait %s\n" \ - % (kernel, bootloader.append) - grubefi_conf += "initrd /initrd \n" - grubefi_conf += "}\n" + grubefi_conf += "linux %s rootwait %s\n" \ + % (kernel, bootloader.append) + grubefi_conf += "initrd /initrd \n" + grubefi_conf += "}\n" - if splashline: - grubefi_conf += "%s\n" % splashline + if splashline: + grubefi_conf += "%s\n" % splashline msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \ % cr_workdir) @@ -430,12 +441,6 @@ class IsoImagePlugin(SourcePlugin): % (part.mountpoint, blocks) msger.debug(msg) - # Ensure total sectors is an integral number of sectors per - # track or mcopy will complain. Sectors are 512 bytes, and we - # generate images with 32 sectors per track. This calculation is - # done in blocks, thus the mod by 16 instead of 32. - blocks += (16 - (blocks % 16)) - # dosfs image for EFI boot bootimg = "%s/efi.img" % isodir diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py index 0472f536b..e0b11f95a 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/rawcopy.py @@ -20,6 +20,7 @@ import os from wic import msger from wic.pluginbase import SourcePlugin from wic.utils.oe.misc import exec_cmd, get_bitbake_var +from wic.filemap import sparse_copy class RawCopyPlugin(SourcePlugin): """ @@ -67,14 +68,12 @@ class RawCopyPlugin(SourcePlugin): return src = os.path.join(bootimg_dir, source_params['file']) - dst = os.path.join(cr_workdir, source_params['file']) + dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno)) if 'skip' in source_params: - dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \ - (src, dst, source_params['skip']) + sparse_copy(src, dst, skip=source_params['skip']) else: - dd_cmd = "cp %s %s" % (src, dst) - exec_cmd(dd_cmd) + sparse_copy(src, dst) # get the size in the right units for kickstart (kB) du_cmd = "du -Lbks %s" % dst |