summaryrefslogtreecommitdiff
path: root/board/samsung
diff options
context:
space:
mode:
authorKaustabh Chakraborty <[email protected]>2026-02-24 21:07:09 +0530
committerMinkyu Kang <[email protected]>2026-02-25 10:47:03 +0900
commitdb0fe21bd38f27f570ce16670ccad567efd596f4 (patch)
tree13f6d84ab4cf8ad4d3a554ec2d67028339118cc9 /board/samsung
parente4001865ff387b928ea3d422d673dcc7389f8665 (diff)
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 <[email protected]> Signed-off-by: Minkyu Kang <[email protected]>
Diffstat (limited to 'board/samsung')
-rw-r--r--board/samsung/exynos-mobile/exynos-mobile.c45
-rw-r--r--board/samsung/exynos-mobile/exynos-mobile.env5
2 files changed, 50 insertions, 0 deletions
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