[PATCH] cmd: mmc: modify partconf to be used in script
Jaehoon Chung
jh80.chung at samsung.com
Mon Dec 14 10:59:16 CET 2020
Hi,
On 12/12/20 4:46 PM, grygorii tertychnyi wrote:
> To implement dual-boot strategy we need to know what is the current
> boot partition for U-Boot. It can be easily identified by looking at
> the PARTITION_CONFIG value shown by "mmc partconf dev", but I didn't
> find any way to use it in the boot script.
>
> Hence, modify it, so that "mmc partboot dev part_num" command returns
> true if "part_num" is the current boot partition, otherwise it returns
> false.
Sorry. I don't understand what you want.
And if you want to change something about mmc partconf, then you need to update the Usage.
There is no usage about yours.
And i don't want to add its. It's too dangerous because of possible to set to wrong boot partition.
Best Regards,
Jaehoon Chung
>
> Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi at leica-geosystems.com>
> ---
> cmd/mmc.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/mmc.c b/cmd/mmc.c
> index 1529a3e05ddd..c8db008bc90d 100644
> --- a/cmd/mmc.c
> +++ b/cmd/mmc.c
> @@ -792,6 +792,23 @@ static int mmc_partconf_print(struct mmc *mmc)
> return CMD_RET_SUCCESS;
> }
>
> +static int mmc_partnum_cmp(struct mmc *mmc, u8 part_num)
> +{
> + u8 part;
> +
> + if (mmc->part_config == MMCPART_NOAVAILABLE) {
> + printf("No part_config info for ver. 0x%x\n", mmc->version);
> + return CMD_RET_FAILURE;
> + }
> +
> + part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
> +
> + if (part == part_num)
> + return CMD_RET_SUCCESS;
> + else
> + return CMD_RET_FAILURE;
> +}
> +
> static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
> int argc, char *const argv[])
> {
> @@ -799,7 +816,7 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
> struct mmc *mmc;
> u8 ack, part_num, access;
>
> - if (argc != 2 && argc != 5)
> + if (argc != 2 && argc != 3 && argc != 5)
> return CMD_RET_USAGE;
>
> dev = simple_strtoul(argv[1], NULL, 10);
> @@ -815,6 +832,10 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
>
> if (argc == 2)
> return mmc_partconf_print(mmc);
> + if (argc == 3) {
> + part_num = simple_strtoul(argv[2], NULL, 10);
> + return mmc_partnum_cmp(mmc, part_num);
> + }
>
> ack = simple_strtoul(argv[2], NULL, 10);
> part_num = simple_strtoul(argv[3], NULL, 10);
>
More information about the U-Boot
mailing list