]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: samsung: e850-96: Enable EFI Capsule Update mechanism
authorSam Protsenko <semen.protsenko@linaro.org>
Wed, 9 Jul 2025 22:29:25 +0000 (17:29 -0500)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 25 Jul 2025 01:17:21 +0000 (10:17 +0900)
Make it possible to update E850-96 firmware binaries using EFI Capsule
Update mechanism. For example, to update the U-Boot binary, the capsule
file can be generated like this:

    $ ./tools/mkeficapsule --index 4 \
      --guid 629578c3-ffb3-4a89-ac0c-611840727779 \
      u-boot.bin capsule4.bin

The resulting 'capsule4.bin' should be copied to ESP partition (in
/boot/efi/EFI/UpdateCapsule/ directory). Then after reboot U-Boot will
update the 'bootloader' area in eMMC Boot Partition A (boot0) and remove
the capsule file, by EFI boot manager executed as a part of Standard
Boot:

    Applying capsule capsule4.bin succeeded.
    Reboot after firmware update.

The kernel will also expose the ESRT table information via SysFS in
/sys/firmware/efi/esrt/entries.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
board/samsung/e850-96/e850-96.c
configs/e850-96_defconfig
include/configs/e850-96.h

index addfe0460973efd70ac564a68f967efd6fc6b85f..4e034b9bd3be63deab774e0f14e2a4b7cdcea7ed 100644 (file)
@@ -4,6 +4,7 @@
  * Author: Sam Protsenko <semen.protsenko@linaro.org>
  */
 
+#include <efi_loader.h>
 #include <env.h>
 #include <init.h>
 #include <mapmem.h>
 #define OTP_CHIPID0            0x4
 #define OTP_CHIPID1            0x8
 
+struct efi_fw_image fw_images[] = {
+       {
+               .image_type_id = E850_96_FWBL1_IMAGE_GUID,
+               .fw_name = u"E850-96-FWBL1",
+               .image_index = 1,
+       },
+       {
+               .image_type_id = E850_96_EPBL_IMAGE_GUID,
+               .fw_name = u"E850-96-EPBL",
+               .image_index = 2,
+       },
+       {
+               .image_type_id = E850_96_BL2_IMAGE_GUID,
+               .fw_name = u"E850-96-BL2",
+               .image_index = 3,
+       },
+       {
+               .image_type_id = E850_96_BOOTLOADER_IMAGE_GUID,
+               .fw_name = u"E850-96-BOOTLOADER",
+               .image_index = 4,
+       },
+       {
+               .image_type_id = E850_96_EL3_MON_IMAGE_GUID,
+               .fw_name = u"E850-96-EL3-MON",
+               .image_index = 5,
+       },
+};
+
+struct efi_capsule_update_info update_info = {
+       .dfu_string = "mmc 0="
+                       "fwbl1.img raw 0x0 0x18 mmcpart 1;"
+                       "epbl.img raw 0x18 0x98 mmcpart 1;"
+                       "bl2.img raw 0xb0 0x200 mmcpart 1;"
+                       "bootloader.img raw 0x438 0x1000 mmcpart 1;"
+                       "el3_mon.img raw 0x1438 0x200 mmcpart 1",
+       .num_images = ARRAY_SIZE(fw_images),
+       .images = fw_images,
+};
+
 int dram_init(void)
 {
        return fdtdec_setup_mem_size_base();
index 96e91959f16c18c24a5a4dd400f04190c261f8fe..e334efd4d5fb964bcb897db5dee7587864574cc4 100644 (file)
@@ -15,6 +15,9 @@ CONFIG_SYS_LOAD_ADDR=0x80000000
 CONFIG_ENV_OFFSET_REDUND=0x10000
 # CONFIG_PSCI_RESET is not set
 CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_BOOTSTD_FULL=y
 CONFIG_DEFAULT_FDT_FILE="exynos850-e850-96.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
index 4607b3089b2150b0b3890d0ed1ee46cea9df0f9a..63e85332bd86eb718e5e1cfbf008ceab7fda0bd1 100644 (file)
@@ -9,4 +9,25 @@
 #ifndef __E850_96_H
 #define __E850_96_H
 
+/* GUIDs for capsule updatable firmware images */
+#define E850_96_FWBL1_IMAGE_GUID \
+       EFI_GUID(0x181cd3f2, 0xe375, 0x44d2, 0x80, 0x78, \
+                0x32, 0x21, 0xe1, 0xdf, 0xb9, 0x5e)
+
+#define E850_96_EPBL_IMAGE_GUID \
+       EFI_GUID(0x66c1a54d, 0xd149, 0x415d, 0xaa, 0xda, \
+                0xb8, 0xae, 0xe4, 0x99, 0xb3, 0x70)
+
+#define E850_96_BL2_IMAGE_GUID \
+       EFI_GUID(0x89471c2a, 0x6c8d, 0x4158, 0xac, 0xad, \
+                0x23, 0xd3, 0xb2, 0x87, 0x3d, 0x35)
+
+#define E850_96_BOOTLOADER_IMAGE_GUID \
+       EFI_GUID(0x629578c3, 0xffb3, 0x4a89, 0xac, 0x0c, \
+                0x61, 0x18, 0x40, 0x72, 0x77, 0x79)
+
+#define E850_96_EL3_MON_IMAGE_GUID \
+       EFI_GUID(0xdf5718a2, 0x930a, 0x4916, 0xbb, 0x19, \
+                0x32, 0x13, 0x21, 0x4d, 0x84, 0x86)
+
 #endif /* __E850_96_H */