From 58be416fec1e08444195ca78ade066f4e82735a0 Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 1 Oct 2018 13:00:43 +0900 Subject: [PATCH] board: samsung: exynos5-dt: modify the get_dfu_alt_system information If there is a partition7, set to dfu_alt_system_2. Otherwise, just use the dfu_alt_system. (It's relevant to thor download.) Change-Id: I1ff7b5a6c97ad7eed2b6cd489260cfdc902c2a73 Signed-off-by: Jaehoon Chung --- board/samsung/common/exynos5-dt.c | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index 8d98289623..8a01d5779f 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -187,11 +188,40 @@ int board_usb_init(int index, enum usb_init_type init) char *get_dfu_alt_system(char *interface, char *devstr) { char *info = "Not supported!"; + struct mmc *mmc; + char *alt_system; + int dev_num; + int ret; + disk_partition_t partinfo; if (board_is_odroidxu4() || board_is_odroidhc1()) return info; - return getenv("dfu_alt_system"); + dev_num = simple_strtoul(devstr, NULL, 10); + + mmc = find_mmc_device(dev_num); + if (!mmc) + return NULL; + + if (mmc_init(mmc)) + return NULL; + + ret = blk_select_hwpart_devnum(IF_TYPE_MMC, 0, 0); + if (ret) + return NULL; + + if (getenv("ramdiskpart")) { + int part_num = (int)simple_strtoul(getenv("ramdiskpart"), NULL, 10); + ret = part_get_info(&mmc->block_dev, part_num, &partinfo); + if (ret) + alt_system = CONFIG_DFU_ALT_SYSTEM; + else + alt_system = CONFIG_DFU_ALT_SYSTEM_2; + } else { + alt_system = CONFIG_DFU_ALT_SYSTEM; + } + + return alt_system; } char *get_dfu_alt_boot(char *interface, char *devstr) -- 2.34.1