diff options
| author | Vincent Davis Jr <vince@underview.tech> | 2025-08-14 00:25:47 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-14 10:31:11 +0100 |
| commit | a51e188be3000e082a7c977e32f249cc829e8453 (patch) | |
| tree | 0d4281460f2ac15bafa46aa6acb57fe1050618b3 | |
| parent | 2bcf99792b6a31ece0a6d76d08cc9866bd092fa0 (diff) | |
| download | poky-a51e188be3000e082a7c977e32f249cc829e8453.tar.gz | |
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>
| -rw-r--r-- | scripts/lib/wic/plugins/source/bootimg_pcbios.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py index 47fd4b9415..887a548cde 100644 --- a/scripts/lib/wic/plugins/source/bootimg_pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg_pcbios.py | |||
| @@ -59,9 +59,7 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
| 59 | oe_builddir, bootimg_dir, kernel_dir, | 59 | oe_builddir, bootimg_dir, kernel_dir, |
| 60 | native_sysroot): | 60 | native_sysroot): |
| 61 | 61 | ||
| 62 | cls._do_configure_syslinux(part, source_params, creator, cr_workdir, | 62 | cls._do_configure_syslinux(part, creator, cr_workdir) |
| 63 | oe_builddir, bootimg_dir, kernel_dir, | ||
| 64 | native_sysroot) | ||
| 65 | 63 | ||
| 66 | @classmethod | 64 | @classmethod |
| 67 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, | 65 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, |
| @@ -89,9 +87,7 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
| 89 | return custom_cfg | 87 | return custom_cfg |
| 90 | 88 | ||
| 91 | @classmethod | 89 | @classmethod |
| 92 | def _do_configure_syslinux(cls, part, source_params, creator, cr_workdir, | 90 | def _do_configure_syslinux(cls, part, creator, cr_workdir): |
| 93 | oe_builddir, bootimg_dir, kernel_dir, | ||
| 94 | native_sysroot): | ||
| 95 | """ | 91 | """ |
| 96 | Called before do_prepare_partition(), creates syslinux config | 92 | Called before do_prepare_partition(), creates syslinux config |
| 97 | """ | 93 | """ |
| @@ -106,12 +102,24 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
| 106 | 102 | ||
| 107 | if not syslinux_conf: | 103 | if not syslinux_conf: |
| 108 | # Create syslinux configuration using parameters from wks file | 104 | # Create syslinux configuration using parameters from wks file |
| 109 | splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg") | 105 | splash = os.path.join(hdddir, "/splash.jpg") |
| 110 | if os.path.exists(splash): | 106 | if os.path.exists(splash): |
| 111 | splashline = "menu background splash.jpg" | 107 | splashline = "menu background splash.jpg" |
| 112 | else: | 108 | else: |
| 113 | splashline = "" | 109 | splashline = "" |
| 114 | 110 | ||
| 111 | # Set a default timeout if none specified to avoid | ||
| 112 | # 'None' being the value placed within the configuration | ||
| 113 | # file. | ||
| 114 | if not bootloader.timeout: | ||
| 115 | bootloader.timeout = 500 | ||
| 116 | |||
| 117 | # Set a default kernel params string if none specified | ||
| 118 | # to avoid 'None' being the value placed within the | ||
| 119 | # configuration file. | ||
| 120 | if not bootloader.append: | ||
| 121 | bootloader.append = "rootwait console=ttyS0,115200 console=tty0" | ||
| 122 | |||
| 115 | syslinux_conf = "" | 123 | syslinux_conf = "" |
| 116 | syslinux_conf += "PROMPT 0\n" | 124 | syslinux_conf += "PROMPT 0\n" |
| 117 | syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n" | 125 | syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n" |
| @@ -130,8 +138,7 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
| 130 | syslinux_conf += "APPEND label=boot root=%s %s\n" % \ | 138 | syslinux_conf += "APPEND label=boot root=%s %s\n" % \ |
| 131 | (creator.rootdev, bootloader.append) | 139 | (creator.rootdev, bootloader.append) |
| 132 | 140 | ||
| 133 | logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg", | 141 | logger.debug("Writing syslinux config %s/syslinux.cfg", hdddir) |
| 134 | cr_workdir) | ||
| 135 | cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") | 142 | cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") |
| 136 | cfg.write(syslinux_conf) | 143 | cfg.write(syslinux_conf) |
| 137 | cfg.close() | 144 | cfg.close() |
