mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] kbuild: dtc: use env to resolve echo
@ 2022-01-20  7:47 Rouven Czerwinski
  2022-01-20  8:36 ` Trent Piepho
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rouven Czerwinski @ 2022-01-20  7:47 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Posix does not mandate to have binaries within a certain path, but
rather that the utilities may be available. Use env to resolve and call
echo from PATH.

Fixes: 2ae7ac7ab2f1 ("kbuild: dtc: Allow adding device tree fragments via config")

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 13b1789c01..94ca1b771b 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -340,7 +340,7 @@ dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS))
 quiet_cmd_dtc = DTC     $@
 # For compatibility between make 4.2 and 4.3
 H := \#
-cmd_dtc = /bin/echo -e '$(H)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(H)include "$(f)"\n') | \
+cmd_dtc = /usr/bin/env echo -e '$(H)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(H)include "$(f)"') | \
 	$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \
 	$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
 		-i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) \
-- 
2.34.1


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


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

* Re: [PATCH] kbuild: dtc: use env to resolve echo
  2022-01-20  7:47 [PATCH] kbuild: dtc: use env to resolve echo Rouven Czerwinski
@ 2022-01-20  8:36 ` Trent Piepho
  2022-01-20  8:46   ` Rouven Czerwinski
  2022-01-20  8:56 ` Sascha Hauer
  2022-02-21 14:41 ` Sascha Hauer
  2 siblings, 1 reply; 6+ messages in thread
From: Trent Piepho @ 2022-01-20  8:36 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

There's another in scripts/Kbuild.include

On Thu, Jan 20, 2022 at 12:04 AM Rouven Czerwinski
<r.czerwinski@pengutronix.de> wrote:
>
> Posix does not mandate to have binaries within a certain path, but
> rather that the utilities may be available. Use env to resolve and call
> echo from PATH.
>
> Fixes: 2ae7ac7ab2f1 ("kbuild: dtc: Allow adding device tree fragments via config")
>
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  scripts/Makefile.lib | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 13b1789c01..94ca1b771b 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -340,7 +340,7 @@ dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS))
>  quiet_cmd_dtc = DTC     $@
>  # For compatibility between make 4.2 and 4.3
>  H := \#
> -cmd_dtc = /bin/echo -e '$(H)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(H)include "$(f)"\n') | \
> +cmd_dtc = /usr/bin/env echo -e '$(H)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(H)include "$(f)"') | \
>         $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \
>         $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
>                 -i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) \
> --
> 2.34.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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


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

* Re: [PATCH] kbuild: dtc: use env to resolve echo
  2022-01-20  8:36 ` Trent Piepho
@ 2022-01-20  8:46   ` Rouven Czerwinski
  0 siblings, 0 replies; 6+ messages in thread
From: Rouven Czerwinski @ 2022-01-20  8:46 UTC (permalink / raw)
  To: Trent Piepho; +Cc: barebox

Hi Trent,

On Thu, 2022-01-20 at 00:36 -0800, Trent Piepho wrote:
> There's another in scripts/Kbuild.include

Yep, I have a patch for that as well. We haven't hit this since as-
instr isn't used anywhere within barebox.

- rcz

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


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

* Re: [PATCH] kbuild: dtc: use env to resolve echo
  2022-01-20  7:47 [PATCH] kbuild: dtc: use env to resolve echo Rouven Czerwinski
  2022-01-20  8:36 ` Trent Piepho
@ 2022-01-20  8:56 ` Sascha Hauer
  2022-01-20  9:14   ` Michael Olbrich
  2022-02-21 14:41 ` Sascha Hauer
  2 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2022-01-20  8:56 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Thu, Jan 20, 2022 at 08:47:33AM +0100, Rouven Czerwinski wrote:
> Posix does not mandate to have binaries within a certain path, but
> rather that the utilities may be available. Use env to resolve and call
> echo from PATH.
> 
> Fixes: 2ae7ac7ab2f1 ("kbuild: dtc: Allow adding device tree fragments via config")
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  scripts/Makefile.lib | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 13b1789c01..94ca1b771b 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -340,7 +340,7 @@ dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS))
>  quiet_cmd_dtc = DTC     $@
>  # For compatibility between make 4.2 and 4.3
>  H := \#
> -cmd_dtc = /bin/echo -e '$(H)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(H)include "$(f)"\n') | \

Why hardcode /bin/echo anyway and not use plain 'echo' instead. I assume
because echo can be a shell builtin, but are there shells out there
where the builtin is not enough?

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] 6+ messages in thread

* Re: [PATCH] kbuild: dtc: use env to resolve echo
  2022-01-20  8:56 ` Sascha Hauer
@ 2022-01-20  9:14   ` Michael Olbrich
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2022-01-20  9:14 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Rouven Czerwinski, barebox

On Thu, Jan 20, 2022 at 09:56:49AM +0100, Sascha Hauer wrote:
> On Thu, Jan 20, 2022 at 08:47:33AM +0100, Rouven Czerwinski wrote:
> > Posix does not mandate to have binaries within a certain path, but
> > rather that the utilities may be available. Use env to resolve and call
> > echo from PATH.
> > 
> > Fixes: 2ae7ac7ab2f1 ("kbuild: dtc: Allow adding device tree fragments via config")
> > 
> > Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> > ---
> >  scripts/Makefile.lib | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 13b1789c01..94ca1b771b 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -340,7 +340,7 @@ dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS))
> >  quiet_cmd_dtc = DTC     $@
> >  # For compatibility between make 4.2 and 4.3
> >  H := \#
> > -cmd_dtc = /bin/echo -e '$(H)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(H)include "$(f)"\n') | \
> 
> Why hardcode /bin/echo anyway and not use plain 'echo' instead. I assume
> because echo can be a shell builtin, but are there shells out there
> where the builtin is not enough?

The builtin echo implementations are not very compatible. Better use printf
instead. For example, echo from dash (the default /bin/sh in Debian) does
not support '-e'.

Michael

-- 
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] 6+ messages in thread

* Re: [PATCH] kbuild: dtc: use env to resolve echo
  2022-01-20  7:47 [PATCH] kbuild: dtc: use env to resolve echo Rouven Czerwinski
  2022-01-20  8:36 ` Trent Piepho
  2022-01-20  8:56 ` Sascha Hauer
@ 2022-02-21 14:41 ` Sascha Hauer
  2 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2022-02-21 14:41 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Thu, Jan 20, 2022 at 08:47:33AM +0100, Rouven Czerwinski wrote:
> Posix does not mandate to have binaries within a certain path, but
> rather that the utilities may be available. Use env to resolve and call
> echo from PATH.
> 
> Fixes: 2ae7ac7ab2f1 ("kbuild: dtc: Allow adding device tree fragments via config")
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  scripts/Makefile.lib | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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] 6+ messages in thread

end of thread, other threads:[~2022-02-21 14:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  7:47 [PATCH] kbuild: dtc: use env to resolve echo Rouven Czerwinski
2022-01-20  8:36 ` Trent Piepho
2022-01-20  8:46   ` Rouven Czerwinski
2022-01-20  8:56 ` Sascha Hauer
2022-01-20  9:14   ` Michael Olbrich
2022-02-21 14:41 ` Sascha Hauer

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