Skip to contentSkip to conversation

env: Fix compile error for envtools

PATCH In review Jacky Cao 5 participants 10 messages Jul 13 – Aug 25 1 message not in the archive

lore
Share & tools
lore

Jacky Cao

author
#0 lore raw

PATCH 1/1 env: Fix compile error for envtools

Following error happens when build envtools for mx6qsabrelite.

$ make tools envtools
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/printinitialenv
  GENENV  u-boot-initial-env
  COPY    tools/version.h
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
In file included from ./arch/arm/include/asm/mach-imx/regs-lcdif.h:16,
                 from ./arch/arm/include/asm/arch/imx-regs.h:371,
                 from include/configs/mx6_common.h:21,
                 from include/configs/nitrogen6x.h:13,
                 from include/config.h:3,
                 from include/env.h:12,
                 from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
./arch/arm/include/asm/mach-imx/regs-common.h:51:9: error: unknown type name 'uint8_t'
   51 |         __mxs_reg_8(reg)
      |         ^~~~~~~~~~~

uint8_t type is defined in linux/types.h header file. The config.h includes regs-common.h that uses uint8_t type, to fix this, include config.h after linux/types.h in env.h file.

Fixes 9f1807e57cbb ("env: add env_set_runtime() helper")
---
 include/env.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/env.h +1 -1
index 9b872fb26eb..dcd017fa5e6 100644
@@ -9,10 +9,10 @@
 #ifndef __ENV_H
 #define __ENV_H
 
-#include <config.h>
 #include <compiler.h>
 #include <stdbool.h>
 #include <linux/types.h>
+#include <config.h>
 
 struct environment_s;
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 15 lines

Subject: [PATCH v1] env: Fix compile error for envtools

Following error happens when build envtools for mx6qsabrelite.

$ make tools envtools
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/printinitialenv
  GENENV  u-boot-initial-env
  COPY    tools/version.h
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
In file included from ./arch/arm/include/asm/mach-imx/regs-lcdif.h:16,
                 from ./arch/arm/include/asm/arch/imx-regs.h:371,
Quoted 8 lines
                 from include/configs/mx6_common.h:21,
                 from include/configs/nitrogen6x.h:13,
                 from include/config.h:3,
                 from include/env.h:12,
                 from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
./arch/arm/include/asm/mach-imx/regs-common.h:51:9: error:
unknown type name 'uint8_t'

"#include <linux/types.h>" was already in
arch/arm/include/asm/mach-imx/regs-common.h

Are u using an old tree?

Regards
Peng.

Quoted 32 lines
   51 |         __mxs_reg_8(reg)
      |         ^~~~~~~~~~~

uint8_t type is defined in linux/types.h header file.
The config.h includes regs-common.h that uses uint8_t type, to fix this, include config.h after linux/types.h in env.h file.

Fixes 9f1807e57cbb ("env: add env_set_runtime() helper")
---
 include/env.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/env.h index renamed from include/env.h +0 -0

9b872fb26eb..dcd017fa5e6 100644

include/env.h +1 -2
@@ -9,10 +9,10 @@
 #ifndef __ENV_H
 #define __ENV_H
 
-#include <config.h>
 #include <compiler.h>
 #include <stdbool.h>
 #include <linux/types.h>
+#include <config.h>
 
 struct environment_s;
 
--

2.34.1

#2 lore raw
Quoted 22 lines
Quoted 13 lines

Following error happens when build envtools for mx6qsabrelite.

$ make tools envtools
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/printinitialenv
  GENENV  u-boot-initial-env
  COPY    tools/version.h
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
In file included from ./arch/arm/include/asm/mach-imx/regs-lcdif.h:16,
                 from ./arch/arm/include/asm/arch/imx-regs.h:371,
Quoted 8 lines
                 from include/configs/mx6_common.h:21,
                 from include/configs/nitrogen6x.h:13,
                 from include/config.h:3,
                 from include/env.h:12,
                 from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
./arch/arm/include/asm/mach-imx/regs-common.h:51:9: error:
unknown type name 'uint8_t'
Quoted 4 lines

"#include <linux/types.h>" was already in
arch/arm/include/asm/mach-imx/regs-common.h

Are u using an old tree?

I use master branch of OSS u-boot repo and meet the issue with below commands:

make mx6qsabrelite_defconfig
make -j8
make tools envtools

#3 lore raw
Quoted 25 lines · On Tue, Jul 14, 2026 at 01:35:42AM +0000, [email protected] wrote:
Quoted 25 lines
Quoted 13 lines

Following error happens when build envtools for mx6qsabrelite.

$ make tools envtools
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/printinitialenv
  GENENV  u-boot-initial-env
  COPY    tools/version.h
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
In file included from ./arch/arm/include/asm/mach-imx/regs-lcdif.h:16,
                 from ./arch/arm/include/asm/arch/imx-regs.h:371,
Quoted 8 lines
                 from include/configs/mx6_common.h:21,
                 from include/configs/nitrogen6x.h:13,
                 from include/config.h:3,
                 from include/env.h:12,
                 from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
./arch/arm/include/asm/mach-imx/regs-common.h:51:9: error:
unknown type name 'uint8_t'

"#include <linux/types.h>" was already in
arch/arm/include/asm/mach-imx/regs-common.h

Quoted 8 lines
Quoted 1 line

Are u using an old tree?

I use master branch of OSS u-boot repo and meet the issue with below commands:

make mx6qsabrelite_defconfig
make -j8
make tools envtools

What host distribution are you building on? And, <config.h> *must* come first in the include list, for it to function correctly.

Signature · 1 line
Tom
#4 lore raw
Quoted 9 lines
Quoted 6 lines

I use master branch of OSS u-boot repo and meet the issue with below commands:

make mx6qsabrelite_defconfig
make -j8
make tools envtools

What host distribution are you building on? And, <config.h> *must* come first in the include list, for it to function correctly.

Host OS is Ubuntu 22.04.3 LTS.
Toolchain is Arm GNU Toolchain 11.3.Rel1(arm-none-linux-gnueabihf-). Also tried Ubuntu 24.04.4 LTS and Arm GNU Toolchain 15.3.Rel1, the issue still happens.

#5 lore raw
Quoted 7 lines · On Tue, Jul 14, 2026 at 03:04:42AM +0000, [email protected] wrote:
Quoted 7 lines
Quoted 6 lines

I use master branch of OSS u-boot repo and meet the issue with below commands:

make mx6qsabrelite_defconfig
make -j8
make tools envtools

Quoted 7 lines
Quoted 2 lines

What host distribution are you building on? And, <config.h> *must* come first in the include list, for it to function correctly.

Host OS is Ubuntu 22.04.3 LTS.
Toolchain is Arm GNU Toolchain 11.3.Rel1(arm-none-linux-gnueabihf-). Also tried Ubuntu 24.04.4 LTS and Arm GNU Toolchain 15.3.Rel1, the issue still happens.

So, are you on an ARM host too? You aren't specifying where you are / aren't using the ARM toolchain in the above. Thanks.

Signature · 1 line
Tom
#6 lore raw
Quoted 6 lines
Quoted 4 lines

Host OS is Ubuntu 22.04.3 LTS.
Toolchain is Arm GNU Toolchain 11.3.Rel1(arm-none-linux-gnueabihf-). Also tried Ubuntu 24.04.4 LTS and Arm GNU Toolchain 15.3.Rel1, the issue still happens.

So, are you on an ARM host too? You aren't specifying where you are / aren't using the ARM toolchain in the above. Thanks.

Sorry for not explaining it clearly.
Host machine is x86_64 Ubuntu 22.04.3 LTS.
Using arm-none-linux-gnueabihf-gcc 11.3.Rel1 as a cross compiler to build u-boot and envtools for imx6 target. I also tested on x86_64 Ubuntu 24.04.4 LTS with Arm GNU Toolchain 15.3.Rel1, and the issue still occurs.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Hello,

Quoted 21 lines · Rasmus Villemoes
Quoted 11 lines · Tom Rini
Quoted 10 lines · On Tue, Jul 14, 2026 at 03:04:42AM +0000, [email protected] wrote:
Quoted 9 lines
Quoted 6 lines

I use master branch of OSS u-boot repo and meet the issue with below commands:

make mx6qsabrelite_defconfig
make -j8
make tools envtools

What host distribution are you building on? And, <config.h> *must* come first in the include list, for it to function correctly.

Quoted 7 lines
Quoted 4 lines

Host OS is Ubuntu 22.04.3 LTS.
Toolchain is Arm GNU Toolchain 11.3.Rel1(arm-none-linux-gnueabihf-). Also tried Ubuntu 24.04.4 LTS and Arm GNU Toolchain 15.3.Rel1, the issue still happens.

So, are you on an ARM host too? You aren't specifying where you are / aren't using the ARM toolchain in the above. Thanks.

Quoted 8 lines

It doesn't matter what toolchain one uses. The mentioned commit does break "make envtools" for all our boards, building through Yocto. And when I build manually using my distro's cross-compiler, the same thing happens.

Note, it's not the board build itself that breaks, only the "make envtools", which I assume few people do these days.

i have seen this issue too and now build without a board specific config as a workaround:

make tools-only_defconfig
make envtools

Before the mentioned commit for the userspace tools relevant code config.h was never included but env.h is shared code as far as i can tell.

Regards,
Hendrik

Quoted 1 line

Rasmus

#9 lore raw
In reply to Jacky Cao

Hi Jacky,

Quoted 25 lines · On 2026-07-13T08:31:41, [email protected] <[email protected]> wrote:

env: Fix compile error for envtools

Following error happens when build envtools for mx6qsabrelite.

$ make tools envtools
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/printinitialenv
  GENENV  u-boot-initial-env
  COPY    tools/version.h
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
In file included from ./arch/arm/include/asm/mach-imx/regs-lcdif.h:16,
                 from ./arch/arm/include/asm/arch/imx-regs.h:371,
                 from include/configs/mx6_common.h:21,
                 from include/configs/nitrogen6x.h:13,
                 from include/config.h:3,
                 from include/env.h:12,
                 from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
./arch/arm/include/asm/mach-imx/regs-common.h:51:9: error: unknown type name 'uint8_t'
   51 |         __mxs_reg_8(reg)
      |         ^~~~~~~~~~~
Quoted 5 lines

uint8_t type is defined in linux/types.h header file. The config.h includes regs-common.h that uses uint8_t type, to fix this, include config.h after linux/types.h in env.h file.

Fixes 9f1807e57cbb ("env: add env_set_runtime() helper")

env.h only needs <config.h> so that IS_ENABLED() works inside the inline env_set_runtime() helper. A cleaner fix is to make env_set_runtime() a normal (non-inline) function declared in env.h and defined in env/common.c (or wherever env_set() lives). Then env.h no longer needs <config.h> and the tools build stops dragging board configs into the host-side compilation. What do you think?

Quoted 7 lines

[...]

include/env.h | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

include/env.h line 15

Quoted 8 lines
include/env.h +1 -1
@@ -9,10 +9,10 @@
 #ifndef __ENV_H
 #define __ENV_H
 
-#include <config.h>
 #include <compiler.h>
 #include <stdbool.h>
 #include <linux/types.h>
+#include <config.h>

As Tom mentioned, we really don't want to move config.h later - even though the files above it are probably unrelated in this case...

Regards,
Simon

#10 lore raw
Quoted 32 lines · Simon Glass

Hi Jacky,

Quoted 29 lines · On 2026-07-13T08:31:41, [email protected] <[email protected]> wrote:

env: Fix compile error for envtools

Following error happens when build envtools for mx6qsabrelite.

$ make tools envtools
  UPD     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/printinitialenv
  GENENV  u-boot-initial-env
  COPY    tools/version.h
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
In file included from ./arch/arm/include/asm/mach-imx/regs-lcdif.h:16,
                 from ./arch/arm/include/asm/arch/imx-regs.h:371,
                 from include/configs/mx6_common.h:21,
                 from include/configs/nitrogen6x.h:13,
                 from include/config.h:3,
                 from include/env.h:12,
                 from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
./arch/arm/include/asm/mach-imx/regs-common.h:51:9: error: unknown type name 'uint8_t'
   51 |         __mxs_reg_8(reg)
      |         ^~~~~~~~~~~

uint8_t type is defined in linux/types.h header file. The config.h includes regs-common.h that uses uint8_t type, to fix this, include config.h after linux/types.h in env.h file.

Quoted 8 lines
Quoted 1 line
Fixes 9f1807e57cbb ("env: add env_set_runtime() helper")

env.h only needs <config.h> so that IS_ENABLED() works inside the inline env_set_runtime() helper. A cleaner fix is to make env_set_runtime() a normal (non-inline) function declared in env.h and defined in env/common.c (or wherever env_set() lives). Then env.h no longer needs <config.h> and the tools build stops dragging board configs into the host-side compilation. What do you think?

Just using a normal #if/#else/#endif would be the better fix here.

Quoted 10 lines
Quoted 10 lines

[...]

include/env.h | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
include/env.h +0 -0
@@ -9,10 +9,10 @@
 #ifndef __ENV_H
 #define __ENV_H
 
Quoted 8 lines

include/env.h line 15

Quoted 5 lines
include/env.h +1 -1
-#include <config.h>
 #include <compiler.h>
 #include <stdbool.h>
 #include <linux/types.h>
+#include <config.h>

As Tom mentioned, we really don't want to move config.h later - even though the files above it are probably unrelated in this case...

It's not "don't want", it's "cannot". You cannot have it be anywhere other than the first line or you will introduce other obscure problems.

Signature · 1 line
Tom