mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
wic/bootimg-efi: Factor out some common bits
The paths for configuring grub and systemd-boot have some common bits around copying the initrd files. This will even grow when adding dtb support. Factor this out into a class function. Along this, avoid evaluating 'create-unified-kernel-image' multiple times in do_configure_systemdboot and suppress a bogus warning about "Ignoring missing initrd" when it is turned on. (From OE-Core rev: c700cfd88473b9ed4e12a6620fb089f41bd95a9e) Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
44cc49c679
commit
be0ca8e685
|
@ -34,6 +34,20 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||
|
||||
name = 'bootimg-efi'
|
||||
|
||||
@classmethod
|
||||
def _copy_additional_files(cls, hdddir, initrd):
|
||||
if initrd:
|
||||
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||
if not bootimg_dir:
|
||||
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||
|
||||
initrds = initrd.split(';')
|
||||
for rd in initrds:
|
||||
cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
|
||||
exec_cmd(cp_cmd, True)
|
||||
else:
|
||||
logger.debug("Ignoring missing initrd")
|
||||
|
||||
@classmethod
|
||||
def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params):
|
||||
"""
|
||||
|
@ -54,17 +68,7 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||
|
||||
initrd = source_params.get('initrd')
|
||||
|
||||
if initrd:
|
||||
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||
if not bootimg_dir:
|
||||
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||
|
||||
initrds = initrd.split(';')
|
||||
for rd in initrds:
|
||||
cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
|
||||
exec_cmd(cp_cmd, True)
|
||||
else:
|
||||
logger.debug("Ignoring missing initrd")
|
||||
cls._copy_additional_files(hdddir, initrd)
|
||||
|
||||
if not custom_cfg:
|
||||
# Create grub configuration using parameters from wks file
|
||||
|
@ -119,25 +123,17 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||
|
||||
bootloader = creator.ks.bootloader
|
||||
|
||||
unified_image = source_params.get('create-unified-kernel-image') == "true"
|
||||
|
||||
loader_conf = ""
|
||||
if source_params.get('create-unified-kernel-image') != "true":
|
||||
if not unified_image:
|
||||
loader_conf += "default boot\n"
|
||||
loader_conf += "timeout %d\n" % bootloader.timeout
|
||||
|
||||
initrd = source_params.get('initrd')
|
||||
|
||||
if initrd and source_params.get('create-unified-kernel-image') != "true":
|
||||
# obviously we need to have a common common deploy var
|
||||
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||
if not bootimg_dir:
|
||||
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||
|
||||
initrds = initrd.split(';')
|
||||
for rd in initrds:
|
||||
cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
|
||||
exec_cmd(cp_cmd, True)
|
||||
else:
|
||||
logger.debug("Ignoring missing initrd")
|
||||
if not unified_image:
|
||||
cls._copy_additional_files(hdddir, initrd)
|
||||
|
||||
logger.debug("Writing systemd-boot config "
|
||||
"%s/hdd/boot/loader/loader.conf", cr_workdir)
|
||||
|
@ -185,7 +181,7 @@ class BootimgEFIPlugin(SourcePlugin):
|
|||
for rd in initrds:
|
||||
boot_conf += "initrd /%s\n" % rd
|
||||
|
||||
if source_params.get('create-unified-kernel-image') != "true":
|
||||
if not unified_image:
|
||||
logger.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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user