From: Rasmus Villemoes Date: Thu, 22 Apr 2021 07:44:18 +0000 (+0200) Subject: Makefile: fix generation of defaultenv.h from empty initial file X-Git-Tag: v2021.10~198^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6ecb2f81e7fdb80ef2e5e5153d60552c4ea3fda;p=platform%2Fkernel%2Fu-boot.git 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. Reported-by: Oleksandr Suvorov Signed-off-by: Rasmus Villemoes Reviewed-by: Oleksandr Suvorov --- diff --git a/Makefile b/Makefile index a0ab464..404977e 100644 --- a/Makefile +++ b/Makefile @@ -1854,11 +1854,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