diff mbox series

[v2,7/8] env: Provide a work-around for unquoting fdtfile

Message ID 20240823204824.443631-8-sjg@chromium.org
State Superseded
Delegated to: Andre Przywara
Headers show
Series bootstd: sunxi: Migrate to standard boot | expand

Commit Message

Simon Glass Aug. 23, 2024, 8:48 p.m. UTC
Some boards use a CONFIG option to specify the value of this variable.
This is normally handled by efi_get_distro_fdt_name() but in the case
of sunxi this does not work, since 'soc' is sunxi, but the files are
in the allwinner directory.

Provide a work-around for this particular case.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 Makefile                  |  1 +
 doc/usage/environment.rst | 12 ++++++++++++
 2 files changed, 13 insertions(+)

Comments

Quentin Schulz Aug. 26, 2024, 3:56 p.m. UTC | #1
Hi Simon,

On 8/23/24 10:48 PM, Simon Glass wrote:
> Some boards use a CONFIG option to specify the value of this variable.
> This is normally handled by efi_get_distro_fdt_name() but in the case
> of sunxi this does not work, since 'soc' is sunxi, but the files are
> in the allwinner directory.
> 
> Provide a work-around for this particular case.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> (no changes since v1)
> 
>   Makefile                  |  1 +
>   doc/usage/environment.rst | 12 ++++++++++++
>   2 files changed, 13 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 9a52cc8d0b4..2452a916244 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1844,6 +1844,7 @@ quiet_cmd_gen_envp = ENVP    $@
>   		$(CPP) -P $(cpp_flags) -x assembler-with-cpp -undef \
>   			-D__ASSEMBLY__ \
>   			-D__UBOOT_CONFIG__ \
> +			-DDEFAULT_DEVICE_TREE=$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE)) \
>   			-I . -I include -I $(srctree)/include \
>   			-include linux/kconfig.h -include include/config.h \
>   			-I$(srctree)/arch/$(ARCH)/include \
> diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst
> index cc33d3ec0f2..eaebf61742a 100644
> --- a/doc/usage/environment.rst
> +++ b/doc/usage/environment.rst
> @@ -87,6 +87,18 @@ settings. For example::
>   
>      #include <env/ti/mmc.env>
>   
> +Quotes are not supressed, for example::

s/supressed/suppressed/

> +
> +    fdtfile=CONFIG_DEFAULT_DEVICE_TREE.dtb
> +    # produces: fdtfile="sun7i-a20-pcduino3.dtb"
> +

Is this not rather
fdtfile="sun7i-a20-pcduino3".dtb
? (i have no clue but I've this gut feeling this doesn't match what the 
subst command does above and why the .dtb extension would be inside the 
quotes)

> +For this particular issue you can use DEFAULT_DEVICE_TREE instead::

Maybe use double tickquotes to highlight this is a variable? i.e.

``DEFAULT_DEVICE_TREE``

?

Cheers,
Quentin
Simon Glass Sept. 1, 2024, 8:09 p.m. UTC | #2
Hi Quentin,

On Mon, 26 Aug 2024 at 09:56, Quentin Schulz <quentin.schulz@cherry.de> wrote:
>
> Hi Simon,
>
> On 8/23/24 10:48 PM, Simon Glass wrote:
> > Some boards use a CONFIG option to specify the value of this variable.
> > This is normally handled by efi_get_distro_fdt_name() but in the case
> > of sunxi this does not work, since 'soc' is sunxi, but the files are
> > in the allwinner directory.
> >
> > Provide a work-around for this particular case.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> >   Makefile                  |  1 +
> >   doc/usage/environment.rst | 12 ++++++++++++
> >   2 files changed, 13 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 9a52cc8d0b4..2452a916244 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1844,6 +1844,7 @@ quiet_cmd_gen_envp = ENVP    $@
> >               $(CPP) -P $(cpp_flags) -x assembler-with-cpp -undef \
> >                       -D__ASSEMBLY__ \
> >                       -D__UBOOT_CONFIG__ \
> > +                     -DDEFAULT_DEVICE_TREE=$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE)) \
> >                       -I . -I include -I $(srctree)/include \
> >                       -include linux/kconfig.h -include include/config.h \
> >                       -I$(srctree)/arch/$(ARCH)/include \
> > diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst
> > index cc33d3ec0f2..eaebf61742a 100644
> > --- a/doc/usage/environment.rst
> > +++ b/doc/usage/environment.rst
> > @@ -87,6 +87,18 @@ settings. For example::
> >
> >      #include <env/ti/mmc.env>
> >
> > +Quotes are not supressed, for example::
>
> s/supressed/suppressed/
>
> > +
> > +    fdtfile=CONFIG_DEFAULT_DEVICE_TREE.dtb
> > +    # produces: fdtfile="sun7i-a20-pcduino3.dtb"
> > +
>
> Is this not rather
> fdtfile="sun7i-a20-pcduino3".dtb
> ? (i have no clue but I've this gut feeling this doesn't match what the
> subst command does above and why the .dtb extension would be inside the
> quotes)

No, I promise! The quote get removed by the Makefile rule so the -D
compiler option uses an unquoted string

>
> > +For this particular issue you can use DEFAULT_DEVICE_TREE instead::
>
> Maybe use double tickquotes to highlight this is a variable? i.e.
>
> ``DEFAULT_DEVICE_TREE``
>
> ?

Will do.

Regards,
Simon
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 9a52cc8d0b4..2452a916244 100644
--- a/Makefile
+++ b/Makefile
@@ -1844,6 +1844,7 @@  quiet_cmd_gen_envp = ENVP    $@
 		$(CPP) -P $(cpp_flags) -x assembler-with-cpp -undef \
 			-D__ASSEMBLY__ \
 			-D__UBOOT_CONFIG__ \
+			-DDEFAULT_DEVICE_TREE=$(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE)) \
 			-I . -I include -I $(srctree)/include \
 			-include linux/kconfig.h -include include/config.h \
 			-I$(srctree)/arch/$(ARCH)/include \
diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst
index cc33d3ec0f2..eaebf61742a 100644
--- a/doc/usage/environment.rst
+++ b/doc/usage/environment.rst
@@ -87,6 +87,18 @@  settings. For example::
 
    #include <env/ti/mmc.env>
 
+Quotes are not supressed, for example::
+
+    fdtfile=CONFIG_DEFAULT_DEVICE_TREE.dtb
+    # produces: fdtfile="sun7i-a20-pcduino3.dtb"
+
+For this particular issue you can use DEFAULT_DEVICE_TREE instead::
+
+    fdtfile=DEFAULT_DEVICE_TREE.dtb
+    # produces: fdtfile=sun7i-a20-pcduino3.dtb
+
+There is no general way to remove quotes.
+
 If CONFIG_ENV_SOURCE_FILE is empty and the default filename is not present, then
 the old-style C environment is used instead. See below.