summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2021-04-22 09:44:18 +0200
committerOleksandr Suvorov <oleksandr.suvorov@toradex.com>2021-05-12 11:46:06 +0300
commit300c662aa7ea22a53567e16da1a873c733322bb9 (patch)
treefcccb36f2ea6a05c3b1e0b69cf4177ce82028522
parentca1e5b5353e0b0f736ec1803054c597574e660c6 (diff)
Makefile: fix generation of defaultenv.h from empty initial file
When CONFIG_USE_DEFAULT_ENV_FILE=y and the file CONFIG_DEFAULT_ENV_FILE is empty (or at least doesn't contain any non-comment, non-empty lines), we end up feeding nothing into xxd, which in turn then outputs nothing. Then blindly appending ", 0x00" means that we end up trying to compile (roughly) const char defaultenv[] = { , 0x00 } which is of course broken. To fix that, change the frobbing of the text file so that we always end up printing an extra empty line (which gets turned into that extra nul byte we need) - that corresponds better to the binary format consisting of a series of key=val nul terminated strings, terminated by an empty string. (cherry-picked from https://patchwork.ozlabs.org/project/uboot/patch/20210422074418.1573153-1-rasmus.villemoes@prevas.dk/) Reported-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
-rw-r--r--Makefile5
1 files changed, 2 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 98b0046300..7c3c78dfc5 100644
--- a/Makefile
+++ b/Makefile
@@ -1881,11 +1881,10 @@ define filechk_timestamp.h
endef
define filechk_defaultenv.h
- (grep -v '^#' | \
- grep -v '^$$' | \
+ ( { grep -v '^#' | grep -v '^$$' || true ; echo '' ; } | \
tr '\n' '\0' | \
sed -e 's/\\\x0\s*//g' | \
- xxd -i ; echo ", 0x00" ; )
+ xxd -i ; )
endef
define filechk_dt.h