All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 01/34] Add target to generate initial environment
@ 2019-03-13  8:46 Stefano Babic
  2019-03-13  9:31 ` Alex Kiernan
  2019-04-24 13:23 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Stefano Babic @ 2019-03-13  8:46 UTC (permalink / raw)
  To: u-boot

The initial environment is linked to the u-boot binary. Modifying the
environment from User Space with the env tools requires that the tools
are always built together with the bootloader to be sure that they
contain the initial environment in case no environment is stored into
persistent storage or when a board boots with just the default
environment. This makes difficult for distros to provide a general
package to access the environment. A simpler way is if the tools are
generic for all boards and a configuration file is given to provide the
initial environment.

The patch just generates the initial environment by extracting it from
the compiled object. This file can then be used for tools in user space
to initialize the environment.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Makefile b/Makefile
index 26db4e7b59..74e48ae9dc 100644
--- a/Makefile
+++ b/Makefile
@@ -1932,6 +1932,13 @@ endif
 	$(build)=$(build-dir) $(@:.ko=.o)
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
+quiet_cmd_genenv = GENENV $@
+cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
+	sed --in-place -e 's/\x00/\x0A/g' $@
+
+u-boot-initial-env: u-boot.bin
+	$(call if_changed,genenv)
+
 # Consistency checks
 # ---------------------------------------------------------------------------
 
-- 
2.17.1

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

* [U-Boot] [PATCH 01/34] Add target to generate initial environment
  2019-03-13  8:46 [U-Boot] [PATCH 01/34] Add target to generate initial environment Stefano Babic
@ 2019-03-13  9:31 ` Alex Kiernan
  2019-03-13 10:28   ` Stefano Babic
  2019-04-24 13:23 ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Kiernan @ 2019-03-13  9:31 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 13, 2019 at 8:47 AM Stefano Babic <sbabic@denx.de> wrote:
>
> The initial environment is linked to the u-boot binary. Modifying the
> environment from User Space with the env tools requires that the tools
> are always built together with the bootloader to be sure that they
> contain the initial environment in case no environment is stored into
> persistent storage or when a board boots with just the default
> environment. This makes difficult for distros to provide a general
> package to access the environment. A simpler way is if the tools are
> generic for all boards and a configuration file is given to provide the
> initial environment.
>
> The patch just generates the initial environment by extracting it from
> the compiled object. This file can then be used for tools in user space
> to initialize the environment.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> ---
>  Makefile | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 26db4e7b59..74e48ae9dc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1932,6 +1932,13 @@ endif
>         $(build)=$(build-dir) $(@:.ko=.o)
>         $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
>
> +quiet_cmd_genenv = GENENV $@
> +cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
> +       sed --in-place -e 's/\x00/\x0A/g' $@
> +

Really an observation rather than an objection - there are boards
which have newlines embedded in their compiled in environments -
ge_bx50v3 and mx53ppd (the failbootcmd variable) are the two I know
of.


> +u-boot-initial-env: u-boot.bin
> +       $(call if_changed,genenv)
> +
>  # Consistency checks
>  # ---------------------------------------------------------------------------
>
> --
> 2.17.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



--
Alex Kiernan

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

* [U-Boot] [PATCH 01/34] Add target to generate initial environment
  2019-03-13  9:31 ` Alex Kiernan
@ 2019-03-13 10:28   ` Stefano Babic
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2019-03-13 10:28 UTC (permalink / raw)
  To: u-boot

Hi Alex,

On 13/03/19 10:31, Alex Kiernan wrote:
> On Wed, Mar 13, 2019 at 8:47 AM Stefano Babic <sbabic@denx.de> wrote:
>>
>> The initial environment is linked to the u-boot binary. Modifying the
>> environment from User Space with the env tools requires that the tools
>> are always built together with the bootloader to be sure that they
>> contain the initial environment in case no environment is stored into
>> persistent storage or when a board boots with just the default
>> environment. This makes difficult for distros to provide a general
>> package to access the environment. A simpler way is if the tools are
>> generic for all boards and a configuration file is given to provide the
>> initial environment.
>>
>> The patch just generates the initial environment by extracting it from
>> the compiled object. This file can then be used for tools in user space
>> to initialize the environment.
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> ---
>>  Makefile | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/Makefile b/Makefile
>> index 26db4e7b59..74e48ae9dc 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -1932,6 +1932,13 @@ endif
>>         $(build)=$(build-dir) $(@:.ko=.o)
>>         $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
>>
>> +quiet_cmd_genenv = GENENV $@
>> +cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
>> +       sed --in-place -e 's/\x00/\x0A/g' $@
>> +
> 
> Really an observation rather than an objection - there are boards
> which have newlines embedded in their compiled in environments -
> ge_bx50v3 and mx53ppd (the failbootcmd variable) are the two I know
> of.

Right - but I guess that this could be better handled by external
scripts else here in U-Boot. The target simply dumps the compiled in
environment to be available t oexternal tools. For your use cases, it is
required a more sophisticated logic that checks for newlines if they are
surrounded by ".

Regards,
Stefano

> 
> 
>> +u-boot-initial-env: u-boot.bin
>> +       $(call if_changed,genenv)
>> +
>>  # Consistency checks
>>  # ---------------------------------------------------------------------------
>>
>> --
>> 2.17.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
> 
> 
> 
> --
> Alex Kiernan
> 


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [U-Boot] [U-Boot, 01/34] Add target to generate initial environment
  2019-03-13  8:46 [U-Boot] [PATCH 01/34] Add target to generate initial environment Stefano Babic
  2019-03-13  9:31 ` Alex Kiernan
@ 2019-04-24 13:23 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2019-04-24 13:23 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 13, 2019 at 09:46:45AM +0100, Stefano Babic wrote:

> The initial environment is linked to the u-boot binary. Modifying the
> environment from User Space with the env tools requires that the tools
> are always built together with the bootloader to be sure that they
> contain the initial environment in case no environment is stored into
> persistent storage or when a board boots with just the default
> environment. This makes difficult for distros to provide a general
> package to access the environment. A simpler way is if the tools are
> generic for all boards and a configuration file is given to provide the
> initial environment.
> 
> The patch just generates the initial environment by extracting it from
> the compiled object. This file can then be used for tools in user space
> to initialize the environment.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/ef8b92c8/attachment.sig>

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

end of thread, other threads:[~2019-04-24 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13  8:46 [U-Boot] [PATCH 01/34] Add target to generate initial environment Stefano Babic
2019-03-13  9:31 ` Alex Kiernan
2019-03-13 10:28   ` Stefano Babic
2019-04-24 13:23 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.