[libubootenv,v2] fw_printenv: set 'u-boot-initial-env' file as default
diff mbox series

Message ID 1556824180-12894-1-git-send-email-pjtexier@koncepto.io
State Changes Requested
Headers show
Series
  • [libubootenv,v2] fw_printenv: set 'u-boot-initial-env' file as default
Related show

Commit Message

'Pierre-Jean Texier' via swupdate May 2, 2019, 7:09 p.m. UTC
Since commit [1] in U-Boot, this is the file with the initial environment
delivered with the bootloader.
So, let's set this name as default.

ted with buildroot as follows:

1) # fw_printenv
Cannot read environment, using default
baudrate=115200
...

2) # fw_setenv foo bar
Cannot read environment, using default

3) # fw_printenv foo
foo=bar

[1] https://github.com/u-boot/u-boot/commit/bdaa73a5b3923257add182b4ab8058dbfa33421b#diff-b67911656ef5d18c4ae36cb6741b7965

Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
---
Changes v1 -> v2:
	- fix commit log
	
 src/fw_printenv.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Diego Rondini May 3, 2019, 10:14 a.m. UTC | #1
Hi Pierre-Jean,

On Thu, May 2, 2019 at 9:10 PM 'Pierre-Jean Texier' via swupdate
<swupdate@googlegroups.com> wrote:
>
> Since commit [1] in U-Boot, this is the file with the initial environment
> delivered with the bootloader.
> So, let's set this name as default.
>
> ted with buildroot as follows:

now fix the fixed commit log :-)

>
> 1) # fw_printenv
> Cannot read environment, using default
> baudrate=115200
> ...
>
> 2) # fw_setenv foo bar
> Cannot read environment, using default
>
> 3) # fw_printenv foo
> foo=bar
>
> [1] https://github.com/u-boot/u-boot/commit/bdaa73a5b3923257add182b4ab8058dbfa33421b#diff-b67911656ef5d18c4ae36cb6741b7965
>
> Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
> ---
> Changes v1 -> v2:
>         - fix commit log
>
>  src/fw_printenv.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/fw_printenv.c b/src/fw_printenv.c
> index 361d150..5f75db7 100644
> --- a/src/fw_printenv.c
> +++ b/src/fw_printenv.c
> @@ -121,6 +121,9 @@ int main (int argc, char **argv) {
>                 exit (ret);
>         }
>
> +       if (!defenvfile)
> +               defenvfile = "/etc/u-boot-initial-env";
> +
>         if ((ret = libuboot_open(ctx)) < 0) {
>                 fprintf(stderr, "Cannot read environment, using default\n");
>                 if ((ret = libuboot_load_file(ctx, defenvfile)) < 0) {
> --
> 2.7.4
>
'Pierre-Jean Texier' via swupdate May 3, 2019, 10:53 a.m. UTC | #2
Hi Diego,

Le 03/05/2019 à 12:14, Diego Rondini a écrit :
> Hi Pierre-Jean,
>
> On Thu, May 2, 2019 at 9:10 PM 'Pierre-Jean Texier' via swupdate
> <swupdate@googlegroups.com> wrote:
>> Since commit [1] in U-Boot, this is the file with the initial environment
>> delivered with the bootloader.
>> So, let's set this name as default.
>>
>> ted with buildroot as follows:
> now fix the fixed commit log :-)


:(, thanks, fixed in v3


Pierre-Jean

>
>> 1) # fw_printenv
>> Cannot read environment, using default
>> baudrate=115200
>> ...
>>
>> 2) # fw_setenv foo bar
>> Cannot read environment, using default
>>
>> 3) # fw_printenv foo
>> foo=bar
>>
>> [1] https://github.com/u-boot/u-boot/commit/bdaa73a5b3923257add182b4ab8058dbfa33421b#diff-b67911656ef5d18c4ae36cb6741b7965
>>
>> Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
>> ---
>> Changes v1 -> v2:
>>          - fix commit log
>>
>>   src/fw_printenv.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/src/fw_printenv.c b/src/fw_printenv.c
>> index 361d150..5f75db7 100644
>> --- a/src/fw_printenv.c
>> +++ b/src/fw_printenv.c
>> @@ -121,6 +121,9 @@ int main (int argc, char **argv) {
>>                  exit (ret);
>>          }
>>
>> +       if (!defenvfile)
>> +               defenvfile = "/etc/u-boot-initial-env";
>> +
>>          if ((ret = libuboot_open(ctx)) < 0) {
>>                  fprintf(stderr, "Cannot read environment, using default\n");
>>                  if ((ret = libuboot_load_file(ctx, defenvfile)) < 0) {
>> --
>> 2.7.4
>>
>
>
>

Patch
diff mbox series

diff --git a/src/fw_printenv.c b/src/fw_printenv.c
index 361d150..5f75db7 100644
--- a/src/fw_printenv.c
+++ b/src/fw_printenv.c
@@ -121,6 +121,9 @@  int main (int argc, char **argv) {
 		exit (ret);
 	}
 
+	if (!defenvfile)
+		defenvfile = "/etc/u-boot-initial-env";
+
 	if ((ret = libuboot_open(ctx)) < 0) {
 		fprintf(stderr, "Cannot read environment, using default\n");
 		if ((ret = libuboot_load_file(ctx, defenvfile)) < 0) {