summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-08-11 20:35:39 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-15 18:19:55 +0100
commitf1a81fcefa493540a9faac549fdd513b86f8f497 (patch)
treede24526232bb3c5950e87f36c58c7cd1c2aed975 /scripts
parent769a6f920fb672c50d76bd4bdea4a65fdc18a7b3 (diff)
downloadopenembedded-core-f1a81fcefa493540a9faac549fdd513b86f8f497.tar.gz
openembedded-core-f1a81fcefa493540a9faac549fdd513b86f8f497.tar.bz2
openembedded-core-f1a81fcefa493540a9faac549fdd513b86f8f497.zip
wic: Add gummiboot support to bootimg-efi
Add gummiboot support to bootimg-efi, which retains the existing grub-efi support (though requires an update to the .wks file). Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py113
1 files changed, 91 insertions, 22 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index ea94fd2424..855bbc2ce2 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -42,19 +42,10 @@ class BootimgEFIPlugin(SourcePlugin):
name = 'bootimg-efi'
@classmethod
- def do_configure_partition(self, source_params, part, cr, cr_workdir,
- oe_builddir, bootimg_dir, kernel_dir,
- native_sysroot):
+ def do_configure_grubefi(self, hdddir, cr, cr_workdir):
"""
- Called before do_prepare_partition(), creates grubefi config
+ Create loader-specific (grub-efi) config
"""
- hdddir = "%s/hdd/boot" % cr_workdir
- rm_cmd = "rm -rf %s" % cr_workdir
- exec_cmd(rm_cmd)
-
- install_cmd = "install -d %s/EFI/BOOT" % hdddir
- exec_cmd(install_cmd)
-
splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
if os.path.exists(splash):
splashline = "menu background splash.jpg"
@@ -73,7 +64,7 @@ class BootimgEFIPlugin(SourcePlugin):
grubefi_conf += "timeout=%s\n" % timeout
grubefi_conf += "menuentry 'boot'{\n"
- kernel = "/vmlinuz"
+ kernel = "/bzImage"
if cr._ptable_format == 'msdos':
rootstr = rootdev
@@ -93,6 +84,79 @@ class BootimgEFIPlugin(SourcePlugin):
cfg.close()
@classmethod
+ def do_configure_gummiboot(self, hdddir, cr, cr_workdir):
+ """
+ Create loader-specific (gummiboot) config
+ """
+ install_cmd = "install -d %s/loader" % hdddir
+ exec_cmd(install_cmd)
+
+ install_cmd = "install -d %s/loader/entries" % hdddir
+ exec_cmd(install_cmd)
+
+ (rootdev, root_part_uuid) = cr._get_boot_config()
+ options = cr.ks.handler.bootloader.appendLine
+
+ timeout = kickstart.get_timeout(cr.ks)
+ if not timeout:
+ timeout = 0
+
+ loader_conf = ""
+ loader_conf += "default boot\n"
+ loader_conf += "timeout %d\n" % timeout
+
+ msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \
+ % cr_workdir)
+ cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w")
+ cfg.write(loader_conf)
+ cfg.close()
+
+ kernel = "/bzImage"
+
+ if cr._ptable_format == 'msdos':
+ rootstr = rootdev
+ else:
+ raise ImageError("Unsupported partition table format found")
+
+ boot_conf = ""
+ boot_conf += "title boot\n"
+ boot_conf += "linux %s\n" % kernel
+ boot_conf += "options LABEL=Boot root=%s %s\n" \
+ % (rootstr, options)
+
+ msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \
+ % cr_workdir)
+ cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w")
+ cfg.write(boot_conf)
+ cfg.close()
+
+
+ @classmethod
+ def do_configure_partition(self, part, source_params, cr, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ native_sysroot):
+ """
+ Called before do_prepare_partition(), creates loader-specific config
+ """
+ hdddir = "%s/hdd/boot" % cr_workdir
+ rm_cmd = "rm -rf %s" % cr_workdir
+ exec_cmd(rm_cmd)
+
+ install_cmd = "install -d %s/EFI/BOOT" % hdddir
+ exec_cmd(install_cmd)
+
+ try:
+ if source_params['loader'] == 'grub-efi':
+ self.do_configure_grubefi(hdddir, cr, cr_workdir)
+ elif source_params['loader'] == 'gummiboot':
+ self.do_configure_gummiboot(hdddir, cr, cr_workdir)
+ else:
+ msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader'])
+ except KeyError:
+ msger.error("bootimg-efi requires a loader, none specified")
+
+
+ @classmethod
def do_prepare_partition(self, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot):
@@ -117,14 +181,21 @@ class BootimgEFIPlugin(SourcePlugin):
(staging_kernel_dir, hdddir)
exec_cmd(install_cmd)
- shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
- "%s/grub.cfg" % cr_workdir)
-
- cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (staging_data_dir, hdddir)
- exec_cmd(cp_cmd, True)
-
- shutil.move("%s/grub.cfg" % cr_workdir,
- "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
+ try:
+ if source_params['loader'] == 'grub-efi':
+ shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
+ "%s/grub.cfg" % cr_workdir)
+ cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (staging_data_dir, hdddir)
+ 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':
+ cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (staging_data_dir, hdddir)
+ exec_cmd(cp_cmd, True)
+ else:
+ msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader'])
+ except KeyError:
+ msger.error("bootimg-efi requires a loader, none specified")
du_cmd = "du -bks %s" % hdddir
out = exec_cmd(du_cmd)
@@ -164,5 +235,3 @@ class BootimgEFIPlugin(SourcePlugin):
part.set_size(bootimg_size)
part.set_source_file(bootimg)
-
-