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

Simon Glass <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <CAFLszThWHSB3dnXYTvuSTwcTO0r4ja4hd8KuVgy-gKxb8ctw_A@mail.gmail.com>
Hi Jacky,

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.
>
> 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?

> [...]
>
> include/env.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/include/env.h b/include/env.h
> @@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.