[PATCH v2 1/1] Makefile: pass -ansi option to cmd_gen_envp

Sébastien Szymanski sebastien.szymanski at armadeus.com
Wed Dec 20 09:59:55 CET 2023


Without the '-ansi' option, the 'linux' string in env. files is replaced
with the string '1 '. For example, in the
board/armadeus/opos6uldev/opos6uldev.env file,

kernelimg=opos6ul-linux.bin

becomes

kernelimg=opos6ul-1 .bin

in the include/generated/env.in file.

That's because 'linux' is a System-specific Predefined Macros. [1]

Pass the '-ansi' option as suggested by the GCC documentation. [1]
The option "disables recognition of C++ style ‘//’ comments" [2] so fix the
two .env files using C++ comment style for the SPDX licence.

[1] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/cpp/System-specific-Predefined-Macros.html
[2] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-ANSI-support

Signed-off-by: Sébastien Szymanski <sebastien.szymanski at armadeus.com>
---

Changes for v2:
 - explain the change of iot2050.env and smegw01.env in the commit log

 Makefile                            | 3 ++-
 board/siemens/iot2050/iot2050.env   | 2 +-
 board/storopack/smegw01/smegw01.env | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 220411a293f4..6703646d48a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1803,7 +1803,8 @@ ENV_FILE := $(if $(ENV_SOURCE_FILE),$(ENV_FILE_CFG),$(wildcard $(ENV_FILE_BOARD)
 quiet_cmd_gen_envp = ENVP    $@
       cmd_gen_envp = \
 	if [ -s "$(ENV_FILE)" ]; then \
-		$(CPP) -P $(CFLAGS) -x assembler-with-cpp -D__ASSEMBLY__ \
+		$(CPP) -P $(CFLAGS) -x assembler-with-cpp -ansi \
+			-D__ASSEMBLY__ \
 			-D__UBOOT_CONFIG__ \
 			-I . -I include -I $(srctree)/include \
 			-include linux/kconfig.h -include include/config.h \
diff --git a/board/siemens/iot2050/iot2050.env b/board/siemens/iot2050/iot2050.env
index 8bbd7abe98f0..a3bdbf4f6998 100644
--- a/board/siemens/iot2050/iot2050.env
+++ b/board/siemens/iot2050/iot2050.env
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (c) Siemens AG, 2023
  *
diff --git a/board/storopack/smegw01/smegw01.env b/board/storopack/smegw01/smegw01.env
index 93de8669109d..6807ada71887 100644
--- a/board/storopack/smegw01/smegw01.env
+++ b/board/storopack/smegw01/smegw01.env
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 #ifdef CONFIG_SYS_BOOT_LOCKED
 #define SETUP_BOOT_MENU setup_boot_menu=setenv bootmenu_0 eMMC=run bootcmd
 #else
-- 
2.41.0



More information about the U-Boot mailing list