mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
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). (From OE-Core rev: f1a81fcefa493540a9faac549fdd513b86f8f497) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
8d0185f4f8
commit
6e328c94ae
@@ -42,19 +42,10 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||||||
name = 'bootimg-efi'
|
name = 'bootimg-efi'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def do_configure_partition(self, source_params, part, cr, cr_workdir,
|
def do_configure_grubefi(self, hdddir, cr, cr_workdir):
|
||||||
oe_builddir, bootimg_dir, kernel_dir,
|
|
||||||
native_sysroot):
|
|
||||||
"""
|
"""
|
||||||
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")
|
splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
|
||||||
if os.path.exists(splash):
|
if os.path.exists(splash):
|
||||||
splashline = "menu background splash.jpg"
|
splashline = "menu background splash.jpg"
|
||||||
@@ -73,7 +64,7 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||||||
grubefi_conf += "timeout=%s\n" % timeout
|
grubefi_conf += "timeout=%s\n" % timeout
|
||||||
grubefi_conf += "menuentry 'boot'{\n"
|
grubefi_conf += "menuentry 'boot'{\n"
|
||||||
|
|
||||||
kernel = "/vmlinuz"
|
kernel = "/bzImage"
|
||||||
|
|
||||||
if cr._ptable_format == 'msdos':
|
if cr._ptable_format == 'msdos':
|
||||||
rootstr = rootdev
|
rootstr = rootdev
|
||||||
@@ -92,6 +83,79 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||||||
cfg.write(grubefi_conf)
|
cfg.write(grubefi_conf)
|
||||||
cfg.close()
|
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
|
@classmethod
|
||||||
def do_prepare_partition(self, part, source_params, cr, cr_workdir,
|
def do_prepare_partition(self, part, source_params, cr, cr_workdir,
|
||||||
oe_builddir, bootimg_dir, kernel_dir,
|
oe_builddir, bootimg_dir, kernel_dir,
|
||||||
@@ -117,14 +181,21 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||||||
(staging_kernel_dir, hdddir)
|
(staging_kernel_dir, hdddir)
|
||||||
exec_cmd(install_cmd)
|
exec_cmd(install_cmd)
|
||||||
|
|
||||||
shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
|
try:
|
||||||
"%s/grub.cfg" % cr_workdir)
|
if source_params['loader'] == 'grub-efi':
|
||||||
|
shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
|
||||||
cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (staging_data_dir, hdddir)
|
"%s/grub.cfg" % cr_workdir)
|
||||||
exec_cmd(cp_cmd, True)
|
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,
|
shutil.move("%s/grub.cfg" % cr_workdir,
|
||||||
"%s/hdd/boot/EFI/BOOT/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
|
du_cmd = "du -bks %s" % hdddir
|
||||||
out = exec_cmd(du_cmd)
|
out = exec_cmd(du_cmd)
|
||||||
@@ -164,5 +235,3 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||||||
|
|
||||||
part.set_size(bootimg_size)
|
part.set_size(bootimg_size)
|
||||||
part.set_source_file(bootimg)
|
part.set_source_file(bootimg)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user