[U-Boot] [PATCH 2/4] fw_env: fix build error

Heiko Schocher hs at denx.de
Mon Aug 26 08:59:20 UTC 2019


Hello Pierre-Jean,

Am 26.08.2019 um 08:57 schrieb Heiko Schocher:
> Hello Jean-Pierre,
> 
> Am 23.08.2019 um 23:03 schrieb Pierre-Jean Texier:
>> The following error appears:
>>
>> tools/env/fw_env.c:1149:25: error: lvalue required as unary ‘&’ operand
>>    rc = write(fd, &ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
>>
>> Fixes: d3716dd ("env: Rename the redundancy flags")
>>
>> Signed-off-by: Pierre-Jean Texier <pjtexier at koncepto.io>
>> ---
>>   tools/env/fw_env.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> See the same problem, thanks for the Fix!
> 
> Tested-by: Heiko Schocher <hs at denx.de>

Testing deeper on an imx6 based board with Environment in SPI NOR, and
I see:

root at K30RF-5e108e:~# fw_setenv ubifitsz
Could not set obsolete flag: Operation not supported

Also with your patch ... :-(

With follwoing change fw_setenv works again for me:

hs at xmglap:u-boot  [k30rf] $ git diff
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index b8b936f9ea..e2801f595f 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1135,6 +1135,7 @@ static int flash_flag_obsolete(int dev, int fd, off_t offset)
  {
         int rc;
         struct erase_info_user erase;
+       char tmp = ENV_REDUND_OBSOLETE;

         erase.start = DEVOFFSET(dev);
         erase.length = DEVESIZE(dev);
@@ -1146,7 +1147,7 @@ static int flash_flag_obsolete(int dev, int fd, off_t offset)
                 return rc;
         }
         ioctl(fd, MEMUNLOCK, &erase);
-       rc = write(fd, ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE));
+       rc = write(fd, &tmp, sizeof(tmp));
         ioctl(fd, MEMLOCK, &erase);
         if (rc < 0)
                 perror("Could not set obsolete flag");
hs at xmglap:u-boot  [k30rf] $

May you can try?

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


More information about the U-Boot mailing list