summaryrefslogtreecommitdiff
path: root/scripts/objdiff
diff options
context:
space:
mode:
authorPadmarao Begari <[email protected]>2026-03-15 18:45:29 +0530
committerTom Rini <[email protected]>2026-03-27 13:19:04 -0600
commitb5517950e6ef9b631299f33a4ce84ba380928258 (patch)
tree9588fad71c91e4e3cf823c584d060525ad91d512 /scripts/objdiff
parent29cb951e8ca6a9feecd920da31af9f18918057fe (diff)
cmd: part: add part dupcheck subcommand
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): => 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): => 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): => 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 <[email protected]> Signed-off-by: Padmarao Begari <[email protected]>
Diffstat (limited to 'scripts/objdiff')
0 files changed, 0 insertions, 0 deletions