From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B69F9C433EF for ; Mon, 27 Jun 2022 07:53:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 976DD81DD6; Mon, 27 Jun 2022 09:53:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=thorsis.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3B2BF81DD6; Mon, 27 Jun 2022 09:53:27 +0200 (CEST) Received: from mail.thorsis.com (mail.thorsis.com [92.198.35.195]) by phobos.denx.de (Postfix) with ESMTP id 9970B81DD6 for ; Mon, 27 Jun 2022 09:53:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=thorsis.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ada@thorsis.com From: Alexander Dahl To: Pali =?ISO-8859-1?Q?Roh=E1r?= Cc: Andre Przywara , Samuel Holland , Alexandru Gagniuc , Stefan Roese , u-boot@lists.denx.de Subject: Re: [RFC PATCH] tools: kwbimage: Allow to disable compilation of kwbimage on non-mvebu platforms Date: Mon, 27 Jun 2022 09:53:22 +0200 Message-ID: <2193771.WfoU5kHrGb@ada> In-Reply-To: References: <20211021093304.25399-1-pali@kernel.org> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hello, Am Dienstag, 30. November 2021, 17:06:11 CEST schrieb Alexander Dahl: > Am Thu, Oct 21, 2021 at 11:33:04AM +0200 schrieb Pali Roh=C3=A1r: > > kwbimage depends on libcrypto. 32-bit mvebu platforms (except Orion and > > Discovery, which are not in mach-mvebu) require kwimage for building SP= L. > >=20 > > Some users want to compile u-boot tools without libcrypto. > >=20 > > Therefore add a new symbol CONFIG_TOOLS_KWBIMAGE which controls > > compilation > > of kwbimage and define correct dependences between mvebu, kwbimage and > > libcrypto targets. > >=20 > > This allows disabling of kwbimage compilation on non-mvebu platforms. > >=20 > > Signed-off-by: Pali Roh=C3=A1r > > --- > >=20 > > arch/arm/mach-mvebu/Kconfig | 1 + > > tools/Kconfig | 5 +++++ > > tools/Makefile | 5 ++++- > > 3 files changed, 10 insertions(+), 1 deletion(-) > >=20 > > diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig > > index 54dff9986b41..1ccbccea1dda 100644 > > --- a/arch/arm/mach-mvebu/Kconfig > > +++ b/arch/arm/mach-mvebu/Kconfig > > @@ -15,6 +15,7 @@ config ARMADA_32BIT > >=20 > > select SPL_SIMPLE_BUS if SPL > > select SUPPORT_SPL > > select TRANSLATION_OFFSET > >=20 > > + select TOOLS_KWBIMAGE if SPL > >=20 > > config ARMADA_64BIT > > =20 > > bool > >=20 > > diff --git a/tools/Kconfig b/tools/Kconfig > > index 91ce8ae3e516..40866c5713d9 100644 > > --- a/tools/Kconfig > > +++ b/tools/Kconfig > > @@ -25,6 +25,11 @@ config TOOLS_LIBCRYPTO > >=20 > > This selection does not affect target features, such as runtime FIT > > signature verification. > >=20 > > +config TOOLS_KWBIMAGE > > + bool "Enable kwbimage support in host tools" > > + default y > > + depends on TOOLS_LIBCRYPTO > > + > >=20 > > config TOOLS_FIT > > =20 > > def_bool y > > help > >=20 > > diff --git a/tools/Makefile b/tools/Makefile > > index 75d8fe71d668..08f1f5a51fb3 100644 > > --- a/tools/Makefile > > +++ b/tools/Makefile > > @@ -118,7 +118,6 @@ dumpimage-mkimage-objs :=3D aisimage.o \ > >=20 > > imximage.o \ > > imx8image.o \ > > imx8mimage.o \ > >=20 > > - kwbimage.o \ > >=20 > > lib/md5.o \ > > lpc32xximage.o \ > > mxsimage.o \ > >=20 > > @@ -150,6 +149,10 @@ dumpimage-mkimage-objs :=3D aisimage.o \ > >=20 > > $(RSA_OBJS-y) \ > > $(AES_OBJS-y) > >=20 > > +ifdef CONFIG_TOOLS_KWBIMAGE > > +dumpimage-mkimage-objs +=3D kwbimage.o > > +endif > > + > >=20 > > dumpimage-objs :=3D $(dumpimage-mkimage-objs) dumpimage.o > > mkimage-objs :=3D $(dumpimage-mkimage-objs) mkimage.o > > fit_info-objs :=3D $(dumpimage-mkimage-objs) fit_info.o >=20 > FWIW: >=20 > Tested-by: Alexander Dahl After migrating some boards from u-boot v2021.10 to v2022.01 I found this i= s=20 still an issue. Build for example at91 board fails if CONFIG_TOOLS_LIBCRYP= TO=20 is disabled and build host has no openssl headers installed. =20 (Error output below.) Could anyone please have a look at this patch again? I don't need host too= ls=20 linked with openssl. When building with ptxdist, this only increases build= =20 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=20 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=20 `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=20 `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_DigestIn= it' /usr/bin/ld: kwbimage.c:(.text+0x158): undefined reference to=20 `EVP_DigestUpdate' /usr/bin/ld: kwbimage.c:(.text+0x16c): undefined reference to=20 `EVP_DigestFinal' /usr/bin/ld: kwbimage.c:(.text+0x17a): undefined reference to=20 `EVP_MD_CTX_reset' /usr/bin/ld: kwbimage.c:(.text+0x182): undefined reference to=20 `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=20 `EVP_PKEY_set1_RSA' /usr/bin/ld: kwbimage.c:(.text+0x1774): undefined reference to `EVP_PKEY_si= ze' /usr/bin/ld: kwbimage.c:(.text+0x1784): undefined reference to=20 `EVP_MD_CTX_new' /usr/bin/ld: kwbimage.c:(.text+0x1798): undefined reference to=20 `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=20 `EVP_DigestInit' /usr/bin/ld: kwbimage.c:(.text+0x17be): undefined reference to=20 `EVP_DigestUpdate' /usr/bin/ld: kwbimage.c:(.text+0x17d9): undefined reference to `EVP_SignFin= al' /usr/bin/ld: kwbimage.c:(.text+0x17eb): undefined reference to=20 `EVP_MD_CTX_reset' /usr/bin/ld: kwbimage.c:(.text+0x17f3): undefined reference to=20 `EVP_MD_CTX_free' /usr/bin/ld: kwbimage.c:(.text+0x17fb): undefined reference to `EVP_PKEY_fr= ee' /usr/bin/ld: kwbimage.c:(.text+0x181a): undefined reference to `EVP_PKEY_fr= ee' /usr/bin/ld: kwbimage.c:(.text+0x1882): undefined reference to=20 `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=20 `EVP_PKEY_set1_RSA' /usr/bin/ld: kwbimage.c:(.text+0x1925): undefined reference to `EVP_PKEY_si= ze' /usr/bin/ld: kwbimage.c:(.text+0x1935): undefined reference to=20 `EVP_MD_CTX_new' /usr/bin/ld: kwbimage.c:(.text+0x1949): undefined reference to=20 `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=20 `EVP_DigestInit' /usr/bin/ld: kwbimage.c:(.text+0x196f): undefined reference to=20 `EVP_DigestUpdate' /usr/bin/ld: kwbimage.c:(.text+0x198a): undefined reference to=20 `EVP_VerifyFinal' /usr/bin/ld: kwbimage.c:(.text+0x19aa): undefined reference to=20 `EVP_MD_CTX_free' /usr/bin/ld: kwbimage.c:(.text+0x19c3): undefined reference to `EVP_PKEY_fr= ee' /usr/bin/ld: kwbimage.c:(.text+0x1a8f): undefined reference to=20 `EVP_MD_CTX_reset' /usr/bin/ld: kwbimage.c:(.text+0x1a97): undefined reference to=20 `EVP_MD_CTX_free' /usr/bin/ld: kwbimage.c:(.text+0x1a9f): undefined reference to `EVP_PKEY_fr= ee' /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 =E2=80=9E/home/adahl/build/u-boot/v2022.01.x=E2=80=9C = wird verlassen make: *** [Makefile:177: sub-make] Fehler 2 Greets Alex