u-boot-brain/env
Rasmus Villemoes c82216803d env: another attempt at fixing SPL build failures
I'm also seeing the build failure that commit

7d4776545b env: solve compilation error in SPL

tried to fix, namely that the reference to env_flags_validate from
env_htab cannot be satisfied when flags.o is not built in. However,
that commit got reverted by

d90fc9c3de Revert "env: solve compilation error in SPL"

Necessary, but not sufficient conditions to see this are

CONFIG_SPL=y (obviously)
CONFIG_SPL_ENV_SUPPORT=n (so flags.o does not get compiled)
CONFIG_SPL_LIBCOMMON_SUPPORT=y (so env/built-in.o is part of the SPL link)

Now, these are satisfied for e.g. imx6q_logic_defconfig. But that
builds just fine, and spl/u-boot-spl.map lists .data.env_htab among
the discarded (garbage collected) sections. Yet, on our
mpc8309-derived board, we do see the build failure, so perhaps the
linker works a bit differently on ppc than on ARM, or there's yet some
other configuration option needed to observe the break.

This is another attempt at solving it, which also cleans up
env/Makefile a bit: Introduce a def_bool y symbol CONFIG_ENV_SUPPORT
which complements CONFIG_(SPL/TPL)_SUPPORT. Then use
CONFIG_$(SPL_TPL_)ENV_SUPPORT to decide whether to include the five
basic env/*.o files. For attr.o, flags.o and callback.o, this
shouldn't change anything. Also, common.o and env.o still get
unconditionally built for U-boot proper. But for TPL/SPL, those two
are only included if CONFIG_(SPL/TPL)_SUPPORT is set.

Having that symbol should also allow simplifying conditionals such as

#if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT)

found in drivers/reset/reset-socfpga.c to just
CONFIG_IS_ENABLED(ENV_SUPPORT).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2020-01-22 17:47:56 -05:00
..
Kconfig env: another attempt at fixing SPL build failures 2020-01-22 17:47:56 -05:00
Makefile env: another attempt at fixing SPL build failures 2020-01-22 17:47:56 -05:00
attr.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
callback.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
common.c common: Move sorting functions to their own header file 2019-12-02 18:23:08 -05:00
eeprom.c common: Move old EEPROM functions into a new header 2019-12-02 18:25:25 -05:00
embedded.c env: Finish migration of common ENV options 2019-11-20 18:32:09 -05:00
env.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
ext4.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
fat.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
flags.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
flash.c common: Move flash_perror() to flash.h 2020-01-17 13:26:48 -05:00
mmc.c env: Finish migration of common ENV options 2019-11-20 18:32:09 -05:00
nand.c crc32: Use the crc.h header for crc functions 2019-12-02 18:23:08 -05:00
nowhere.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
nvram.c crc32: Use the crc.h header for crc functions 2019-12-02 18:23:08 -05:00
onenand.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00
remote.c crc32: Use the crc.h header for crc functions 2019-12-02 18:23:08 -05:00
sata.c env: Remove useless CONFIG_ENV_SIZE_REDUND and fix ENV_IS_REDUND check 2019-11-20 18:31:24 -05:00
sf.c crc32: Use the crc.h header for crc functions 2019-12-02 18:23:08 -05:00
ubi.c env: Rename environment.h to env_internal.h 2019-08-11 19:27:31 -04:00