it reads the SBAT data from sbat.csv and create the ELF Note for it then store the SBAT data on it while generate image with -s option
Signed-off-by: Sudhakar Kuppusamy <sudha...@linux.ibm.com> Co-authored-by: Daniel Axtens <d...@axtens.net> --- util/mkimage.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/util/mkimage.c b/util/mkimage.c index 0737935fd..e8d7dcc23 100644 --- a/util/mkimage.c +++ b/util/mkimage.c @@ -958,8 +958,8 @@ grub_install_generate_image (const char *dir, const char *prefix, total_module_size += dtb_size + sizeof (struct grub_module_header); } - if (sbat_path != NULL && image_target->id != IMAGE_EFI) - grub_util_error (_(".sbat section can be embedded into EFI images only")); + if (sbat_path != NULL && (image_target->id != IMAGE_EFI && image_target->id != IMAGE_PPC)) + grub_util_error (_(".sbat section can be embedded into EFI/sbat ELF Note cab be added into powerpc-ieee1275 images only")); if (disable_shim_lock) total_module_size += sizeof (struct grub_module_header); @@ -1835,7 +1835,18 @@ grub_install_generate_image (const char *dir, const char *prefix, case IMAGE_I386_IEEE1275: { grub_uint64_t target_addr; - if (image_target->id == IMAGE_LOONGSON_ELF) + char *sbat = NULL; + + if (sbat_path != NULL) + { + sbat_size = grub_util_get_image_size (sbat_path); + sbat = xmalloc (sbat_size); + grub_util_load_image (sbat_path, sbat); + layout.sbat_size = sbat_size; + } + + + if (image_target->id == IMAGE_LOONGSON_ELF) { if (comp == GRUB_COMPRESSION_NONE) target_addr = (image_target->link_addr - decompress_size); @@ -1846,10 +1857,10 @@ grub_install_generate_image (const char *dir, const char *prefix, else target_addr = image_target->link_addr; if (image_target->voidp_sizeof == 4) - grub_mkimage_generate_elf32 (image_target, note, appsig_size, &core_img, + grub_mkimage_generate_elf32 (image_target, note, appsig_size, sbat, &core_img, &core_size, target_addr, &layout); else - grub_mkimage_generate_elf64 (image_target, note, appsig_size, &core_img, + grub_mkimage_generate_elf64 (image_target, note, appsig_size, sbat, &core_img, &core_size, target_addr, &layout); } break; -- 2.39.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel