Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Vincent Davis Jr <vince@underview.tech>
To: openembedded-core@lists.openembedded.org
Cc: Vincent Davis Jr <vince@underview.tech>
Subject: [PATCH v8 3/9] bootimg_pcbios: seperate bootloader config creation
Date: Thu, 14 Aug 2025 00:25:46 -0400	[thread overview]
Message-ID: <20250814042552.21887-3-vince@underview.tech> (raw)
In-Reply-To: <20250814042552.21887-1-vince@underview.tech>

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. <vince@underview.tech>
---
 .../lib/wic/plugins/source/bootimg_pcbios.py  | 31 +++++++++++--------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py
index 9ad301b008..47fd4b9415 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):
-- 
2.34.1



  parent reply	other threads:[~2025-08-14  4:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  4:25 [PATCH v8 1/9] bootimg_pcbios: move syslinux install into seperate functions Vincent Davis Jr
2025-08-14  4:25 ` [PATCH v8 2/9] bootimg_pcbios: move syslinux funcs to end of file Vincent Davis Jr
2025-08-14  4:25 ` Vincent Davis Jr [this message]
2025-08-14  4:25 ` [PATCH v8 4/9] bootimg_pcbios: cleanup _do_configure_syslinux function Vincent Davis Jr
2025-08-14  4:25 ` [PATCH v8 5/9] bootimg_pcbios: cleanup prepare and install syslinux funcs Vincent Davis Jr
2025-08-14  4:25 ` [PATCH v8 6/9] bootimg_pcbios: add funcs to configure booting with grub Vincent Davis Jr
2025-08-14  4:25 ` [PATCH v8 7/9] bootimg_pcbios: include grub as an optional bootloader Vincent Davis Jr
2025-08-14  4:25 ` [PATCH v8 8/9] bootimg_pcbios: add help and usage comments Vincent Davis Jr
2025-08-14  4:25 ` [PATCH v8 9/9] oe-selftest: add wic.Wic.test_grub_install_pcbios Vincent Davis Jr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250814042552.21887-3-vince@underview.tech \
    --to=vince@underview.tech \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox