diff mbox

[U-Boot] fw_env.h: include autoconf.h

Message ID 7c8f1b7e3881f278cd42e3ab43c0d6e269df5d21.1429027426.git.marcel.ziswiler@toradex.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Marcel Ziswiler April 14, 2015, 7:50 p.m. UTC
From: Max Krummenacher <max.krummenacher@toradex.com>

Without this, when CONFIG_ENV_VARS_UBOOT_CONFIG is active we get
a compile time error when doing 'make env'.
In file included from tools/env/fw_env.c:117:0:
include/env_default.h:110:11: error: expected ‘}’ before ‘CONFIG_SYS_ARCH’

When building U-Boot this is included indirectly by the compiler switch
-include
/home/trdx/git.toradex.com/u-boot-2014.10-toradex/include/linux/kconfig.h

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
---
This is an issue on all tegra boards due CONFIG_ENV_VARS_UBOOT_CONFIG
being defined in the tegra-common.h header file.

I already did reported this once last November but did not get any
useful insights back then:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/200702

 tools/env/fw_env.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Tom Rini April 16, 2015, 5:20 p.m. UTC | #1
On Tue, Apr 14, 2015 at 09:50:47PM +0200, Marcel Ziswiler wrote:

> From: Max Krummenacher <max.krummenacher@toradex.com>
> 
> Without this, when CONFIG_ENV_VARS_UBOOT_CONFIG is active we get
> a compile time error when doing 'make env'.
> In file included from tools/env/fw_env.c:117:0:
> include/env_default.h:110:11: error: expected ‘}’ before ‘CONFIG_SYS_ARCH’
> 
> When building U-Boot this is included indirectly by the compiler switch
> -include
> /home/trdx/git.toradex.com/u-boot-2014.10-toradex/include/linux/kconfig.h
> 
> Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> ---
> This is an issue on all tegra boards due CONFIG_ENV_VARS_UBOOT_CONFIG
> being defined in the tegra-common.h header file.
> 
> I already did reported this once last November but did not get any
> useful insights back then:

Ug.  I'm cc'ing a few distro people since this makes it further clear
that by whatever name a distro packages fw_setenv/fw_getenv these are
really machine (to the extent U-Boot is built) specific applications due
to the need to include a copy of the default environment so that we
can support making sure that variables that aren't supposed to be
overwritten are not overwritten (see the fw_getdefenv call in
tools/env/fw_env.c::fw_env_write).

I'll let Masahiro comment on if this is the best way to fix the compile
problem.
Marcel Ziswiler May 5, 2015, 12:19 p.m. UTC | #2
On Thu, 2015-04-16 at 13:20 -0400, Tom Rini wrote:
> I'll let Masahiro comment on if this is the best way to fix the compile
> problem.

What's the status on this one?
Tom Rini May 5, 2015, 11:59 p.m. UTC | #3
On Tue, Apr 14, 2015 at 09:50:47PM +0200, Marcel Ziswiler wrote:

> From: Max Krummenacher <max.krummenacher@toradex.com>
> 
> Without this, when CONFIG_ENV_VARS_UBOOT_CONFIG is active we get
> a compile time error when doing 'make env'.
> In file included from tools/env/fw_env.c:117:0:
> include/env_default.h:110:11: error: expected ‘}’ before ‘CONFIG_SYS_ARCH’
> 
> When building U-Boot this is included indirectly by the compiler switch
> -include
> /home/trdx/git.toradex.com/u-boot-2014.10-toradex/include/linux/kconfig.h
> 
> Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

Applied to u-boot/master, thanks!
Masahiro Yamada May 7, 2015, 3:03 a.m. UTC | #4
Hi Tom, Marcel,

Sorry for my late reply.  I missed this message.



2015-04-17 2:20 GMT+09:00 Tom Rini <trini@konsulko.com>:
> On Tue, Apr 14, 2015 at 09:50:47PM +0200, Marcel Ziswiler wrote:
>
>> From: Max Krummenacher <max.krummenacher@toradex.com>
>>
>> Without this, when CONFIG_ENV_VARS_UBOOT_CONFIG is active we get
>> a compile time error when doing 'make env'.
>> In file included from tools/env/fw_env.c:117:0:
>> include/env_default.h:110:11: error: expected ‘}’ before ‘CONFIG_SYS_ARCH’
>>
>> When building U-Boot this is included indirectly by the compiler switch
>> -include
>> /home/trdx/git.toradex.com/u-boot-2014.10-toradex/include/linux/kconfig.h
>>
>> Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
>> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>> ---
>> This is an issue on all tegra boards due CONFIG_ENV_VARS_UBOOT_CONFIG
>> being defined in the tegra-common.h header file.
>>
>> I already did reported this once last November but did not get any
>> useful insights back then:

I've just recalled this issue.
In fact, it was reported by another person and I posted a patch last November
(but it's been dismissed long and I also finally forgot about it...)

http://patchwork.ozlabs.org/patch/417192/



> Ug.  I'm cc'ing a few distro people since this makes it further clear
> that by whatever name a distro packages fw_setenv/fw_getenv these are
> really machine (to the extent U-Boot is built) specific applications due
> to the need to include a copy of the default environment so that we
> can support making sure that variables that aren't supposed to be
> overwritten are not overwritten (see the fw_getdefenv call in
> tools/env/fw_env.c::fw_env_write).
>
> I'll let Masahiro comment on if this is the best way to fix the compile
> problem.

I do not like host applications to include such machine-specific stuff.
Maybe, we should rewrite this tool as
a generic host-program + a separate machine environment file.

Anyway, we should have not left a build error long, so thanks for fixing it!
diff mbox

Patch

diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index aff471b..d6faf34 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -13,6 +13,7 @@ 
 #else
 #include <config.h>
 #endif
+#include <generated/autoconf.h>
 
 /*
  * To build the utility with the static configuration