Some users want to build with CONFIG_TOOLS_LIBCRYPTO disabled, which in
general is possible for at least some boards.  32-bit mvebu however
requires kwbimage for building SPL, and kwbimage has a hard dependency
to host OpenSSL.

The new symbol CONFIG_TOOLS_KWBIMAGE allows disabling kwbimage build on
non-mvebu platforms, and thus building without host libcrypto from
OpenSSL.

Based on previous work and discussions, see links below.

Link: https://lore.kernel.org/u-boot/20211021093304.25399-1-p...@kernel.org/
Link: https://lore.kernel.org/u-boot/20220111153120.1276641-1-ma...@denx.de/
Link: 
https://lore.kernel.org/u-boot/20230121154743.667253-2-paulerwan....@gmail.com/
Cc: Marek Vasut <ma...@denx.de>
Cc: Paul-Erwan Rio <paulerwan....@gmail.com>
Signed-off-by: Alexander Dahl <a...@thorsis.com>
Reviewed-by: Simon Glass <s...@chromium.org>
---

Notes:
    This is more or less a mashup of the patches of Pali and Marek, but
    considering the feedback given by Samuel on Pali's patch and considering
    what I thought was the preferred style in other parts of the Makefile.
    
    Link: 
https://lore.kernel.org/u-boot/f4660467-9d25-dc46-9e60-b2f7f0923...@sholland.org/
    
    v1 -> v2:
    * removed a useless new newline added in v1
    * collected tags

 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 4 +++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index c80d8587b14..2058c95ca2d 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -15,6 +15,7 @@ config ARMADA_32BIT
        select SUPPORT_SPL
        select SYS_L2_PL310 if !SYS_L2CACHE_OFF
        select TRANSLATION_OFFSET
+       select TOOLS_KWBIMAGE if SPL
        select SPL_SYS_NO_VECTOR_TABLE if SPL
        select ARCH_VERY_EARLY_INIT
 
diff --git a/tools/Kconfig b/tools/Kconfig
index 6e23f44d550..f8632cd59d0 100644
--- a/tools/Kconfig
+++ b/tools/Kconfig
@@ -25,6 +25,11 @@ config TOOLS_LIBCRYPTO
          This selection does not affect target features, such as runtime FIT
          signature verification.
 
+config TOOLS_KWBIMAGE
+       bool "Enable kwbimage support in host tools"
+       default y
+       select TOOLS_LIBCRYPTO
+
 config TOOLS_FIT
        def_bool y
        help
diff --git a/tools/Makefile b/tools/Makefile
index 1aa1e36137b..6a4280e3668 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -94,6 +94,8 @@ LIBCRYPTO_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := \
                        generated/lib/fdt-libcrypto.o \
                        sunxi_toc0.o
 
+KWB_IMAGE_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := kwbimage.o
+
 ROCKCHIP_OBS = generated/lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
 
 # common objs for dumpimage and mkimage
@@ -114,7 +116,7 @@ dumpimage-mkimage-objs := aisimage.o \
                        imximage.o \
                        imx8image.o \
                        imx8mimage.o \
-                       kwbimage.o \
+                       $(KWB_IMAGE_OBJS-y) \
                        generated/lib/md5.o \
                        lpc32xximage.o \
                        mxsimage.o \
-- 
2.39.2

Reply via email to