[U-Boot] [PATCH 0/4] env: fix build error for envtools

Here is a set of patches that fixes envtools breakage introduced after v2019.10-rc2.
This serie also adds envtools to travis CI and gitlab-ci.
This was tested on WaRP7.
Before this serie: - https://travis-ci.com/texierp/u-boot/jobs/227669967 After this serie: - https://travis-ci.com/texierp/u-boot/jobs/227761236
Pierre-Jean Texier (4): fw_env: remove duplicated definitions fw_env: fix build error env: add missing <compiler.h> header file ci: add envtools support
.gitlab-ci.yml | 7 +++++++ .travis.yml | 4 ++++ include/env.h | 1 + tools/env/fw_env.c | 9 +-------- 4 files changed, 13 insertions(+), 8 deletions(-)

Since commit d3716dd ("env: Rename the redundancy flags"), the definitions of ENV_REDUND_OBSOLETE & ENV_REDUND_ACTIVE was moved to env.h.
Fixes:
tools/env/fw_env.c:122:22: error: ‘ENV_REDUND_ACTIVE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_ACTIVE = 1; ^~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:63:2: note: previous definition of ‘ENV_REDUND_ACTIVE’ was here ENV_REDUND_ACTIVE = 1, ^~~~~~~~~~~~~~~~~ tools/env/fw_env.c:127:22: error: ‘ENV_REDUND_OBSOLETE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_OBSOLETE; ^~~~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:62:2: note: previous definition of ‘ENV_REDUND_OBSOLETE’ was here ENV_REDUND_OBSOLETE = 0,
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io --- tools/env/fw_env.c | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 95c9984..876bf2b 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -119,13 +119,6 @@ static struct environment environment = {
static int have_redund_env;
-static unsigned char ENV_REDUND_ACTIVE = 1; -/* - * ENV_REDUND_OBSOLETE must be 0 to efficiently set it on NOR flash without - * erasing - */ -static unsigned char ENV_REDUND_OBSOLETE; - #define DEFAULT_ENV_INSTANCE_STATIC #include <env_default.h>

Hi Pierre-Jean
It's work on my side.
Tested-by Joris Offouga offougajoris@gmail.com
Best Regards, Joris Offouga
Le ven. 23 août 2019 à 23:04, Pierre-Jean Texier pjtexier@koncepto.io a écrit :
Since commit d3716dd ("env: Rename the redundancy flags"), the definitions of ENV_REDUND_OBSOLETE & ENV_REDUND_ACTIVE was moved to env.h.
Fixes:
tools/env/fw_env.c:122:22: error: ‘ENV_REDUND_ACTIVE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_ACTIVE = 1; ^~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:63:2: note: previous definition of ‘ENV_REDUND_ACTIVE’ was here ENV_REDUND_ACTIVE = 1, ^~~~~~~~~~~~~~~~~ tools/env/fw_env.c:127:22: error: ‘ENV_REDUND_OBSOLETE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_OBSOLETE; ^~~~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:62:2: note: previous definition of ‘ENV_REDUND_OBSOLETE’ was here ENV_REDUND_OBSOLETE = 0,
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io
tools/env/fw_env.c | 7 ------- 1 file changed, 7 deletions(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 95c9984..876bf2b 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -119,13 +119,6 @@ static struct environment environment = {
static int have_redund_env;
-static unsigned char ENV_REDUND_ACTIVE = 1; -/*
- ENV_REDUND_OBSOLETE must be 0 to efficiently set it on NOR flash
without
- erasing
- */
-static unsigned char ENV_REDUND_OBSOLETE;
#define DEFAULT_ENV_INSTANCE_STATIC #include <env_default.h>
-- 2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hello Pierre-Jean,
Am 23.08.2019 um 23:03 schrieb Pierre-Jean Texier:
Since commit d3716dd ("env: Rename the redundancy flags"), the definitions of ENV_REDUND_OBSOLETE & ENV_REDUND_ACTIVE was moved to env.h.
Fixes:
tools/env/fw_env.c:122:22: error: ‘ENV_REDUND_ACTIVE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_ACTIVE = 1; ^~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:63:2: note: previous definition of ‘ENV_REDUND_ACTIVE’ was here ENV_REDUND_ACTIVE = 1, ^~~~~~~~~~~~~~~~~ tools/env/fw_env.c:127:22: error: ‘ENV_REDUND_OBSOLETE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_OBSOLETE; ^~~~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:62:2: note: previous definition of ‘ENV_REDUND_OBSOLETE’ was here ENV_REDUND_OBSOLETE = 0,
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io
tools/env/fw_env.c | 7 ------- 1 file changed, 7 deletions(-)
See the same problem, thanks for the Fix!
Tested-by: Heiko Schocher hs@denx.de
bye, Heiko

On Fri, Aug 23, 2019 at 4:04 PM Pierre-Jean Texier pjtexier@koncepto.io wrote:
Since commit d3716dd ("env: Rename the redundancy flags"), the definitions of ENV_REDUND_OBSOLETE & ENV_REDUND_ACTIVE was moved to env.h.
Fixes:
tools/env/fw_env.c:122:22: error: ‘ENV_REDUND_ACTIVE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_ACTIVE = 1; ^~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:63:2: note: previous definition of ‘ENV_REDUND_ACTIVE’ was here ENV_REDUND_ACTIVE = 1, ^~~~~~~~~~~~~~~~~ tools/env/fw_env.c:127:22: error: ‘ENV_REDUND_OBSOLETE’ redeclared as different kind of symbol static unsigned char ENV_REDUND_OBSOLETE; ^~~~~~~~~~~~~~~~~~~ In file included from tools/env/fw_env.c:13: include/env.h:62:2: note: previous definition of ‘ENV_REDUND_OBSOLETE’ was here ENV_REDUND_OBSOLETE = 0,
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io
Acked-by: Joe Hershberger joe.hershberger@ni.com

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@koncepto.io --- tools/env/fw_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 876bf2b..b8b936f 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1146,7 +1146,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, ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE)); ioctl(fd, MEMLOCK, &erase); if (rc < 0) perror("Could not set obsolete flag");

Hi Pierre-Jean
It's work on my side.
Tested-by Joris Offouga offougajoris@gmail.com
Best Regards, Joris Offouga
Le ven. 23 août 2019 à 23:04, Pierre-Jean Texier pjtexier@koncepto.io a écrit :
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@koncepto.io
tools/env/fw_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 876bf2b..b8b936f 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1146,7 +1146,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, ENV_REDUND_OBSOLETE, sizeof(ENV_REDUND_OBSOLETE)); ioctl(fd, MEMLOCK, &erase); if (rc < 0) perror("Could not set obsolete flag");
-- 2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

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@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@denx.de
bye, Heiko

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@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@denx.de
Testing deeper on an imx6 based board with Environment in SPI NOR, and I see:
root@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@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@xmglap:u-boot [k30rf] $
May you can try?
bye, Heiko

Hello Heiko,
Le 26/08/2019 à 10:59, Heiko Schocher a écrit :
Testing deeper on an imx6 based board with Environment in SPI NOR, and I see:
root@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@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@xmglap:u-boot [k30rf] $
May you can try?
It works fine.
Thanks for testing ! I will send a v2 with your suggestion.
BR Pierre-Jean

Since commit af95f20 ("env: Create a new file for environment functions"), a new header file exists.
So, this commit add a missing header file.
Fixes:
include/env.h:158:1: error: unknown type name ‘ulong’; did you mean ‘long’? ulong env_get_ulong(const char *name, int base, ulong default_val); ^~~~~ long include/env.h:158:49: error: unknown type name ‘ulong’; did you mean ‘long’? ulong env_get_ulong(const char *name, int base, ulong default_val);
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io --- include/env.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/env.h b/include/env.h index a74a261..b72239f 100644 --- a/include/env.h +++ b/include/env.h @@ -9,6 +9,7 @@ #ifndef __ENV_H #define __ENV_H
+#include <compiler.h> #include <stdbool.h> #include <linux/types.h>

Hi Pierre-Jean
It's work on my side.
Tested-by Joris Offouga offougajoris@gmail.com
Best Regards, Joris Offouga
Le ven. 23 août 2019 à 23:05, Pierre-Jean Texier pjtexier@koncepto.io a écrit :
Since commit af95f20 ("env: Create a new file for environment functions"), a new header file exists.
So, this commit add a missing header file.
Fixes:
include/env.h:158:1: error: unknown type name ‘ulong’; did you mean ‘long’? ulong env_get_ulong(const char *name, int base, ulong default_val); ^~~~~ long include/env.h:158:49: error: unknown type name ‘ulong’; did you mean ‘long’? ulong env_get_ulong(const char *name, int base, ulong default_val);
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io
include/env.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/env.h b/include/env.h index a74a261..b72239f 100644 --- a/include/env.h +++ b/include/env.h @@ -9,6 +9,7 @@ #ifndef __ENV_H #define __ENV_H
+#include <compiler.h> #include <stdbool.h> #include <linux/types.h>
-- 2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hello Pierre-Jean,
Am 23.08.2019 um 23:03 schrieb Pierre-Jean Texier:
Since commit af95f20 ("env: Create a new file for environment functions"), a new header file exists.
So, this commit add a missing header file.
Fixes:
include/env.h:158:1: error: unknown type name ‘ulong’; did you mean ‘long’? ulong env_get_ulong(const char *name, int base, ulong default_val); ^~~~~ long include/env.h:158:49: error: unknown type name ‘ulong’; did you mean ‘long’? ulong env_get_ulong(const char *name, int base, ulong default_val);
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io
include/env.h | 1 + 1 file changed, 1 insertion(+)
See the same problem, thanks for the Fix!
Tested-by: Heiko Schocher hs@denx.de
bye, Heiko

This commit add envtools suppport to CI to verify if there is no build issues.
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io --- .gitlab-ci.yml | 7 +++++++ .travis.yml | 4 ++++ 2 files changed, 11 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 84e79bf..a1c5b4f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -145,6 +145,13 @@ Build tools-only: script: - make tools-only_config tools-only -j$(nproc)
+# Ensure env tools build +Build envtools: + tags: [ 'all' ] + stage: testsuites + script: + - make tools-only_config envtools -j$(nproc) + Run binman, buildman, dtoc and patman testsuites: tags: [ 'all' ] stage: testsuites diff --git a/.travis.yml b/.travis.yml index d330dda..6adc754 100644 --- a/.travis.yml +++ b/.travis.yml @@ -361,6 +361,10 @@ matrix: - name: "Build tools-only" script: - make tools-only_config tools-only -j$(nproc) + # Ensure env tools build + - name: "Build envtools" + script: + - make tools-only_config envtools -j$(nproc)
# test/py - name: "test/py sandbox"

Hello Pierre-Jean,
Am 23.08.2019 um 23:03 schrieb Pierre-Jean Texier:
This commit add envtools suppport to CI to verify if there is no build issues.
Signed-off-by: Pierre-Jean Texier pjtexier@koncepto.io
.gitlab-ci.yml | 7 +++++++ .travis.yml | 4 ++++ 2 files changed, 11 insertions(+)
Thanks!
Acked-by: Heiko Schocher hs@denx.de
bye, Heiko
participants (4)
-
Heiko Schocher
-
Joe Hershberger
-
Joris OFFOUGA
-
Pierre-Jean Texier