bootimg_pcbios: seperate bootloader config creation

Most bootloaders that will be included in this
wics plugin will require a configuration file
to define kernel params, execute custom
modules, or enable the ability to select
one of multiple boot entries.

Create a seperate generic function to facilitate
finding if a bootloader config file passed through
bootloader --configfile flag. So, that other functions
that are used to create/install a bootloader boot
configuration file can leverage the function.

(From OE-Core rev: 7944e29eb6ab7b80ad3847686dd780100623b196)

Signed-off-by: Vincent Davis Jr. <vince@underview.tech>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Vincent Davis Jr 2025-08-14 00:25:46 -04:00 committed by Richard Purdie
parent eb3df0324a
commit 2bcf99792b

View File

@ -72,6 +72,22 @@ class BootimgPcbiosPlugin(SourcePlugin):
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot)
@classmethod
def _get_bootloader_config(cls, bootloader, loader):
custom_cfg = None
if bootloader.configfile:
custom_cfg = get_custom_config(bootloader.configfile)
if custom_cfg:
logger.debug("Using custom configuration file %s "
"for %s.cfg", bootloader.configfile,
loader)
return custom_cfg
else:
raise WicError("configfile is specified but failed to "
"get it from %s." % bootloader.configfile)
return custom_cfg
@classmethod
def _do_configure_syslinux(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
@ -86,20 +102,9 @@ class BootimgPcbiosPlugin(SourcePlugin):
exec_cmd(install_cmd)
bootloader = creator.ks.bootloader
syslinux_conf = cls._get_bootloader_config(bootloader, 'syslinux')
custom_cfg = None
if bootloader.configfile:
custom_cfg = get_custom_config(bootloader.configfile)
if custom_cfg:
# Use a custom configuration for grub
syslinux_conf = custom_cfg
logger.debug("Using custom configuration file %s "
"for syslinux.cfg", bootloader.configfile)
else:
raise WicError("configfile is specified but failed to "
"get it from %s." % bootloader.configfile)
if not custom_cfg:
if not syslinux_conf:
# Create syslinux configuration using parameters from wks file
splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg")
if os.path.exists(splash):