]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
bootimg_pcbios: add funcs to configure booting with grub
authorVincent Davis Jr <vince@underview.tech>
Thu, 14 Aug 2025 04:25:49 +0000 (00:25 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Aug 2025 09:30:39 +0000 (10:30 +0100)
commit27c56962f47303cf49a4cf641e85239e4d7779b5
treefa3df1f9953df4541c7cc6e63902752c63bd6615
parent27e3fc1ef5304278254d2288ffc99e1757dd4053
bootimg_pcbios: add funcs to configure booting with grub

Functions added, but not executed during
wic image creation include:

_get_staging_libdir
* Finds target lib directory if for some
  reason STAGING_LIBDIR isn't set.

_do_configure_grub
* Will search for a grub configuration passed via
  bootloader --configfile. If not found build a
  default one which searches for partition that
  contains the given the kernel name via grub
  search module.

_do_prepare_grub
1. Sets default values for GRUB_MKIMAGE_FORMAT_PC
   and GRUB_PREFIX_PATH if none specified. Both
   variables are required by grub-mkimage.
   * GRUB_MKIMAGE_FORMAT_PC is used to define
     target platform.
   * GRUB_PREFIX_PATH is used to define which
     directory grub config and modules are going
     to reside in.
2. Generates grub config to embed into core.img.
   This config is used to search for partition
   containing grub config.
3. Creates a custom core.img or grub stage 1.5
   with an embedded grub config.
4. Copies all the target built grub modules into
   GRUB_PREFIX_PATH directory.
5. Creates boot partition

_do_install_grub
1. dd target platform specific boot.img to the first
   0-440 bytes of the resulting wic image. dd grub
   stage 1 to wic image. If this wics plugin is used
   with GPT as partition table format and grub selected
   as bootloader it's more than likely for grub hybrid
   booting because bootimg_efi plugin should and more
   than likely will be used in that case. So, boot.img
   may be dd regardless if partition table format is
   GPT or MBR.
2. dd custom core.img (grub stage 1.5) with embedded
   configuration to the resulting wic image starting
   at byte 512 up to sizeof(core.img).
3. Both boot.img and core.img are required for legacy
   bios boot. See grub Wiki for more details on
   boot.img and core.img.

   https://en.wikipedia.org/wiki/GNU_GRUB

Commit also imports python modules required by the
above implemented functions.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/plugins/source/bootimg_pcbios.py