<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/cmd/part.c, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>cmd: part: add part dupcheck subcommand</title>
<updated>2026-03-27T19:19:04+00:00</updated>
<author>
<name>Padmarao Begari</name>
<email>padmarao.begari@amd.com</email>
</author>
<published>2026-03-15T13:15:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=b5517950e6ef9b631299f33a4ce84ba380928258'/>
<id>b5517950e6ef9b631299f33a4ce84ba380928258</id>
<content type='text'>
Add a 'part dupcheck' subcommand that scans all block devices probed
in U-Boot and reports any partitions sharing the same PARTUUID or
PARTLABEL. This helps detect situations where the same disk image has
been flashed onto multiple boot devices (e.g., USB stick and UFS),
which can lead to unpredictable boot behavior. Duplicate
PARTUUIDs break UUID-based partition lookup in Linux, and duplicate
PARTLABELs cause the wrong partition to be silently selected in
bootscripts that reference partitions by name.

A single collection pass iterates over all block devices using
blk_foreach_probe() and records every partition that carries a UUID
or label into a dynamically allocated alist of struct part_seen
entries (UUID string, name string, device pointer, partition number).

Duplicates are detected by calling detect_duplicates() twice, once
for UUIDs and once for labels. Each call sorts the list with qsort()
using a comparator that places empty fields at the end, then performs
a single linear pass to identify consecutive equal entries as
duplicate groups. Each group is reported with the device name and
partition number of every copy, followed by a per-field summary
count. Per-field counts are used consistently in both the
duplicate-found and no-duplicates paths.

Example output (with duplicates):

=&gt; part dupcheck
Warning: duplicate PARTUUID 1234abcd-01 (2 copies)
  found on usb_mass_storage.lun0:1
  found on ufs_scsi.id0lun0:1
Found 1 duplicate PARTUUID(s) (2 total copies) among 4 partitions

Warning: duplicate PARTLABEL primary (2 copies)
  found on usb_mass_storage.lun0:1
  found on ufs_scsi.id0lun0:1
Found 1 duplicate PARTLABEL(s) (2 total copies) among 4 partitions

Example output (mixed: UUID duplicates, no label duplicates):

=&gt; part dupcheck
Warning: duplicate PARTUUID 1234abcd-01 (2 copies)
  found on usb_mass_storage.lun0:1
  found on ufs_scsi.id0lun0:1
Found 1 duplicate PARTUUID(s) (2 total copies) among 4 partitions
No duplicate PARTLABELs found (3 labels)

Example output (no duplicates):

=&gt; part dupcheck
No duplicate PARTUUIDs or PARTLABELs found (4 UUIDs, 3 labels)

The CONFIG_CMD_PART_DUPCHECK Kconfig option (depends on
CMD_PART and BLK) controls inclusion of this subcommand and is
disabled by default.

Signed-off-by: John Toomey &lt;john.toomey@amd.com&gt;
Signed-off-by: Padmarao Begari &lt;padmarao.begari@amd.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a 'part dupcheck' subcommand that scans all block devices probed
in U-Boot and reports any partitions sharing the same PARTUUID or
PARTLABEL. This helps detect situations where the same disk image has
been flashed onto multiple boot devices (e.g., USB stick and UFS),
which can lead to unpredictable boot behavior. Duplicate
PARTUUIDs break UUID-based partition lookup in Linux, and duplicate
PARTLABELs cause the wrong partition to be silently selected in
bootscripts that reference partitions by name.

A single collection pass iterates over all block devices using
blk_foreach_probe() and records every partition that carries a UUID
or label into a dynamically allocated alist of struct part_seen
entries (UUID string, name string, device pointer, partition number).

Duplicates are detected by calling detect_duplicates() twice, once
for UUIDs and once for labels. Each call sorts the list with qsort()
using a comparator that places empty fields at the end, then performs
a single linear pass to identify consecutive equal entries as
duplicate groups. Each group is reported with the device name and
partition number of every copy, followed by a per-field summary
count. Per-field counts are used consistently in both the
duplicate-found and no-duplicates paths.

Example output (with duplicates):

=&gt; part dupcheck
Warning: duplicate PARTUUID 1234abcd-01 (2 copies)
  found on usb_mass_storage.lun0:1
  found on ufs_scsi.id0lun0:1
Found 1 duplicate PARTUUID(s) (2 total copies) among 4 partitions

Warning: duplicate PARTLABEL primary (2 copies)
  found on usb_mass_storage.lun0:1
  found on ufs_scsi.id0lun0:1
Found 1 duplicate PARTLABEL(s) (2 total copies) among 4 partitions

Example output (mixed: UUID duplicates, no label duplicates):

=&gt; part dupcheck
Warning: duplicate PARTUUID 1234abcd-01 (2 copies)
  found on usb_mass_storage.lun0:1
  found on ufs_scsi.id0lun0:1
Found 1 duplicate PARTUUID(s) (2 total copies) among 4 partitions
No duplicate PARTLABELs found (3 labels)

Example output (no duplicates):

=&gt; part dupcheck
No duplicate PARTUUIDs or PARTLABELs found (4 UUIDs, 3 labels)

The CONFIG_CMD_PART_DUPCHECK Kconfig option (depends on
CMD_PART and BLK) controls inclusion of this subcommand and is
disabled by default.

Signed-off-by: John Toomey &lt;john.toomey@amd.com&gt;
Signed-off-by: Padmarao Begari &lt;padmarao.begari@amd.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/part.c: implement "part name" subcommand</title>
<updated>2025-11-18T18:51:09+00:00</updated>
<author>
<name>Rasmus Villemoes</name>
<email>ravi@prevas.dk</email>
</author>
<published>2025-11-10T20:54:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=30890051ab23a0293f6404c9a49e86f33e45df66'/>
<id>30890051ab23a0293f6404c9a49e86f33e45df66</id>
<content type='text'>
This is a natural buddy to the existing "part number", allowing one to
get the partition name for a given partition number.

Acked-by: Quentin Schulz &lt;quentin.schulz@cherry.de&gt;
Signed-off-by: Rasmus Villemoes &lt;ravi@prevas.dk&gt;
Acked-by: Quentin Schuloz &lt;quentin.schulz@cherry.de&gt;
Tested-by: Anshul Dalal &lt;anshuld@ti.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a natural buddy to the existing "part number", allowing one to
get the partition name for a given partition number.

Acked-by: Quentin Schulz &lt;quentin.schulz@cherry.de&gt;
Signed-off-by: Rasmus Villemoes &lt;ravi@prevas.dk&gt;
Acked-by: Quentin Schuloz &lt;quentin.schulz@cherry.de&gt;
Tested-by: Anshul Dalal &lt;anshuld@ti.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>include: Move snprintf to stdio.h</title>
<updated>2024-05-22T14:55:29+00:00</updated>
<author>
<name>Raymond Mao</name>
<email>raymond.mao@linaro.org</email>
</author>
<published>2024-05-16T21:11:52+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=cb73fe9eeae0d71a74eef811b0ba34aaf5513dbe'/>
<id>cb73fe9eeae0d71a74eef811b0ba34aaf5513dbe</id>
<content type='text'>
Move snprintf to stdio.h since it is needed by exteranl libraries.

Signed-off-by: Raymond Mao &lt;raymond.mao@linaro.org&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Ilias Apalodimas &lt;ilias.apalodimas@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move snprintf to stdio.h since it is needed by exteranl libraries.

Signed-off-by: Raymond Mao &lt;raymond.mao@linaro.org&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
Reviewed-by: Ilias Apalodimas &lt;ilias.apalodimas@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd: Remove &lt;common.h&gt; and add needed includes</title>
<updated>2024-05-06T21:05:04+00:00</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2024-04-27T14:10:59+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=301bac6047c85e2c5e39929805ca661bb09a7481'/>
<id>301bac6047c85e2c5e39929805ca661bb09a7481</id>
<content type='text'>
Remove &lt;common.h&gt; from all "cmd/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove &lt;common.h&gt; from all "cmd/" files and when needed add
missing include files directly.

Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd: part: Cover both part type entries with GUID ifdef</title>
<updated>2023-12-20T19:13:20+00:00</updated>
<author>
<name>Marek Vasut</name>
<email>marek.vasut+renesas@mailbox.org</email>
</author>
<published>2023-12-10T21:25:07+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=97135d9f4220e54b38f69a3f2416b2fd9d8f378c'/>
<id>97135d9f4220e54b38f69a3f2416b2fd9d8f378c</id>
<content type='text'>
The 'part type' subcommand depends on GUID partition table support.
The help text exposes one of two 'part type' subcommand entries,
hide both in case GUID partition table support is not enabled to
avoid confusing users.

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The 'part type' subcommand depends on GUID partition table support.
The help text exposes one of two 'part type' subcommand entries,
hide both in case GUID partition table support is not enabled to
avoid confusing users.

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>part: Allow setting the partition-table type</title>
<updated>2023-07-17T09:12:06+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2023-07-16T03:38:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=125194e6a136f2a3ef49d443f139b44a04e1bb9e'/>
<id>125194e6a136f2a3ef49d443f139b44a04e1bb9e</id>
<content type='text'>
Some devices have multiple partition types available on the same media.
It is sometimes useful to see these to check that everything is working
correctly.

Provide a way to manually set the partition-table type, avoiding the
auto-detection process.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some devices have multiple partition types available on the same media.
It is sometimes useful to see these to check that everything is working
correctly.

Provide a way to manually set the partition-table type, avoiding the
auto-detection process.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd: part: Add partition-related type command</title>
<updated>2023-01-18T18:10:41+00:00</updated>
<author>
<name>Enric Balletbo i Serra</name>
<email>eballetb@redhat.com</email>
</author>
<published>2023-01-10T16:19:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=22e7f1d108410cc81a0ec5a6481338e4d6e9586e'/>
<id>22e7f1d108410cc81a0ec5a6481338e4d6e9586e</id>
<content type='text'>
This implements the following command:

    part type mmc 0:1
      -&gt; print partition type UUID
    part type mmc 0:1 uuid
      -&gt; set environment variable to partition type UUID

"part type" can be useful when writing a bootcmd which searches for a
specific partition type to enable automatic discovery of partitions and
their intended usage or mount point.

Signed-off-by: Enric Balletbo i Serra &lt;eballetbo@redhat.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
[trini: Fix when CONFIG_PARTITION_TYPE_GUID is disabled and have the
command check for "types" before "type"]
Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements the following command:

    part type mmc 0:1
      -&gt; print partition type UUID
    part type mmc 0:1 uuid
      -&gt; set environment variable to partition type UUID

"part type" can be useful when writing a bootcmd which searches for a
specific partition type to enable automatic discovery of partitions and
their intended usage or mount point.

Signed-off-by: Enric Balletbo i Serra &lt;eballetbo@redhat.com&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
[trini: Fix when CONFIG_PARTITION_TYPE_GUID is disabled and have the
command check for "types" before "type"]
Signed-off-by: Tom Rini &lt;trini@konsulko.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd: part: list all 128 GPT partitions</title>
<updated>2022-01-15T09:57:22+00:00</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2022-01-11T15:03:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=bc314f8e5f9b646e5ed09ccee2a2ddb012519305'/>
<id>bc314f8e5f9b646e5ed09ccee2a2ddb012519305</id>
<content type='text'>
A GPT partition table typically has 128 entries. If a partition table
contains a partition 128 'part list' should be able to list it.

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A GPT partition table typically has 128 entries. If a partition table
contains a partition 128 'part list' should be able to list it.

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd: part: Correct error handling</title>
<updated>2021-07-23T11:13:25+00:00</updated>
<author>
<name>Anders Dellien</name>
<email>anders.dellien@arm.com</email>
</author>
<published>2021-06-22T09:40:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=7cb31e399e46a74d1d46e8b64598d86018fa4e0b'/>
<id>7cb31e399e46a74d1d46e8b64598d86018fa4e0b</id>
<content type='text'>
As 'part_get_info_by_name' now returns more status codes than just
-1 to indicate failure, we need to update the return value check.

Signed-off-by: Anders Dellien &lt;anders.dellien@arm.com&gt;
Reviewed-by: Sean Anderson &lt;sean.anderson@seco.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As 'part_get_info_by_name' now returns more status codes than just
-1 to indicate failure, we need to update the return value check.

Signed-off-by: Anders Dellien &lt;anders.dellien@arm.com&gt;
Reviewed-by: Sean Anderson &lt;sean.anderson@seco.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd: part: Add subcommand to list supported partition tables</title>
<updated>2020-07-07T19:22:42+00:00</updated>
<author>
<name>Niel Fourie</name>
<email>lusus@denx.de</email>
</author>
<published>2020-03-24T15:17:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0ffdfbd1d0eca769878913d15f232c9219cf2aa1'/>
<id>0ffdfbd1d0eca769878913d15f232c9219cf2aa1</id>
<content type='text'>
Add a subcommand "types" to the part command, which lists the supported
partition table types.

Signed-off-by: Niel Fourie &lt;lusus@denx.de&gt;
Cc: Simon Glass &lt;sjg@chromium.org&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a subcommand "types" to the part command, which lists the supported
partition table types.

Signed-off-by: Niel Fourie &lt;lusus@denx.de&gt;
Cc: Simon Glass &lt;sjg@chromium.org&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
