Commit 7d4776545b0f8a8827e5d061206faf61c9ba6ea9

Authored by Patrick Delaunay
Committed by Patrice Chotard
1 parent c3e828bff2

env: solve compilation error in SPL

Solve compilation issue when cli_simple.o is used in SPL
and CONFIG_SPL_ENV_SUPPORT is not defined.

env/built-in.o:(.data.env_htab+0xc): undefined reference to `env_flags_validate'
u-boot/scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
make[2]: *** [spl/u-boot-spl] Error 1
u-boot/Makefile:1649: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 2

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -23,7 +23,10 @@
23 23 #include <env_default.h>
24 24  
25 25 struct hsearch_data env_htab = {
  26 +#if CONFIG_IS_ENABLED(ENV_SUPPORT)
  27 + /* defined in flags.c, only compile with ENV_SUPPORT */
26 28 .change_ok = env_flags_validate,
  29 +#endif
27 30 };
28 31  
29 32 /*
... ... @@ -225,7 +228,9 @@
225 228 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
226 229 env_reloc();
227 230 env_fix_drivers();
228   - env_htab.change_ok += gd->reloc_off;
  231 +
  232 + if (env_htab.change_ok)
  233 + env_htab.change_ok += gd->reloc_off;
229 234 #endif
230 235 if (gd->env_valid == ENV_INVALID) {
231 236 #if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)