[PATCH] Makefile: fix generating environment file

Oleksandr Suvorov oleksandr.suvorov at toradex.com
Tue Apr 20 15:57:17 CEST 2021


If the CONFIG_USE_DEFAULT_ENV_FILE=y and CONFIG_DEFAULT_ENV_FILE
points to the empty environment file, the auto-generated file has
wrong syntax so it leads to the compilation failure:

In file included from include/env_default.h:115,
                 from env/common.c:29:
include/generated/defaultenv_autogenerated.h:1:1: error: expected expression before ‘,’ token
    1 | , 0x00
      | ^
make[1]: *** [scripts/Makefile.build:266: env/common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1744: env] Error 2

Fix this issue conditionally adding the delimiter ", ".

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at toradex.com>
---

 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index e423f6de746..d42168661b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1853,7 +1853,9 @@ define filechk_defaultenv.h
 	 grep -v '^$$' | \
 	 tr '\n' '\0' | \
 	 sed -e 's/\\\x0\s*//g' | \
-	 xxd -i ; echo ", 0x00" ; )
+	 xxd -i | \
+	 sed -r 's/([0-9])$$/\1, /'; \
+	 echo "0x00" ; )
 endef
 
 define filechk_dt.h
-- 
2.31.1



More information about the U-Boot mailing list