board: samsung: exynos-mobile: add EFI capsule update support

Add support for EFI capsule updates via U-Boot's DFU. This flashes the
boot partition with the new image provided in the capsule.

Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
Kaustabh Chakraborty
2026-02-24 21:07:10 +05:30
committed by Minkyu Kang
parent db0fe21bd3
commit 0e61fc5364
2 changed files with 30 additions and 0 deletions

View File

@@ -10,6 +10,8 @@
#include <bootflow.h>
#include <ctype.h>
#include <dm/ofnode.h>
#include <efi.h>
#include <efi_loader.h>
#include <env.h>
#include <errno.h>
#include <init.h>
@@ -24,6 +26,19 @@ DECLARE_GLOBAL_DATA_PTR;
#define lmb_alloc(size, addr) \
lmb_alloc_mem(LMB_MEM_ALLOC_ANY, SZ_2M, addr, size, LMB_NONE)
struct efi_fw_image fw_images[] = {
{
.fw_name = u"UBOOT_BOOT_PARTITION",
.image_index = 1,
},
};
struct efi_capsule_update_info update_info = {
.dfu_string = NULL,
.images = fw_images,
.num_images = ARRAY_SIZE(fw_images),
};
/*
* The memory mapping includes all DRAM banks, along with the
* peripheral block, and a sentinel at the end. This is filled in
@@ -191,6 +206,7 @@ static int exynos_blk_env_setup(void)
struct blk_desc *blk_desc;
struct disk_partition info = {0};
unsigned long largest_part_start = 0, largest_part_size = 0;
static char dfu_string[32];
int i;
blk_ifname = "mmc";
@@ -204,6 +220,14 @@ static int exynos_blk_env_setup(void)
if (part_get_info(blk_desc, i, &info))
continue;
if (!update_info.dfu_string &&
!strncasecmp(info.name, "boot", strlen("boot"))) {
snprintf(dfu_string, sizeof(dfu_string),
"mmc %d=u-boot.bin part %d %d", blk_dev,
blk_dev, i);
update_info.dfu_string = dfu_string;
}
if (info.start > largest_part_size) {
largest_part_start = info.start;
largest_part_size = info.size;

View File

@@ -11,6 +11,10 @@ CONFIG_SYS_BOOTM_LEN=0x2000000
CONFIG_SYS_LOAD_ADDR=0x80000000
CONFIG_ARMV8_CNTFRQ_BROKEN=y
# CONFIG_PSCI_RESET is not set
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_ON_DISK_EARLY=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
CONFIG_BUTTON_CMD=y
CONFIG_USE_PREBOOT=y
CONFIG_SAVE_PREV_BL_FDT_ADDR=y
@@ -31,6 +35,8 @@ CONFIG_BLKMAP=y
CONFIG_BUTTON=y
CONFIG_BUTTON_REMAP_PHONE_KEYS=y
CONFIG_CLK_EXYNOS7870=y
CONFIG_DFU_MMC=y
CONFIG_SYS_DFU_DATA_BUF_SIZE=0x200000
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0xdead0000
CONFIG_FASTBOOT_FLASH=y