[U-Boot] [PATCH 1/3] part: Add support for list filtering on bootable partitions

Stephen Warren swarren at wwwdotorg.org
Tue Feb 24 01:40:19 CET 2015


On 02/19/2015 01:53 PM, Sjoerd Simons wrote:
> Add an optional -bootable parameter to the part list commands to only
> put the list of bootable partitions in the environment variable

> diff --git a/common/cmd_part.c b/common/cmd_part.c

> +	for (i = 2; i < argc; i++) {
> +		if (argv[i][0] == '-') {
> +			if (!strcmp(argv[i], "-bootable")) {
> +				bootable = true;
> +			} else {
> +				printf("Unknown option %s\n", argv[i]);
> +				return CMD_RET_USAGE;
> +			}
> +		} else if (var == NULL) {
> +			var = argv[i];
> +		} else {
> +			printf("duplicated varname\n");
> +			return CMD_RET_USAGE;
> +		}
> +	}

I'd prefer that to validate the command-line doesn't have multiple 
variable names, or the variable name specified before the -bootable 
flag, so that only the following options are valid:

... var
... -bootable var

and not:

... var1 var2
... var -bootable

etc.

This could be tightened up later I suppose. Other than that, this series 
looks good at a quick glance, so:
Acked-by: Stephen Warren <swarren at nvidia.com>


More information about the U-Boot mailing list