On 10/09/2024 08:39, Ilias Apalodimas wrote:
Since RPI works well using EFI and has no size limitations with regards
to U-Boot, add the needed structures and Kconfig options needed to
enable capsule updates
---
  board/raspberrypi/rpi/rpi.c | 22 ++++++++++++++++++++++
  configs/rpi_4_defconfig     |  2 ++
  2 files changed, 24 insertions(+)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index ab5ea85cf9f8..1f342eee12b2 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -63,6 +63,28 @@ struct msg_get_clock_rate {
        u32 end_tag;
  };
+struct efi_fw_image fw_images[] = {
+       {
+               .fw_name = u"RPI_UBOOT",
+               .image_index = 1,
+       },
+};
+
+struct efi_capsule_update_info update_info = {
+       .dfu_string = "mmc 0=u-boot.bin fat 0 1",
+       .num_images = ARRAY_SIZE(fw_images),
+       .images = fw_images,
+};
+
+#if IS_ENABLED(CONFIG_SET_DFU_ALT_INFO)
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+       if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
+               env_set("dfu_alt_info", update_info.dfu_string);
+}
+#endif
+
+
  #ifdef CONFIG_ARM64
  #define DTB_DIR "broadcom/"
  #else
diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
index f5fb322aa8fc..c70414e6fcaf 100644
--- a/configs/rpi_4_defconfig
+++ b/configs/rpi_4_defconfig
@@ -65,3 +65,5 @@ CONFIG_SYS_WHITE_ON_BLACK=y
  CONFIG_VIDEO_BCM2835=y
  CONFIG_CONSOLE_SCROLL_LINES=10
  CONFIG_PHYS_TO_BUS=y
+CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y

Would you mind to enable this in all corresponding configs.

That would be at least: rpi_3_b_plus_defconfig, rpi_3_defconfig, rpi_arm64_defconfig.

Thanks,
Matthias

Reply via email to