diff options
author | Vincent Davis Jr <vince@underview.tech> | 2025-08-14 00:25:50 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-14 10:31:11 +0100 |
commit | a495fec1bf601ed3fd9571cbd0a69cbfcd694217 (patch) | |
tree | 7fe85f471db0a3a9a6c3c92bdf141c229f7f31f1 /scripts/lib/wic | |
parent | 7f522461d2ade980a1efcea290e4c879c92939aa (diff) | |
download | poky-a495fec1bf601ed3fd9571cbd0a69cbfcd694217.tar.gz |
bootimg_pcbios: include grub as an optional bootloader
Commit adds in support for installation of both
grub and syslinux using newly added grub functions.
Due to the bootimg_biosplusefi source_params['loader']
had to be named source_params['loader-bios'] so not
to create conflict in the wics plugin.
Commits also adds ability to set and or not set
source_params. If source_params set check
for both
* syslinux
* grub
if not set default to using syslinux as bootloader.
(From OE-Core rev: 5caf6fe32aa4655f46fb7b490a22778c59b2efc0)
Signed-off-by: Vincent Davis Jr <vince@underview.tech>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg_pcbios.py | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py index f50a5ae0e2..1fa9d895bb 100644 --- a/scripts/lib/wic/plugins/source/bootimg_pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg_pcbios.py | |||
@@ -31,6 +31,9 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
31 | 31 | ||
32 | name = 'bootimg_pcbios' | 32 | name = 'bootimg_pcbios' |
33 | 33 | ||
34 | # Variable required for do_install_disk | ||
35 | loader = '' | ||
36 | |||
34 | @classmethod | 37 | @classmethod |
35 | def _get_bootimg_dir(cls, bootimg_dir, dirname): | 38 | def _get_bootimg_dir(cls, bootimg_dir, dirname): |
36 | """ | 39 | """ |
@@ -56,23 +59,50 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
56 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", | 59 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", |
57 | disk_name, full_path, disk.min_size) | 60 | disk_name, full_path, disk.min_size) |
58 | 61 | ||
59 | cls._do_install_syslinux(creator, bootimg_dir, | 62 | if cls.loader == 'grub': |
63 | cls._do_install_grub(creator, kernel_dir, | ||
64 | native_sysroot, full_path) | ||
65 | elif cls.loader == 'syslinux': | ||
66 | cls._do_install_syslinux(creator, bootimg_dir, | ||
60 | native_sysroot, full_path) | 67 | native_sysroot, full_path) |
68 | else: | ||
69 | raise WicError("boot loader some how not specified check do_prepare_partition") | ||
61 | 70 | ||
62 | @classmethod | 71 | @classmethod |
63 | def do_configure_partition(cls, part, source_params, creator, cr_workdir, | 72 | def do_configure_partition(cls, part, source_params, creator, cr_workdir, |
64 | oe_builddir, bootimg_dir, kernel_dir, | 73 | oe_builddir, bootimg_dir, kernel_dir, |
65 | native_sysroot): | 74 | native_sysroot): |
66 | 75 | try: | |
67 | cls._do_configure_syslinux(part, creator, cr_workdir) | 76 | if source_params['loader-bios'] == 'grub': |
77 | cls._do_configure_grub(part, creator, cr_workdir) | ||
78 | elif source_params['loader-bios'] == 'syslinux': | ||
79 | cls._do_configure_syslinux(part, creator, cr_workdir) | ||
80 | else: | ||
81 | raise WicError("unrecognized bootimg_pcbios loader: %s" % source_params['loader-bios']) | ||
82 | except KeyError: | ||
83 | cls._do_configure_syslinux(part, creator, cr_workdir) | ||
68 | 84 | ||
69 | @classmethod | 85 | @classmethod |
70 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, | 86 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, |
71 | oe_builddir, bootimg_dir, kernel_dir, | 87 | oe_builddir, bootimg_dir, kernel_dir, |
72 | rootfs_dir, native_sysroot): | 88 | rootfs_dir, native_sysroot): |
73 | 89 | try: | |
74 | cls._do_prepare_syslinux(part, cr_workdir, bootimg_dir, | 90 | if source_params['loader-bios'] == 'grub': |
75 | kernel_dir, native_sysroot) | 91 | cls._do_prepare_grub(part, cr_workdir, oe_builddir, |
92 | kernel_dir, rootfs_dir, native_sysroot) | ||
93 | elif source_params['loader-bios'] == 'syslinux': | ||
94 | cls._do_prepare_syslinux(part, cr_workdir, bootimg_dir, | ||
95 | kernel_dir, native_sysroot) | ||
96 | else: | ||
97 | raise WicError("unrecognized bootimg_pcbios loader: %s" % source_params['loader-bios']) | ||
98 | |||
99 | # Required by do_install_disk | ||
100 | cls.loader = source_params['loader-bios'] | ||
101 | except KeyError: | ||
102 | # Required by do_install_disk | ||
103 | cls.loader = 'syslinux' | ||
104 | cls._do_prepare_syslinux(part, cr_workdir, bootimg_dir, | ||
105 | kernel_dir, native_sysroot) | ||
76 | 106 | ||
77 | @classmethod | 107 | @classmethod |
78 | def _get_staging_libdir(cls): | 108 | def _get_staging_libdir(cls): |