From: Vincent Davis Jr Date: Thu, 14 Aug 2025 04:25:46 +0000 (-0400) Subject: bootimg_pcbios: seperate bootloader config creation X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7944e29eb6ab7b80ad3847686dd780100623b196;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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. Signed-off-by: Vincent Davis Jr. Signed-off-by: Richard Purdie --- diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py index 9ad301b008c..47fd4b94154 100644 --- a/scripts/lib/wic/plugins/source/bootimg_pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg_pcbios.py @@ -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):