[PATCH 1/2] board: samsung: exynos-mobile: use blkmap for booting from userdata subpartitions
Kaustabh Chakraborty
kauschluss at disroot.org
Mon Feb 23 19:39:09 CET 2026
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 at disroot.org>
---
board/samsung/exynos-mobile/exynos-mobile.c | 45 +++++++++++++++++++++++++++
board/samsung/exynos-mobile/exynos-mobile.env | 5 +++
configs/exynos-mobile_defconfig | 4 ++-
3 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/board/samsung/exynos-mobile/exynos-mobile.c b/board/samsung/exynos-mobile/exynos-mobile.c
index 1f61f28de5f..c5e1b186ae3 100644
--- a/board/samsung/exynos-mobile/exynos-mobile.c
+++ b/board/samsung/exynos-mobile/exynos-mobile.c
@@ -184,6 +184,45 @@ static void exynos_env_setup(void)
env_set("fdtfile", buf);
}
+static int exynos_blk_env_setup(void)
+{
+ const char *blk_ifname;
+ int blk_dev = 0;
+ struct blk_desc *blk_desc;
+ struct disk_partition info = {0};
+ unsigned long largest_part_start = 0, largest_part_size = 0;
+ int i;
+
+ blk_ifname = "mmc";
+ blk_desc = blk_get_dev(blk_ifname, blk_dev);
+ if (!blk_desc) {
+ log_err("%s: required mmc device not available\n", __func__);
+ return -ENODEV;
+ }
+
+ for (i = 1; i < CONFIG_EFI_PARTITION_ENTRIES_NUMBERS; i++) {
+ if (part_get_info(blk_desc, i, &info))
+ continue;
+
+ if (info.start > largest_part_size) {
+ largest_part_start = info.start;
+ largest_part_size = info.size;
+ }
+ }
+
+ if (largest_part_size) {
+ env_set("blkmap_blk_ifname", blk_ifname);
+ env_set_ulong("blkmap_blk_dev", blk_dev);
+ env_set_ulong("blkmap_blk_nr", largest_part_start);
+ env_set_hex("blkmap_size_r", largest_part_size);
+ } else {
+ log_warning("%s: no qualified partition for blkmap, skipping\n",
+ __func__);
+ }
+
+ return 0;
+}
+
static int exynos_fastboot_setup(void)
{
struct blk_desc *blk_dev;
@@ -297,7 +336,13 @@ int board_init(void)
int misc_init_r(void)
{
+ int ret;
+
exynos_env_setup();
+ ret = exynos_blk_env_setup();
+ if (ret)
+ return ret;
+
return exynos_fastboot_setup();
}
diff --git a/board/samsung/exynos-mobile/exynos-mobile.env b/board/samsung/exynos-mobile/exynos-mobile.env
index aa2e89afbac..33f767319b5 100644
--- a/board/samsung/exynos-mobile/exynos-mobile.env
+++ b/board/samsung/exynos-mobile/exynos-mobile.env
@@ -2,6 +2,11 @@ stdin=serial,button-kbd
stdout=serial,vidconsole
stderr=serial,vidconsole
+blkmapcmd=blkmap create root;
+ blkmap map root 0 ${blkmap_size_r} linear ${blkmap_blk_ifname} ${blkmap_blk_dev} ${blkmap_blk_nr}
+
+preboot=run blkmapcmd
+
bootdelay=0
bootcmd=bootefi bootmgr; pause; bootmenu
diff --git a/configs/exynos-mobile_defconfig b/configs/exynos-mobile_defconfig
index c7d206f94ac..cee468d9c24 100644
--- a/configs/exynos-mobile_defconfig
+++ b/configs/exynos-mobile_defconfig
@@ -12,6 +12,7 @@ CONFIG_SYS_LOAD_ADDR=0x80000000
CONFIG_ARMV8_CNTFRQ_BROKEN=y
# CONFIG_PSCI_RESET is not set
CONFIG_BUTTON_CMD=y
+CONFIG_USE_PREBOOT=y
CONFIG_SAVE_PREV_BL_FDT_ADDR=y
CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR=y
CONFIG_SYS_PBSIZE=1024
@@ -24,8 +25,9 @@ CONFIG_CMD_POWEROFF=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_EFI_PARTITION=y
CONFIG_OF_UPSTREAM=y
-CONFIG_OF_BOARD=y
CONFIG_OF_UPSTREAM_BUILD_VENDOR=y
+CONFIG_OF_BOARD=y
+CONFIG_BLKMAP=y
CONFIG_BUTTON=y
CONFIG_BUTTON_REMAP_PHONE_KEYS=y
CONFIG_CLK_EXYNOS7870=y
--
2.52.0
More information about the U-Boot
mailing list