Commit f432eb6d8a9d8a9382f6e7f0096fb4ee4672b8e8

Authored by Simon Glass
Committed by Tom Rini
1 parent 64b78f5721
Exists in emb_lf_v2022.04

env: Avoid using a leftover text-environment file

If include/generated/environment.h exists (perhaps leftover from a build
of another board) it is used, even if the board currently being built does
not have a text environment.

This causes a build error. Fix it by emptying the file if it should not be
there.

Fixes: https://source.denx.de/u-boot/u-boot/-/issues/9
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Sean Anderson <seanga2@gmail.com>

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

... ... @@ -1833,7 +1833,9 @@
1833 1833  
1834 1834 # Run the environment text file through the preprocessor, but only if it is
1835 1835 # non-empty, to save time and possible build errors if something is wonky with
1836   -# the board
  1836 +# the board.
  1837 +# If there is no ENV_FILE, produce an empty output file, to prevent a previous
  1838 +# build's file being used in the case of in-tree builds.
1837 1839 quiet_cmd_gen_envp = ENVP $@
1838 1840 cmd_gen_envp = \
1839 1841 if [ -s "$(ENV_FILE)" ]; then \
... ... @@ -1844,6 +1846,7 @@
1844 1846 -I$(srctree)/arch/$(ARCH)/include \
1845 1847 $< -o $@; \
1846 1848 else \
  1849 + rm $@; \
1847 1850 touch $@ ; \
1848 1851 fi
1849 1852 include/generated/env.in: include/generated/env.txt FORCE