"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Kaustabh Chakraborty and committed by
Minkyu Kang
0e61fc53 db0fe21b

+30
+24
board/samsung/exynos-mobile/exynos-mobile.c
··· 10 10 #include <bootflow.h> 11 11 #include <ctype.h> 12 12 #include <dm/ofnode.h> 13 + #include <efi.h> 14 + #include <efi_loader.h> 13 15 #include <env.h> 14 16 #include <errno.h> 15 17 #include <init.h> ··· 23 25 24 26 #define lmb_alloc(size, addr) \ 25 27 lmb_alloc_mem(LMB_MEM_ALLOC_ANY, SZ_2M, addr, size, LMB_NONE) 28 + 29 + struct efi_fw_image fw_images[] = { 30 + { 31 + .fw_name = u"UBOOT_BOOT_PARTITION", 32 + .image_index = 1, 33 + }, 34 + }; 35 + 36 + struct efi_capsule_update_info update_info = { 37 + .dfu_string = NULL, 38 + .images = fw_images, 39 + .num_images = ARRAY_SIZE(fw_images), 40 + }; 26 41 27 42 /* 28 43 * The memory mapping includes all DRAM banks, along with the ··· 191 206 struct blk_desc *blk_desc; 192 207 struct disk_partition info = {0}; 193 208 unsigned long largest_part_start = 0, largest_part_size = 0; 209 + static char dfu_string[32]; 194 210 int i; 195 211 196 212 blk_ifname = "mmc"; ··· 203 219 for (i = 1; i < CONFIG_EFI_PARTITION_ENTRIES_NUMBERS; i++) { 204 220 if (part_get_info(blk_desc, i, &info)) 205 221 continue; 222 + 223 + if (!update_info.dfu_string && 224 + !strncasecmp(info.name, "boot", strlen("boot"))) { 225 + snprintf(dfu_string, sizeof(dfu_string), 226 + "mmc %d=u-boot.bin part %d %d", blk_dev, 227 + blk_dev, i); 228 + update_info.dfu_string = dfu_string; 229 + } 206 230 207 231 if (info.start > largest_part_size) { 208 232 largest_part_start = info.start;
+6
configs/exynos-mobile_defconfig
··· 11 11 CONFIG_SYS_LOAD_ADDR=0x80000000 12 12 CONFIG_ARMV8_CNTFRQ_BROKEN=y 13 13 # CONFIG_PSCI_RESET is not set 14 + CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y 15 + CONFIG_EFI_CAPSULE_ON_DISK=y 16 + CONFIG_EFI_CAPSULE_ON_DISK_EARLY=y 17 + CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y 14 18 CONFIG_BUTTON_CMD=y 15 19 CONFIG_USE_PREBOOT=y 16 20 CONFIG_SAVE_PREV_BL_FDT_ADDR=y ··· 31 35 CONFIG_BUTTON=y 32 36 CONFIG_BUTTON_REMAP_PHONE_KEYS=y 33 37 CONFIG_CLK_EXYNOS7870=y 38 + CONFIG_DFU_MMC=y 39 + CONFIG_SYS_DFU_DATA_BUF_SIZE=0x200000 34 40 CONFIG_USB_FUNCTION_FASTBOOT=y 35 41 CONFIG_FASTBOOT_BUF_ADDR=0xdead0000 36 42 CONFIG_FASTBOOT_FLASH=y