From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 06 Nov 2023 13:24:44 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qzyeq-000ANy-0V for lore@lore.pengutronix.de; Mon, 06 Nov 2023 13:24:44 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qzyep-0006uu-A4; Mon, 06 Nov 2023 13:24:43 +0100 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[IPV6:::1]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qzyeo-0006uZ-Dz; Mon, 06 Nov 2023 13:24:42 +0100 Message-ID: <2389ac80-c83f-472b-be3c-c4b8b5a4f6ee@pengutronix.de> Date: Mon, 6 Nov 2023 13:24:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US-large To: Roland Hieber , Ahmad Fatoum References: <20231106110405.3209233-1-a.fatoum@pengutronix.de> <20231106120329.kg4hyzmhaml4ko36@pengutronix.de> From: =?UTF-8?Q?Leonard_G=C3=B6hrs?= In-Reply-To: <20231106120329.kg4hyzmhaml4ko36@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [OSS-Tools] [PATCH] libdt: prefer first found disk when looking for block devices X-BeenThere: oss-tools@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: Pengutronix Public Open-Source-Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: oss-tools@pengutronix.de Sender: "OSS-Tools" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: oss-tools-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On 06.11.23 13:03, Roland Hieber wrote: > On Mon, Nov 06, 2023 at 12:04:05PM +0100, Ahmad Fatoum wrote: >> 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 >> release. >> >> Reported-by: Leonard Göhrs >> Signed-off-by: Ahmad Fatoum > > Tested-by: Roland Hieber [riot,imx6s-riotboard] Tested-by: Leonard Göhrs [lxa,stm32mp157c-tac-gen1] >> --- >> 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) >> continue; >> - if (!strcmp(devtype, "disk")) { >> + if (!strcmp(devtype, "disk") && !best_match) { >> best_match = part; >> >> /* Should we try to find a matching partition first? */ >> -- >> 2.39.2 >> >> >> >