[PATCH 7/8] binman_sym: guard with CONFIG_IS_ENABLED(BINMAN_SYMBOLS)

Peng Fan (OSS) peng.fan at oss.nxp.com
Fri Jun 3 09:17:14 CEST 2022


From: Peng Fan <peng.fan at nxp.com>

There is case that CONFIG_BINMAN is defined, but
CONFIG_SPL_BINMAN_SYMBOLS is not defined. In that case, there will be
build failure. So use CONFIG_SPL_BINMAN_SYMBOLS to guard the macros, and
define CONFIG_SPL_BINMAN_SYMBOLS in binman syms test.

Tested-by: Tim Harvey <tharvey at gateworks.com> #imx8m[m,n,p]-venice
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 include/binman_sym.h                        | 2 +-
 tools/binman/test/Makefile                  | 2 +-
 tools/binman/test/generated/autoconf.h      | 3 +++
 tools/binman/test/u_boot_binman_syms.c      | 2 +-
 tools/binman/test/u_boot_binman_syms_size.c | 2 +-
 5 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 tools/binman/test/generated/autoconf.h

diff --git a/include/binman_sym.h b/include/binman_sym.h
index 72e6765fe52..b76b3293516 100644
--- a/include/binman_sym.h
+++ b/include/binman_sym.h
@@ -13,7 +13,7 @@
 
 #define BINMAN_SYM_MISSING	(-1UL)
 
-#ifdef CONFIG_BINMAN
+#if CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
 
 /**
  * binman_symname() - Internal function to get a binman symbol name
diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile
index 57057e2d588..45c67f43561 100644
--- a/tools/binman/test/Makefile
+++ b/tools/binman/test/Makefile
@@ -21,7 +21,7 @@ CC		= $(CROSS_COMPILE)gcc
 OBJCOPY		= $(CROSS_COMPILE)objcopy
 
 VPATH := $(SRC)
-CFLAGS := -march=i386 -m32 -nostdlib -I $(SRC)../../../include \
+CFLAGS := -march=i386 -m32 -nostdlib -I $(SRC)../../../include -I $(SRC)\
 	-Wl,--no-dynamic-linker
 
 LDS_UCODE := -T $(SRC)u_boot_ucode_ptr.lds
diff --git a/tools/binman/test/generated/autoconf.h b/tools/binman/test/generated/autoconf.h
new file mode 100644
index 00000000000..6a23039f469
--- /dev/null
+++ b/tools/binman/test/generated/autoconf.h
@@ -0,0 +1,3 @@
+#define CONFIG_BINMAN 1
+#define CONFIG_SPL_BUILD 1
+#define CONFIG_SPL_BINMAN_SYMBOLS 1
diff --git a/tools/binman/test/u_boot_binman_syms.c b/tools/binman/test/u_boot_binman_syms.c
index 37fc339ce84..89fee5567e1 100644
--- a/tools/binman/test/u_boot_binman_syms.c
+++ b/tools/binman/test/u_boot_binman_syms.c
@@ -5,7 +5,7 @@
  * Simple program to create some binman symbols. This is used by binman tests.
  */
 
-#define CONFIG_BINMAN
+#include <linux/kconfig.h>
 #include <binman_sym.h>
 
 binman_sym_declare(unsigned long, u_boot_spl_any, offset);
diff --git a/tools/binman/test/u_boot_binman_syms_size.c b/tools/binman/test/u_boot_binman_syms_size.c
index 7224bc1863c..c4a053f96f1 100644
--- a/tools/binman/test/u_boot_binman_syms_size.c
+++ b/tools/binman/test/u_boot_binman_syms_size.c
@@ -5,7 +5,7 @@
  * Simple program to create some binman symbols. This is used by binman tests.
  */
 
-#define CONFIG_BINMAN
+#include <linux/kconfig.h>
 #include <binman_sym.h>
 
 binman_sym_declare(char, u_boot_spl, pos);
-- 
2.36.0



More information about the U-Boot mailing list