mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
Cc: "Leonard Göhrs" <>
Subject: [OSS-Tools] [PATCH] libdt: prefer first found disk when looking for block devices
Date: Mon,  6 Nov 2023 12:04:05 +0100	[thread overview]
Message-ID: <> (raw)

Recent rework introduced a regression for state located in the eMMC
user area described by DT fixed partitions. Whereas before, the first
device with type "disk" was taken, dt-utils will now iterate over all
devices to try to find a matching GPT partition. If it doesn't find any,
it will instead take the last device with type "disk", which will be the
second boot partition for eMMC devices leading barebox-state to access
/dev/mmcblkXboot1 instead of /dev/mmcblkX.

Let's fix this regression by restoring the old behavior of preferring the
first disk. This may not be totally future proof, but it worked ok for
years and a better solution can always be added later with a regular

Reported-by: Leonard Göhrs <>
Signed-off-by: Ahmad Fatoum <>
 src/libdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libdt.c b/src/libdt.c
index 650b40467587..72e8ab41e09b 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2301,7 +2301,7 @@ static int cdev_from_block_device(struct udev_device *dev,
 		devtype = udev_device_get_devtype(part);
 		if (!devtype)
-		if (!strcmp(devtype, "disk")) {
+		if (!strcmp(devtype, "disk") && !best_match) {
 			best_match = part;
 			/* Should we try to find a matching partition first? */

             reply	other threads:[~2023-11-06 11:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 11:04 Ahmad Fatoum [this message]
2023-11-06 12:03 ` Roland Hieber
2023-11-06 12:24   ` Leonard Göhrs
2023-11-24 11:24 ` Roland Hieber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox