bootimg_pcbios: cleanup _do_configure_syslinux function

This commit:

1. Removes all unrequired function parameters.
   The part parameter was kept due to it's potential
   future usage in _do_configure_syslinux function.
   part.fstype specifically may be used with the
   rootfstype kernel paramater.

2. Sets a default timeout to 500 if bootloader --timeout
   not specified. To avoid 'None' being placed
   as the value in resulting configuartion file.
3. Sets a default kernel parameter string if
   bootloader --append not specified. This also
   helps avoid 'None' being places as the value
   in resulting configuration file.
4. Replace all instances of

   cr_workdir, "/hdd/boot"

   with variable

   hdddir

   as it's set at the top of the function. No,
   need to re-implement what the variable is
   already defined to store.

(From OE-Core rev: 5e17a1cf73d0542e0c7ec9333aaf20bbc45df8de)

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:47 -04:00
committed by Richard Purdie
parent 2bcf99792b
commit a51e188be3

View File

@@ -59,9 +59,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
cls._do_configure_syslinux(part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot)
cls._do_configure_syslinux(part, creator, cr_workdir)
@classmethod
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
@@ -89,9 +87,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
return custom_cfg
@classmethod
def _do_configure_syslinux(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
def _do_configure_syslinux(cls, part, creator, cr_workdir):
"""
Called before do_prepare_partition(), creates syslinux config
"""
@@ -106,12 +102,24 @@ class BootimgPcbiosPlugin(SourcePlugin):
if not syslinux_conf:
# Create syslinux configuration using parameters from wks file
splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg")
splash = os.path.join(hdddir, "/splash.jpg")
if os.path.exists(splash):
splashline = "menu background splash.jpg"
else:
splashline = ""
# Set a default timeout if none specified to avoid
# 'None' being the value placed within the configuration
# file.
if not bootloader.timeout:
bootloader.timeout = 500
# Set a default kernel params string if none specified
# to avoid 'None' being the value placed within the
# configuration file.
if not bootloader.append:
bootloader.append = "rootwait console=ttyS0,115200 console=tty0"
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n"
@@ -130,8 +138,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
syslinux_conf += "APPEND label=boot root=%s %s\n" % \
(creator.rootdev, bootloader.append)
logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg",
cr_workdir)
logger.debug("Writing syslinux config %s/syslinux.cfg", hdddir)
cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w")
cfg.write(syslinux_conf)
cfg.close()