[RFC PATCH v2] cmd: part: add dupcheck command to detect duplicate PARTUUIDs
Tom Rini
trini at konsulko.com
Wed Feb 25 17:33:19 CET 2026
On Wed, Feb 25, 2026 at 05:27:45PM +0100, Quentin Schulz wrote:
> Hi Padmarao,
>
> On 2/22/26 8:07 AM, Padmarao Begari wrote:
> > Add a 'part dupcheck' subcommand that scans all block devices for
> > duplicate partition UUIDs. This helps detect situations where the
> > same disk image has been flashed to multiple boot devices (e.g.,
> > USB stick and UFS), which can lead to unpredictable boot behavior
> > when using PARTUUID-based root filesystem specifications. It
> > iterates all block devices using blk_foreach_probe() and checks
> > partition UUIDs via part_get_info().
> >
> > When duplicates are found, a warning is printed for each occurrence:
> >
> > Warning: duplicate PARTUUID 20c5fba5-0171-457f-b9cd-f5129cd07228
> > first seen on usb_mass_storage.lun0:3
> > also on ufs_scsi.id0lun0:3
> >
> > Add Kconfig option `CMD_PART_DUPCHECK` and update the `part` help
> > text accordingly.
> >
> > Signed-off-by: John Toomey <john.toomey at amd.com>
> > Signed-off-by: Padmarao Begari <padmarao.begari at amd.com>
> > ---
> > Changes in v2:
> > -Add own kconfig symbol for dupcheck subcommand and guard it.
> > ---
> > cmd/Kconfig | 7 ++++
> > cmd/part.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++-
> > 2 files changed, 110 insertions(+), 1 deletion(-)
> >
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > index 322ebe600c5..73d27fe2e28 100644
> > --- a/cmd/Kconfig
> > +++ b/cmd/Kconfig
> > @@ -1663,6 +1663,13 @@ config CMD_PART
> > Read and display information about the partition table on
> > various media.
> > +config CMD_PART_DUPCHECK
> > + bool "part dupcheck"
> > + depends on CMD_PART
> > + help
> > + Enable the 'part dupcheck' sub-command under 'part' to scan the
> > + current partition table and report any duplicate partition UUIDs.
> > +
> > config CMD_PCI
> > bool "pci - Access PCI devices"
> > help
> > diff --git a/cmd/part.c b/cmd/part.c
> > index 975a0a08a99..c4df5053936 100644
> > --- a/cmd/part.c
> > +++ b/cmd/part.c
> > @@ -15,9 +15,12 @@
> > * Pavel Bartusek <pba at sysgo.com>
> > */
> > +#include <blk.h>
> > #include <config.h>
> > #include <command.h>
> > +#include <dm.h>
> > #include <env.h>
> > +#include <malloc.h>
>
> Can you check the size impact of adding those three include files if we
> aren't enabling CMD_PART_DUPCHECK? I'm wondering if we shouldn't guard those
> includes with the Kconfig symbol as well?
Headers shouldn't have a size impact. If they do, that's a problem to
figure out.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260225/8fed074d/attachment.sig>
More information about the U-Boot
mailing list