[U-Boot] [PATCH V2 4/4] cmd_part: add partition-related command

Stephen Warren swarren at wwwdotorg.org
Thu Sep 6 04:38:26 CEST 2012


On 09/05/2012 05:51 PM, Rob Herring wrote:
> On 09/05/2012 05:03 PM, Stephen Warren wrote:
>> From: Stephen Warren <swarren at nvidia.com>
>>
>> This implements the following:
>>
>> part uuid mmc 0:1
>>   -> print partition UUID
>> part uuid mmc 0:1 uuid
>>   -> set environment variable to partition UUID
> 
> What's the reason to not always both print out and set the uuid env var?
> 
> Perhaps the env name should be partuuid or part_uuid as you could have
> uuid's for other purposes?

The idea is that if you're running the command interactively, you won't
pass a variable name on the command-line, so the command will print out
the UUID for you to read. In this case, it's pointless to set any
environment variable.

However, if you're writing a script, you want to capture the UUID into
an environment variable, and it's quite unlikely you want to litter
stdout with that content too. Hence, either-or, not both.

Note that in the second command above, the final parameter "uuid" is the
environment variable name, so you can save as many UUIDs for different
partitions into whatever variables you want; IIRC in the scripts I wrote
to use this, I did name the variable root_uuid or somesuch.

>> This can be useful when writing a bootcmd which searches all known
>> devices for something bootable, and then wants the kernel to use the
>> same partition as the root device, e.g.:
>>
>> part uuid ${devtype} ${devnum}:${rootpart} uuid
>> setenv bootargs root=PARTUUID=${uuid} ...
>>
>> It is expected that further part sub-commands will be added later, e.g.
>> to find which partition on a disk is marked bootable, to write new
>> partition tables to disk, etc.
> 
> A list command would be useful and would be better located here than
> under scsi or other interface commands. Perhaps instead of printing a
> single part uuid, you should make a list command that prints all
> partitions and their UUIDs. That would address my first question.

Yes, I wondered about "part list mmc 0", which would do essentially the
same thing as e.g. "mmc dev 0; mmc part", and also expanding the
partition printing functions to dump extra information, such as GPT's
partition type UUID, partition UUID, and attributes.


More information about the U-Boot mailing list