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

Message ID 1556880669-25305-1-git-send-email-pjtexier@koncepto.io
State Accepted
Headers show
Series
  • [libubootenv,v3] fw_printenv: set 'u-boot-initial-env' file as default
Related show

Commit Message

'Pierre-Jean Texier' via swupdate May 3, 2019, 10:51 a.m. UTC
From: Pierre-Jean Texier' via swupdate <swupdate@googlegroups.com>

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.

tested 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
	
Changes v2 -> v3:
	- fix commit log :(
	
 src/fw_printenv.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Joris Offouga May 3, 2019, 11:25 a.m. UTC | #1
Tested-by: Joris Offouga <offougajoris@gmail.com>

Le 03/05/2019 à 12:51, 'Pierre-Jean Texier' via swupdate a écrit :
> From: Pierre-Jean Texier' via swupdate <swupdate@googlegroups.com>
>
> 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.
>
> tested 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
> 	
> Changes v2 -> v3:
> 	- 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) {
Stefano Babic May 17, 2019, 8:33 a.m. UTC | #2
On 03/05/19 12:51, 'Pierre-Jean Texier' via swupdate wrote:
> From: Pierre-Jean Texier' via swupdate <swupdate@googlegroups.com>
> 
> 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.
> 
> tested 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
> 	
> Changes v2 -> v3:
> 	- 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) {
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
'Pierre-Jean Texier' via swupdate May 17, 2019, 4:05 p.m. UTC | #3
Hi Stefano,

Le 17/05/2019 à 10:33, Stefano Babic a écrit :
> On 03/05/19 12:51, 'Pierre-Jean Texier' via swupdate wrote:
>> From: Pierre-Jean Texier' via swupdate <swupdate@googlegroups.com>
>>
>> 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.
>>
>> tested 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
>> 	
>> Changes v2 -> v3:
>> 	- 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) {
>>
> Applied to -master, thanks !

Thanks! but it seems that this one is not yet merged :(.
Also the same for "fw_printenv: remove declaration in for loop".

BR

Pierre-Jean

>
> Best regards,
> Stefano Babic
Stefano Babic May 17, 2019, 4:09 p.m. UTC | #4
On 17/05/19 18:05, 'Pierre-Jean Texier' via swupdate wrote:
> Hi Stefano,
> 
> Le 17/05/2019 à 10:33, Stefano Babic a écrit :
>> On 03/05/19 12:51, 'Pierre-Jean Texier' via swupdate wrote:
>>> From: Pierre-Jean Texier' via swupdate <swupdate@googlegroups.com>
>>>
>>> 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.
>>>
>>> tested 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
>>>     
>>> Changes v2 -> v3:
>>>     - 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) {
>>>
>> Applied to -master, thanks !
> 
> Thanks! but it seems that this one is not yet merged :(.
> Also the same for "fw_printenv: remove declaration in for loop".

It was merged but not pushed - you should see them on github now.

Best regards,
Stefano
'Pierre-Jean Texier' via swupdate May 17, 2019, 4:24 p.m. UTC | #5
Le 17/05/2019 à 18:09, Stefano Babic a écrit :
> On 17/05/19 18:05, 'Pierre-Jean Texier' via swupdate wrote:
>> Hi Stefano,
>>
>> Le 17/05/2019 à 10:33, Stefano Babic a écrit :
>>> On 03/05/19 12:51, 'Pierre-Jean Texier' via swupdate wrote:
>>>> From: Pierre-Jean Texier' via swupdate <swupdate@googlegroups.com>
>>>>
>>>> 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.
>>>>
>>>> tested 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
>>>>      
>>>> Changes v2 -> v3:
>>>>      - 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) {
>>>>
>>> Applied to -master, thanks !
>> Thanks! but it seems that this one is not yet merged :(.
>> Also the same for "fw_printenv: remove declaration in for loop".
> It was merged but not pushed - you should see them on github now.

Thanks ! :)

BR

Pierre-Jean
>
> Best regards,
> Stefano
>

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) {