mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] of: overlay: don't do fixups on empty global.of.overlay.dir
@ 2021-08-31 16:11 Ahmad Fatoum
  2021-10-04 11:27 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-08-31 16:11 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

$global.of.overlay.dir is dynamically prepended with the root of the
device currently being booted. This allows use of relative paths.

Because $global.of.overlay.filepattern is * by default, this means that
all files in the root of the device will be considered overlays and
barebox will try to unflatten them leading to an error message on boot:

  ERROR: of_overlay: Failed to unflatten /mnt/mmc0.4//.root_is_rw:
	Invalid argument

Fix this by not doing any fixups at all on empty global.of.overlay.dir.

If for whatever reason, a user wants overlays at /, they can

  global.of.overlay.dir=.

Fixes: 124c64af0982 ("overlay: Add filters to choose which overlays to apply")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/overlay.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 42b309805fd2..25140eed31ed 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -460,6 +460,9 @@ static int of_overlay_global_fixup(struct device_node *root, void *data)
 	if (*of_overlay_dir == '/')
 		return of_overlay_apply_dir(root, of_overlay_dir, true);
 
+	if (*of_overlay_dir == '\0')
+		return 0;
+
 	dir = concat_path_file(of_overlay_basedir, of_overlay_dir);
 
 	ret = of_overlay_apply_dir(root, dir, true);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH master] of: overlay: don't do fixups on empty global.of.overlay.dir
  2021-08-31 16:11 [PATCH master] of: overlay: don't do fixups on empty global.of.overlay.dir Ahmad Fatoum
@ 2021-10-04 11:27 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-10-04 11:27 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Aug 31, 2021 at 06:11:39PM +0200, Ahmad Fatoum wrote:
> $global.of.overlay.dir is dynamically prepended with the root of the
> device currently being booted. This allows use of relative paths.
> 
> Because $global.of.overlay.filepattern is * by default, this means that
> all files in the root of the device will be considered overlays and
> barebox will try to unflatten them leading to an error message on boot:
> 
>   ERROR: of_overlay: Failed to unflatten /mnt/mmc0.4//.root_is_rw:
> 	Invalid argument
> 
> Fix this by not doing any fixups at all on empty global.of.overlay.dir.
> 
> If for whatever reason, a user wants overlays at /, they can
> 
>   global.of.overlay.dir=.
> 
> Fixes: 124c64af0982 ("overlay: Add filters to choose which overlays to apply")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/of/overlay.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-10-04 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 16:11 [PATCH master] of: overlay: don't do fixups on empty global.of.overlay.dir Ahmad Fatoum
2021-10-04 11:27 ` Sascha Hauer

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