From: Chanho Park Date: Mon, 27 Jul 2015 04:43:54 +0000 (+0900) Subject: common: fastboot: retrieve partition tables from mmc X-Git-Tag: submit/tizen/20160318.071304~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5c90e837a4bf22ee9a38130cd5d64c65fafffbd;p=profile%2Fcommon%2Fplatform%2Fkernel%2Fu-boot-artik.git common: fastboot: retrieve partition tables from mmc This patch allow to retrieve partition tables from mmc device. It reads the tables through get_partition_info function and appends the partitions the end of the static partitions. Signed-off-by: Chanho Park --- diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index e5abff432..4b9a77e68 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -1668,6 +1668,34 @@ static int set_partition_table() #endif #if defined(CFG_FASTBOOT_SDMMCBSP) + +#ifdef CONFIG_FASTBOOT_GET_MMC_PARTITIONS +static int get_mmc_partition_tables() +{ + int i, ret; + block_dev_desc_t *dev_desc; + disk_partition_t info; + + ret = get_device("mmc", "0", &dev_desc); + if (ret < 0) + return -1; + + for (i = 1; i < 128; i++) { + ret = get_partition_info(dev_desc, i, &info); + if (ret) + break; + + strcpy(ptable[pcount].name, info.name); + ptable[pcount].start = info.start * info.blksz; + ptable[pcount].length = info.size * info.blksz; + ptable[pcount].flags = FASTBOOT_PTENTRY_FLAGS_USE_MMC_CMD; + pcount++; + } + + return pcount; +} +#endif /* CONFIG_FASTBOOT_GET_MMC_PARTITIONS */ + static int set_partition_table_sdmmc() { unsigned long long start, count; @@ -1776,6 +1804,10 @@ static int set_partition_table_sdmmc() pcount++; #endif /* End of CONFIG_ANDROID_PARTITIONS */ +#ifdef CONFIG_FASTBOOT_GET_MMC_PARTITIONS + get_mmc_partition_tables(); +#endif /* CONFIG_FASTBOOT_GET_MMC_PARTITIONS */ + #if 1 // Debug fastboot_flash_dump_ptn(); #endif