grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/2] mkimage: adding sbat metadata into sbat ELF Note on power


From: Sudhakar Kuppusamy
Subject: [PATCH v2 2/2] mkimage: adding sbat metadata into sbat ELF Note on powerpc
Date: Wed, 26 Jun 2024 02:36:34 +0530

The SBAT metadata, which is read from .csv file and transformed into an ELF 
note,
is made into an image using the -s option.

Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Co-authored-by: Daniel Axtens <dja@axtens.net>
---
 util/mkimage.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/util/mkimage.c b/util/mkimage.c
index e67f7ce73..bafe190b0 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -943,8 +943,9 @@ 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 images/"
+                       "sbat ELF Note can be added into powerpc-ieee1275 
images only"));
 
   if (disable_shim_lock)
     total_module_size += sizeof (struct grub_module_header);
@@ -1814,6 +1815,13 @@ grub_install_generate_image (const char *dir, const char 
*prefix,
       {
        grub_uint64_t target_addr;
        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)
-- 
2.39.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]