Skip to contentSkip to conversation

tools: kwbimage: Allow to disable compilation of kwbimage on non-mvebu platforms

RFC PATCH In review Pali Rohár 3 participants 8 messages Oct 21, 2021 – Jun 27, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tools: kwbimage: Allow to disable compilation of kwbimage on non-mvebu platforms

kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and Discovery, which are not in mach-mvebu) require kwimage for building SPL.

Some users want to compile u-boot tools without libcrypto.

Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls compilation of kwbimage and define correct dependences between mvebu, kwbimage and libcrypto targets.

This allows disabling of kwbimage compilation on non-mvebu platforms.

---
 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +1 -0
index 54dff9986b41..1ccbccea1dda 100644
@@ -15,6 +15,7 @@ config ARMADA_32BIT
 	select SPL_SIMPLE_BUS if SPL
 	select SUPPORT_SPL
 	select TRANSLATION_OFFSET
+	select TOOLS_KWBIMAGE if SPL
 
 config ARMADA_64BIT
 	bool
tools/Kconfig +5 -0
index 91ce8ae3e516..40866c5713d9 100644
@@ -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
+	depends on TOOLS_LIBCRYPTO
+
 config TOOLS_FIT
 	def_bool y
 	help
tools/Makefile +4 -1
index 75d8fe71d668..08f1f5a51fb3 100644
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
 			imximage.o \
 			imx8image.o \
 			imx8mimage.o \
-			kwbimage.o \
 			lib/md5.o \
 			lpc32xximage.o \
 			mxsimage.o \
@@ -150,6 +149,10 @@ dumpimage-mkimage-objs := aisimage.o \
 			$(RSA_OBJS-y) \
 			$(AES_OBJS-y)
 
+ifdef CONFIG_TOOLS_KWBIMAGE
+dumpimage-mkimage-objs += kwbimage.o
+endif
+
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
 mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Thanks for sending this patch!

Quoted 35 lines · Pali Rohár

kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and Discovery, which are not in mach-mvebu) require kwimage for building SPL.

Some users want to compile u-boot tools without libcrypto.

Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls compilation of kwbimage and define correct dependences between mvebu, kwbimage and libcrypto targets.

This allows disabling of kwbimage compilation on non-mvebu platforms.

---
 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +1 -0
index 54dff9986b41..1ccbccea1dda 100644
@@ -15,6 +15,7 @@ config ARMADA_32BIT
 	select SPL_SIMPLE_BUS if SPL
 	select SUPPORT_SPL
 	select TRANSLATION_OFFSET
+	select TOOLS_KWBIMAGE if SPL
 
 config ARMADA_64BIT
 	bool
tools/Kconfig +0 -0
index 91ce8ae3e516..40866c5713d9 100644

tools/Kconfig config TOOLS_LIBCRYPTO · line 31

Quoted 7 lines
tools/Kconfig +4 -0
@@ -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
+	depends on TOOLS_LIBCRYPTO

This symbol needs to select TOOLS_LIBCRYPTO. Otherwise that option can still be deselected by the user, and the build fails when doing so:

$ make CROSS_COMPILE=arm-linux-musleabi- db-mv784mp-gp_defconfig
#
# configuration written to .config
#
$ make CROSS_COMPILE=arm-linux-musleabi- nconfig
scripts/kconfig/nconf  Kconfig
$ make CROSS_COMPILE=arm-linux-musleabi-
scripts/kconfig/conf  --syncconfig Kconfig

WARNING: unmet direct dependencies detected for TOOLS_KWBIMAGE
Depends on [n]: TOOLS_LIBCRYPTO [=n]
Selected by [y]:
- ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y] && SPL [=y]

WARNING: unmet direct dependencies detected for TOOLS_KWBIMAGE
Depends on [n]: TOOLS_LIBCRYPTO [=n]
Selected by [y]:
- ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y] && SPL [=y]

WARNING: unmet direct dependencies detected for TOOLS_KWBIMAGE
Depends on [n]: TOOLS_LIBCRYPTO [=n]
Selected by [y]:
- ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y] && SPL [=y]

  CFG     u-boot.cfg
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     include/autoconf.mk
  GEN     spl/include/autoconf.mk

===================== WARNING ====================== This board does not use CONFIG_DM_I2C (Driver Model for I2C drivers). Please update the board to use CONFIG_DM_I2C before the v2022.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info.
====================================================

  CFGCHK  u-boot.cfg
  HOSTLD  tools/dumpimage
  HOSTLD  tools/mkimage

ld: tools/kwbimage.o: in function `kwb_compute_pubkey_hash':
kwbimage.c:(.text+0x1a00): undefined reference to `EVP_MD_CTX_new'
ld: kwbimage.c:(.text+0x1a10): undefined reference to `EVP_MD_CTX_reset'
ld: kwbimage.c:(.text+0x1a18): undefined reference to `EVP_sha256' [and more linker errors]

Regards,
Samuel

Quoted 28 lines
tools/Kconfig +1 -0
+
 config TOOLS_FIT
 	def_bool y
 	help
tools/Makefile +4 -1
index 75d8fe71d668..08f1f5a51fb3 100644
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
 			imximage.o \
 			imx8image.o \
 			imx8mimage.o \
-			kwbimage.o \
 			lib/md5.o \
 			lpc32xximage.o \
 			mxsimage.o \
@@ -150,6 +149,10 @@ dumpimage-mkimage-objs := aisimage.o \
 			$(RSA_OBJS-y) \
 			$(AES_OBJS-y)
 
+ifdef CONFIG_TOOLS_KWBIMAGE
+dumpimage-mkimage-objs += kwbimage.o
+endif
+
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
 mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
#2 lore raw

Hello!

Quoted 43 lines · On Thursday 21 October 2021 20:48:22 Samuel Holland wrote:

Hi,

Thanks for sending this patch!

Quoted 38 lines · Pali Rohár

kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and Discovery, which are not in mach-mvebu) require kwimage for building SPL.

Some users want to compile u-boot tools without libcrypto.

Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls compilation of kwbimage and define correct dependences between mvebu, kwbimage and libcrypto targets.

This allows disabling of kwbimage compilation on non-mvebu platforms.

---
 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +1 -0
index 54dff9986b41..1ccbccea1dda 100644
@@ -15,6 +15,7 @@ config ARMADA_32BIT
 	select SPL_SIMPLE_BUS if SPL
 	select SUPPORT_SPL
 	select TRANSLATION_OFFSET
+	select TOOLS_KWBIMAGE if SPL
 
 config ARMADA_64BIT
 	bool
tools/Kconfig +0 -0
index 91ce8ae3e516..40866c5713d9 100644
@@ -25,6 +25,11 @@ config TOOLS_LIBCRYPTO
 	  This selection does not affect target features, such as runtime FIT
 	  signature verification.
 
Quoted 7 lines

tools/Kconfig config TOOLS_LIBCRYPTO · line 31

Quoted 4 lines
tools/Kconfig +4 -0
+config TOOLS_KWBIMAGE
+	bool "Enable kwbimage support in host tools"
+	default y
+	depends on TOOLS_LIBCRYPTO

This symbol needs to select TOOLS_LIBCRYPTO. Otherwise that option can still be deselected by the user, and the build fails when doing so:

Yes, that it truth. But in case user does not have openssl installed then it show another compile / link error.

And I do not know what is the better "user experience". If build system should throw warnings (like below) about unmet dependences (user chose something which cannot be satisfied by build system) with link errors. Or if build system should silently enable openssl symbols, even when they were explicitly disabled by user (via config file) and then throw compile error about missing header files.

I do not have opinion which of these two option is better.

Of course changing "depends on" to "select" is not a problem.

Quoted 19 lines
$ make CROSS_COMPILE=arm-linux-musleabi- db-mv784mp-gp_defconfig
#
# configuration written to .config
#
$ make CROSS_COMPILE=arm-linux-musleabi- nconfig
scripts/kconfig/nconf  Kconfig
$ make CROSS_COMPILE=arm-linux-musleabi-
scripts/kconfig/conf  --syncconfig Kconfig

WARNING: unmet direct dependencies detected for TOOLS_KWBIMAGE
Depends on [n]: TOOLS_LIBCRYPTO [=n]
Selected by [y]:
- ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y] && SPL [=y]

WARNING: unmet direct dependencies detected for TOOLS_KWBIMAGE
Depends on [n]: TOOLS_LIBCRYPTO [=n]
Selected by [y]:
- ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y] && SPL [=y]

Quoted 4 lines

WARNING: unmet direct dependencies detected for TOOLS_KWBIMAGE
Depends on [n]: TOOLS_LIBCRYPTO [=n]
Selected by [y]:
- ARMADA_32BIT [=y] && ARM [=y] && ARCH_MVEBU [=y] && SPL [=y]

I known that these warning lines come from kconfig tools... But should not they be rather fatal errors? As it indicates issues with configuration.

Quoted 53 lines
  CFG     u-boot.cfg
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     include/autoconf.mk
  GEN     spl/include/autoconf.mk

===================== WARNING ====================== This board does not use CONFIG_DM_I2C (Driver Model for I2C drivers). Please update the board to use CONFIG_DM_I2C before the v2022.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info.
====================================================

  CFGCHK  u-boot.cfg
  HOSTLD  tools/dumpimage
  HOSTLD  tools/mkimage

ld: tools/kwbimage.o: in function `kwb_compute_pubkey_hash':
kwbimage.c:(.text+0x1a00): undefined reference to `EVP_MD_CTX_new'
ld: kwbimage.c:(.text+0x1a10): undefined reference to `EVP_MD_CTX_reset'
ld: kwbimage.c:(.text+0x1a18): undefined reference to `EVP_sha256' [and more linker errors]

Regards,
Samuel

Quoted 28 lines
tools/Kconfig +1 -0
+
 config TOOLS_FIT
 	def_bool y
 	help
tools/Makefile +4 -1
index 75d8fe71d668..08f1f5a51fb3 100644
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
 			imximage.o \
 			imx8image.o \
 			imx8mimage.o \
-			kwbimage.o \
 			lib/md5.o \
 			lpc32xximage.o \
 			mxsimage.o \
@@ -150,6 +149,10 @@ dumpimage-mkimage-objs := aisimage.o \
 			$(RSA_OBJS-y) \
 			$(AES_OBJS-y)
 
+ifdef CONFIG_TOOLS_KWBIMAGE
+dumpimage-mkimage-objs += kwbimage.o
+endif
+
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
 mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
#3 lore raw
In reply to Pali Rohár

Hello,

Am Thu, Oct 21, 2021 at 11:33:04AM +0200 schrieb Pali Rohár:

Quoted 4 lines

kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and Discovery, which are not in mach-mvebu) require kwimage for building SPL.

Some users want to compile u-boot tools without libcrypto.

Indeed. Build of master (v2022.01-rc3) fails like this, if there are no OpenSSL headers on the host, and although CONFIG_TOOLS_LIBCRYPTO is not set:

      HOSTCC  tools/kwbimage.o
    /home/adahl/src/u-boot/tools/kwbimage.c:18:10: fatal error: openssl/bn.h: Datei oder Verzeichnis nicht gefunden
     #include <openssl/bn.h>
              ^~~~~~~~~~~~~~
    compilation terminated.

This is already broken with U-Boot v2021.10. What's the state of this patch?

Greets
Alex

Quoted 68 lines

Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls compilation of kwbimage and define correct dependences between mvebu, kwbimage and libcrypto targets.

This allows disabling of kwbimage compilation on non-mvebu platforms.

---
 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +1 -0
index 54dff9986b41..1ccbccea1dda 100644
@@ -15,6 +15,7 @@ config ARMADA_32BIT
 	select SPL_SIMPLE_BUS if SPL
 	select SUPPORT_SPL
 	select TRANSLATION_OFFSET
+	select TOOLS_KWBIMAGE if SPL
 
 config ARMADA_64BIT
 	bool
tools/Kconfig +5 -0
index 91ce8ae3e516..40866c5713d9 100644
@@ -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
+	depends on TOOLS_LIBCRYPTO
+
 config TOOLS_FIT
 	def_bool y
 	help
tools/Makefile +4 -1
index 75d8fe71d668..08f1f5a51fb3 100644
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
 			imximage.o \
 			imx8image.o \
 			imx8mimage.o \
-			kwbimage.o \
 			lib/md5.o \
 			lpc32xximage.o \
 			mxsimage.o \
@@ -150,6 +149,10 @@ dumpimage-mkimage-objs := aisimage.o \
 			$(RSA_OBJS-y) \
 			$(AES_OBJS-y)
 
+ifdef CONFIG_TOOLS_KWBIMAGE
+dumpimage-mkimage-objs += kwbimage.o
+endif
+
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
 mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
Signature · 1 line
2.20.1
#4 lore raw
Quoted 1 line · On Tuesday 30 November 2021 16:50:49 Alexander Dahl wrote:

What's the state of this patch?

I have sent it to ML for discussion as one of the possible solution for this problem. I guess that decision how to solve it up to maintainers.

Anyway, I have tested it on Debian and works fine for me.

Tested-by on v1 1/1
#5 lore raw
In reply to Pali Rohár

Hei hei,

Am Thu, Oct 21, 2021 at 11:33:04AM +0200 schrieb Pali Rohár:

Quoted 59 lines

kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and Discovery, which are not in mach-mvebu) require kwimage for building SPL.

Some users want to compile u-boot tools without libcrypto.

Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls compilation of kwbimage and define correct dependences between mvebu, kwbimage and libcrypto targets.

This allows disabling of kwbimage compilation on non-mvebu platforms.

---
 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +1 -0
index 54dff9986b41..1ccbccea1dda 100644
@@ -15,6 +15,7 @@ config ARMADA_32BIT
 	select SPL_SIMPLE_BUS if SPL
 	select SUPPORT_SPL
 	select TRANSLATION_OFFSET
+	select TOOLS_KWBIMAGE if SPL
 
 config ARMADA_64BIT
 	bool
tools/Kconfig +5 -0
index 91ce8ae3e516..40866c5713d9 100644
@@ -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
+	depends on TOOLS_LIBCRYPTO
+
 config TOOLS_FIT
 	def_bool y
 	help
tools/Makefile +0 -1
index 75d8fe71d668..08f1f5a51fb3 100644
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
 			imximage.o \
 			imx8image.o \
 			imx8mimage.o \
-			kwbimage.o \
 			lib/md5.o \
 			lpc32xximage.o \
 			mxsimage.o \

tools/Makefile dumpimage-mkimage-objs := aisimage.o \ · line 158

Quoted 10 lines
tools/Makefile +4 -0
@@ -150,6 +149,10 @@ dumpimage-mkimage-objs := aisimage.o \
 			$(RSA_OBJS-y) \
 			$(AES_OBJS-y)
 
+ifdef CONFIG_TOOLS_KWBIMAGE
+dumpimage-mkimage-objs += kwbimage.o
+endif
+
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
 mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o

FWIW:

Greets
Alex

#6 lore raw

Hello,

Am Dienstag, 30. November 2021, 17:06:11 CEST schrieb Alexander Dahl:

Quoted 83 lines

Am Thu, Oct 21, 2021 at 11:33:04AM +0200 schrieb Pali Rohár:

Quoted 82 lines

kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and Discovery, which are not in mach-mvebu) require kwimage for building SPL.

Some users want to compile u-boot tools without libcrypto.

Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls compilation
of kwbimage and define correct dependences between mvebu, kwbimage and libcrypto targets.

This allows disabling of kwbimage compilation on non-mvebu platforms.

---

 arch/arm/mach-mvebu/Kconfig | 1 +
 tools/Kconfig               | 5 +++++
 tools/Makefile              | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/Kconfig +1 -0
index 54dff9986b41..1ccbccea1dda 100644
@@ -15,6 +15,7 @@ config ARMADA_32BIT
 
 	select SPL_SIMPLE_BUS if SPL
 	select SUPPORT_SPL
 	select TRANSLATION_OFFSET
 
+	select TOOLS_KWBIMAGE if SPL
 

config ARMADA_64BIT

arch/arm/mach-mvebu/Kconfig +0 -0
 	bool
tools/Kconfig +5 -0
index 91ce8ae3e516..40866c5713d9 100644
@@ -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
+	depends on TOOLS_LIBCRYPTO
+
 
 config TOOLS_FIT
tools/Kconfig +0 -0
 	def_bool y
 	help
tools/Makefile +0 -1
index 75d8fe71d668..08f1f5a51fb3 100644
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
 
 			imximage.o \
 			imx8image.o \
 			imx8mimage.o \
 
-			kwbimage.o \
 
tools/Makefile +4 -0
 			lib/md5.o \
 			lpc32xximage.o \
 			mxsimage.o \
@@ -150,6 +149,10 @@ dumpimage-mkimage-objs := aisimage.o \
 
 			$(RSA_OBJS-y) \
 			$(AES_OBJS-y)
 
+ifdef CONFIG_TOOLS_KWBIMAGE
+dumpimage-mkimage-objs += kwbimage.o
+endif
+
 
Quoted 7 lines
Quoted 3 lines
tools/Makefile +0 -0
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o

mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o

FWIW:

After migrating some boards from u-boot v2021.10 to v2022.01 I found this is still an issue. Build for example at91 board fails if CONFIG_TOOLS_LIBCRYPTO is disabled and build host has no openssl headers installed. (Error output below.)

Could anyone please have a look at this patch again? I don't need host tools linked with openssl. When building with ptxdist, this only increases build time (for the additional host-openssl) for no benefit.

(Actually I don't need kwbimage for my target at all, why is it built for platforms not needing it in the first place?)

HOSTLD tools/mkimage
/usr/bin/ld: tools/kwbimage.o: in function `openssl_err':
kwbimage.c:(.text+0x9a): undefined reference to ERR_get_error' /usr/bin/ld: kwbimage.c:(.text+0xb6): undefined reference to ERR_error_string'
/usr/bin/ld: tools/kwbimage.o: in function `kwb_compute_pubkey_hash':
kwbimage.c:(.text+0x119): undefined reference to EVP_MD_CTX_new' /usr/bin/ld: kwbimage.c:(.text+0x12d): undefined reference to EVP_MD_CTX_reset'
/usr/bin/ld: kwbimage.c:(.text+0x132): undefined reference to EVP_sha256' /usr/bin/ld: kwbimage.c:(.text+0x13d): undefined reference to EVP_DigestInit' /usr/bin/ld: kwbimage.c:(.text+0x158): undefined reference to `EVP_DigestUpdate'
/usr/bin/ld: kwbimage.c:(.text+0x16c): undefined reference to `EVP_DigestFinal'
/usr/bin/ld: kwbimage.c:(.text+0x17a): undefined reference to `EVP_MD_CTX_reset'
/usr/bin/ld: kwbimage.c:(.text+0x182): undefined reference to `EVP_MD_CTX_free'
/usr/bin/ld: tools/kwbimage.o: in function `kwb_export_pubkey':
kwbimage.c:(.text+0x222): undefined reference to RSA_get0_key' /usr/bin/ld: kwbimage.c:(.text+0x233): undefined reference to RSA_get0_key' /usr/bin/ld: kwbimage.c:(.text+0x265): undefined reference to BN_num_bits' /usr/bin/ld: kwbimage.c:(.text+0x27a): undefined reference to BN_num_bits' /usr/bin/ld: kwbimage.c:(.text+0x2ee): undefined reference to BN_bn2bin' /usr/bin/ld: kwbimage.c:(.text+0x30b): undefined reference to BN_bn2bin' /usr/bin/ld: tools/kwbimage.o: in function `kwb_load_rsa_key':
kwbimage.c:(.text+0x4a1): undefined reference to PEM_read_RSAPrivateKey' /usr/bin/ld: tools/kwbimage.o: in function kwb_sign':
kwbimage.c:(.text+0x174d): undefined reference to EVP_PKEY_new' /usr/bin/ld: kwbimage.c:(.text+0x1764): undefined reference to EVP_PKEY_set1_RSA'
/usr/bin/ld: kwbimage.c:(.text+0x1774): undefined reference to EVP_PKEY_size' /usr/bin/ld: kwbimage.c:(.text+0x1784): undefined reference to EVP_MD_CTX_new'
/usr/bin/ld: kwbimage.c:(.text+0x1798): undefined reference to `EVP_MD_CTX_reset'
/usr/bin/ld: kwbimage.c:(.text+0x179d): undefined reference to EVP_sha256' /usr/bin/ld: kwbimage.c:(.text+0x17a8): undefined reference to EVP_DigestInit'
/usr/bin/ld: kwbimage.c:(.text+0x17be): undefined reference to `EVP_DigestUpdate'
/usr/bin/ld: kwbimage.c:(.text+0x17d9): undefined reference to EVP_SignFinal' /usr/bin/ld: kwbimage.c:(.text+0x17eb): undefined reference to EVP_MD_CTX_reset'
/usr/bin/ld: kwbimage.c:(.text+0x17f3): undefined reference to `EVP_MD_CTX_free'
/usr/bin/ld: kwbimage.c:(.text+0x17fb): undefined reference to EVP_PKEY_free' /usr/bin/ld: kwbimage.c:(.text+0x181a): undefined reference to EVP_PKEY_free' /usr/bin/ld: kwbimage.c:(.text+0x1882): undefined reference to `EVP_MD_CTX_free'
/usr/bin/ld: tools/kwbimage.o: in function `kwb_verify':
kwbimage.c:(.text+0x18fe): undefined reference to EVP_PKEY_new' /usr/bin/ld: kwbimage.c:(.text+0x1915): undefined reference to EVP_PKEY_set1_RSA'
/usr/bin/ld: kwbimage.c:(.text+0x1925): undefined reference to EVP_PKEY_size' /usr/bin/ld: kwbimage.c:(.text+0x1935): undefined reference to EVP_MD_CTX_new'
/usr/bin/ld: kwbimage.c:(.text+0x1949): undefined reference to `EVP_MD_CTX_reset'
/usr/bin/ld: kwbimage.c:(.text+0x194e): undefined reference to EVP_sha256' /usr/bin/ld: kwbimage.c:(.text+0x1959): undefined reference to EVP_DigestInit'
/usr/bin/ld: kwbimage.c:(.text+0x196f): undefined reference to `EVP_DigestUpdate'
/usr/bin/ld: kwbimage.c:(.text+0x198a): undefined reference to `EVP_VerifyFinal'
/usr/bin/ld: kwbimage.c:(.text+0x19aa): undefined reference to `EVP_MD_CTX_free'
/usr/bin/ld: kwbimage.c:(.text+0x19c3): undefined reference to EVP_PKEY_free' /usr/bin/ld: kwbimage.c:(.text+0x1a8f): undefined reference to EVP_MD_CTX_reset'
/usr/bin/ld: kwbimage.c:(.text+0x1a97): undefined reference to `EVP_MD_CTX_free'
/usr/bin/ld: kwbimage.c:(.text+0x1a9f): undefined reference to EVP_PKEY_free' /usr/bin/ld: tools/kwbimage.o: in function kwb_sign_csk_with_kak':
kwbimage.c:(.text+0x233d): undefined reference to d2i_RSAPublicKey' /usr/bin/ld: tools/kwbimage.o: in function EVP_MD_CTX_cleanup':
kwbimage.c:(.text+0xe51): undefined reference to `EVP_MD_CTX_reset'
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:104: tools/mkimage] Fehler 1 make[1]: *** [/mnt/data/adahl/src/u-boot/Makefile:1810: tools] Fehler 2 make[1]: Verzeichnis „/home/adahl/build/u-boot/v2022.01.x“ wird verlassen
make: *** [Makefile:177: sub-make] Fehler 2

Greets
Alex

#7 lore raw
Quoted 6 lines · On Monday 27 June 2022 09:53:22 Alexander Dahl wrote:

After migrating some boards from u-boot v2021.10 to v2022.01 I found this is still an issue. Build for example at91 board fails if CONFIG_TOOLS_LIBCRYPTO is disabled and build host has no openssl headers installed. (Error output below.)

Could anyone please have a look at this patch again?

Reviewing / accepting this patch is up to the u-boot maintainers, not me. I just provided this patch as I think it could be useful.

Quoted 2 lines

(Actually I don't need kwbimage for my target at all, why is it built for platforms not needing it in the first place?)

This is because mkimage is generic tool which supports all image formats supported by U-Boot. For example on x86 host it allows users to build different ARM images, not only x86. I guess this is primary intended for Linux distributions to support all U-Boot targets...