"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: use blkmap for booting from userdata subpartitions

Some distributions tend to provide a single combined image with EFS and
the system root filesystem. Flashing it as-is in a single partition
(usually done in userdata partition as it is the largest) is not
bootable as U-Boot does not understand subpartitions.

Use blkmap to map the userdata partition into its own block device.

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
db0fe21b e4001865

+53 -1
+45
board/samsung/exynos-mobile/exynos-mobile.c
··· 184 184 env_set("fdtfile", buf); 185 185 } 186 186 187 + static int exynos_blk_env_setup(void) 188 + { 189 + const char *blk_ifname; 190 + int blk_dev = 0; 191 + struct blk_desc *blk_desc; 192 + struct disk_partition info = {0}; 193 + unsigned long largest_part_start = 0, largest_part_size = 0; 194 + int i; 195 + 196 + blk_ifname = "mmc"; 197 + blk_desc = blk_get_dev(blk_ifname, blk_dev); 198 + if (!blk_desc) { 199 + log_err("%s: required mmc device not available\n", __func__); 200 + return -ENODEV; 201 + } 202 + 203 + for (i = 1; i < CONFIG_EFI_PARTITION_ENTRIES_NUMBERS; i++) { 204 + if (part_get_info(blk_desc, i, &info)) 205 + continue; 206 + 207 + if (info.start > largest_part_size) { 208 + largest_part_start = info.start; 209 + largest_part_size = info.size; 210 + } 211 + } 212 + 213 + if (largest_part_size) { 214 + env_set("blkmap_blk_ifname", blk_ifname); 215 + env_set_ulong("blkmap_blk_dev", blk_dev); 216 + env_set_ulong("blkmap_blk_nr", largest_part_start); 217 + env_set_hex("blkmap_size_r", largest_part_size); 218 + } else { 219 + log_warning("%s: no qualified partition for blkmap, skipping\n", 220 + __func__); 221 + } 222 + 223 + return 0; 224 + } 225 + 187 226 static int exynos_fastboot_setup(void) 188 227 { 189 228 struct blk_desc *blk_dev; ··· 297 336 298 337 int misc_init_r(void) 299 338 { 339 + int ret; 340 + 300 341 exynos_env_setup(); 342 + 343 + ret = exynos_blk_env_setup(); 344 + if (ret) 345 + return ret; 301 346 302 347 return exynos_fastboot_setup(); 303 348 }
+5
board/samsung/exynos-mobile/exynos-mobile.env
··· 2 2 stdout=serial,vidconsole 3 3 stderr=serial,vidconsole 4 4 5 + blkmapcmd=blkmap create root; 6 + blkmap map root 0 ${blkmap_size_r} linear ${blkmap_blk_ifname} ${blkmap_blk_dev} ${blkmap_blk_nr} 7 + 8 + preboot=run blkmapcmd 9 + 5 10 bootdelay=0 6 11 bootcmd=bootefi bootmgr; pause; bootmenu 7 12
+3 -1
configs/exynos-mobile_defconfig
··· 12 12 CONFIG_ARMV8_CNTFRQ_BROKEN=y 13 13 # CONFIG_PSCI_RESET is not set 14 14 CONFIG_BUTTON_CMD=y 15 + CONFIG_USE_PREBOOT=y 15 16 CONFIG_SAVE_PREV_BL_FDT_ADDR=y 16 17 CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR=y 17 18 CONFIG_SYS_PBSIZE=1024 ··· 24 25 CONFIG_CMD_FS_GENERIC=y 25 26 CONFIG_EFI_PARTITION=y 26 27 CONFIG_OF_UPSTREAM=y 28 + CONFIG_OF_UPSTREAM_BUILD_VENDOR=y 27 29 CONFIG_OF_BOARD=y 28 - CONFIG_OF_UPSTREAM_BUILD_VENDOR=y 30 + CONFIG_BLKMAP=y 29 31 CONFIG_BUTTON=y 30 32 CONFIG_BUTTON_REMAP_PHONE_KEYS=y 31 33 CONFIG_CLK_EXYNOS7870=y