mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems
@ 2024-12-12  7:53 Ahmad Fatoum
  2024-12-12  7:53 ` [PATCH 2/2] ARM: beaglebone: register bbu handlers for FAT partition Ahmad Fatoum
  2024-12-16  8:30 ` [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-12-12  7:53 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The code used to handle any path equally well, but then it was broken
for paths that don't start with /dev, i.e. anything in a filesystem.

Add an explicit /dev check before going into the newer code, so
bbu_register_std_file_update can once again be called with paths
that start with /mnt for example. Previously, this resulted in following
error message:

  bbu: Skipping handler bbu-MLO.fat.emmc: /dev//mnt/mmc1.0/barebox.bin unavailable

Fixes: df22a22f84b6 ("bbu: fix exporting i.MX NAND bbu handler over fastboot")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/bbu.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/common/bbu.c b/common/bbu.c
index 9ea8a1a3f247..ba550f925608 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -43,14 +43,18 @@ void bbu_append_handlers_to_file_list(struct file_list *files)
 	struct bbu_handler *handler;
 
 	list_for_each_entry(handler, &bbu_image_handlers, list) {
-		const char *cdevname;
+		const char *cdevname, *devpath;
+		char *buf = NULL;
 		struct stat s;
-		char *devpath;
 
-		cdevname = devpath_to_name(handler->devicefile);
-		device_detect_by_name(cdevname);
+		devpath = handler->devicefile;
 
-		devpath = basprintf("/dev/%s", cdevname);
+		if (strstarts(devpath, "/dev/")) {
+			cdevname = devpath_to_name(devpath);
+			device_detect_by_name(cdevname);
+
+			devpath = buf = basprintf("/dev/%s", cdevname);
+		}
 
 		if (stat(devpath, &s) == 0) {
 			append_bbu_entry(handler->name, devpath, files);
@@ -59,7 +63,7 @@ void bbu_append_handlers_to_file_list(struct file_list *files)
 				handler->name, devpath);
 		}
 
-		free(devpath);
+		free(buf);
 	}
 }
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ARM: beaglebone: register bbu handlers for FAT partition
  2024-12-12  7:53 [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems Ahmad Fatoum
@ 2024-12-12  7:53 ` Ahmad Fatoum
  2024-12-16  8:30 ` [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-12-12  7:53 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We currently only register a single barebox update handler for the eMMC,
but the MLO can also be on the SD-Card or in a FAT partition instead one
of the magic offsets.

Let's therefore register MLO bbu handlers for those as well as well as
for the second stage barebox.bin.

Fixes: df22a22f84b6 ("bbu: fix exporting i.MX NAND bbu handler over fastboot")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/beaglebone/board.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/beaglebone/board.c b/arch/arm/boards/beaglebone/board.c
index 43e2d81f3813..586d83fc4df0 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -78,9 +78,19 @@ static int beaglebone_devices_init(void)
 
 	armlinux_set_architecture(MACH_TYPE_BEAGLEBONE);
 
-	/* Register update handler */
+	/* Register update handlers */
 	am33xx_bbu_emmc_mlo_register_handler("MLO.emmc", "/dev/mmc1");
 
+	bbu_register_std_file_update("MLO.fat.emmc", 0, "/mnt/mmc1.0/MLO",
+				     filetype_ch_image);
+	bbu_register_std_file_update("barebox.fat.emmc", 0, "/mnt/mmc1.0/barebox.bin",
+				     filetype_arm_barebox);
+
+	bbu_register_std_file_update("MLO.fat.sd", 0, "/mnt/mmc0.0/MLO",
+				     filetype_ch_image);
+	bbu_register_std_file_update("barebox.fat.sd", 0, "/mnt/mmc0.0/barebox.bin",
+				     filetype_arm_barebox);
+
 	if (IS_ENABLED(CONFIG_SHELL_NONE))
 		return am33xx_of_register_bootdevice();
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems
  2024-12-12  7:53 [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems Ahmad Fatoum
  2024-12-12  7:53 ` [PATCH 2/2] ARM: beaglebone: register bbu handlers for FAT partition Ahmad Fatoum
@ 2024-12-16  8:30 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-12-16  8:30 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Thu, 12 Dec 2024 08:53:07 +0100, Ahmad Fatoum wrote:
> The code used to handle any path equally well, but then it was broken
> for paths that don't start with /dev, i.e. anything in a filesystem.
> 
> Add an explicit /dev check before going into the newer code, so
> bbu_register_std_file_update can once again be called with paths
> that start with /mnt for example. Previously, this resulted in following
> error message:
> 
> [...]

Applied, thanks!

[1/2] bbu: fix bbu_register_std_file_update regression for file systems
      https://git.pengutronix.de/cgit/barebox/commit/?id=22c800507c4a (link may not be stable)
[2/2] ARM: beaglebone: register bbu handlers for FAT partition
      https://git.pengutronix.de/cgit/barebox/commit/?id=3da2f2975e8d (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-16  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-12  7:53 [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems Ahmad Fatoum
2024-12-12  7:53 ` [PATCH 2/2] ARM: beaglebone: register bbu handlers for FAT partition Ahmad Fatoum
2024-12-16  8:30 ` [PATCH 1/2] bbu: fix bbu_register_std_file_update regression for file systems Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox