* [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools
@ 2023-08-02 16:21 Ahmad Fatoum
2023-08-03 5:18 ` Alexander Shiyan
2023-08-07 7:19 ` Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-08-02 16:21 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Source files built for running on the build host can be given extra
argument via the HOSTCFLAGS variable. This is evaluates in
scripts/Makefile.host and results in adding $(HOSTCFLAGS_$(target-stem).o)
during each HOSTCC invocation.
We do that correctly at all places, except for two: rsatoc and rkimage
both use openssl, but they only have HOSTLDLIBS_rsatoc correctly set for
linking against openssl. HOSTCFLAGS_ however was incorrectly set for
the targets without the .o suffix and compiling these files only worked,
because OpenSSL was installed into a directory that's in the default
include search path. This is not a given, e.g. when building barebox
through OpenEmbedded inside a container without openssl headers, so
let's ensure pkg-config is correctly used.
Fixes: 128ad3cbe043 ("scripts: Add rsatoc tool")
Fixes: 63f612f9e0ea ("ARM: Rockchip: Add rkimage tool")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
scripts/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/Makefile b/scripts/Makefile
index 01b21a61692c..b8dd15cbf798 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -12,7 +12,7 @@ hostprogs-always-y += bareboxcrc32
hostprogs-always-y += kernel-install
hostprogs-always-$(CONFIG_QOICONV) += qoiconv
hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
-HOSTCFLAGS_rsatoc = `$(PKG_CONFIG) --cflags openssl`
+HOSTCFLAGS_rsatoc.o = `$(PKG_CONFIG) --cflags openssl`
HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
hostprogs-always-$(CONFIG_IMD) += bareboximd
hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
@@ -28,7 +28,7 @@ hostprogs-always-$(CONFIG_LAYERSCAPE_PBLIMAGE) += pblimage
hostprogs-always-$(CONFIG_STM32_IMAGE) += stm32image
hostprogs-always-$(CONFIG_RISCV) += prelink-riscv
hostprogs-always-$(CONFIG_RK_IMAGE) += rkimage
-HOSTCFLAGS_rkimage = `$(PKG_CONFIG) --cflags openssl`
+HOSTCFLAGS_rkimage.o = `$(PKG_CONFIG) --cflags openssl`
HOSTLDLIBS_rkimage = `$(PKG_CONFIG) --libs openssl`
KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
HOSTLDLIBS_mxsimage = `$(PKG_CONFIG) --libs openssl`
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools
2023-08-02 16:21 [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools Ahmad Fatoum
@ 2023-08-03 5:18 ` Alexander Shiyan
2023-08-03 10:43 ` Ahmad Fatoum
2023-08-07 7:19 ` Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Shiyan @ 2023-08-03 5:18 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
Hello.
Looks like I did pretty much the same for buildroot:
https://git.busybox.net/buildroot/commit/boot/barebox?id=624d50b20cf4bf4a67ad6274263f85927660f8c4
ср, 2 авг. 2023 г. в 19:22, Ahmad Fatoum <a.fatoum@pengutronix.de>:
>
> Source files built for running on the build host can be given extra
> argument via the HOSTCFLAGS variable. This is evaluates in
> scripts/Makefile.host and results in adding $(HOSTCFLAGS_$(target-stem).o)
> during each HOSTCC invocation.
>
> We do that correctly at all places, except for two: rsatoc and rkimage
> both use openssl, but they only have HOSTLDLIBS_rsatoc correctly set for
> linking against openssl. HOSTCFLAGS_ however was incorrectly set for
> the targets without the .o suffix and compiling these files only worked,
> because OpenSSL was installed into a directory that's in the default
> include search path. This is not a given, e.g. when building barebox
> through OpenEmbedded inside a container without openssl headers, so
> let's ensure pkg-config is correctly used.
>
> Fixes: 128ad3cbe043 ("scripts: Add rsatoc tool")
> Fixes: 63f612f9e0ea ("ARM: Rockchip: Add rkimage tool")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> scripts/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/Makefile b/scripts/Makefile
> index 01b21a61692c..b8dd15cbf798 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -12,7 +12,7 @@ hostprogs-always-y += bareboxcrc32
> hostprogs-always-y += kernel-install
> hostprogs-always-$(CONFIG_QOICONV) += qoiconv
> hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
> -HOSTCFLAGS_rsatoc = `$(PKG_CONFIG) --cflags openssl`
> +HOSTCFLAGS_rsatoc.o = `$(PKG_CONFIG) --cflags openssl`
> HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
> hostprogs-always-$(CONFIG_IMD) += bareboximd
> hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
> @@ -28,7 +28,7 @@ hostprogs-always-$(CONFIG_LAYERSCAPE_PBLIMAGE) += pblimage
> hostprogs-always-$(CONFIG_STM32_IMAGE) += stm32image
> hostprogs-always-$(CONFIG_RISCV) += prelink-riscv
> hostprogs-always-$(CONFIG_RK_IMAGE) += rkimage
> -HOSTCFLAGS_rkimage = `$(PKG_CONFIG) --cflags openssl`
> +HOSTCFLAGS_rkimage.o = `$(PKG_CONFIG) --cflags openssl`
> HOSTLDLIBS_rkimage = `$(PKG_CONFIG) --libs openssl`
> KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
> HOSTLDLIBS_mxsimage = `$(PKG_CONFIG) --libs openssl`
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools
2023-08-03 5:18 ` Alexander Shiyan
@ 2023-08-03 10:43 ` Ahmad Fatoum
0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2023-08-03 10:43 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
Hello Alexander,
On 03.08.23 07:18, Alexander Shiyan wrote:
> Hello.
> Looks like I did pretty much the same for buildroot:
> https://git.busybox.net/buildroot/commit/boot/barebox?id=624d50b20cf4bf4a67ad6274263f85927660f8c4
I had something similar in my Yocto BSP as well, so pkg-config --libs works.
It worked fine until I tried to build rsatoc inside a Ubuntu 18.04 docker container
that had no OpenSSL3 preinstalled. and I found out that pkg-config --cflags
had no effect for these two utilities. This is fixed by this patch.
Cheers,
Ahmad
>
> ср, 2 авг. 2023 г. в 19:22, Ahmad Fatoum <a.fatoum@pengutronix.de>:
>>
>> Source files built for running on the build host can be given extra
>> argument via the HOSTCFLAGS variable. This is evaluates in
>> scripts/Makefile.host and results in adding $(HOSTCFLAGS_$(target-stem).o)
>> during each HOSTCC invocation.
>>
>> We do that correctly at all places, except for two: rsatoc and rkimage
>> both use openssl, but they only have HOSTLDLIBS_rsatoc correctly set for
>> linking against openssl. HOSTCFLAGS_ however was incorrectly set for
>> the targets without the .o suffix and compiling these files only worked,
>> because OpenSSL was installed into a directory that's in the default
>> include search path. This is not a given, e.g. when building barebox
>> through OpenEmbedded inside a container without openssl headers, so
>> let's ensure pkg-config is correctly used.
>>
>> Fixes: 128ad3cbe043 ("scripts: Add rsatoc tool")
>> Fixes: 63f612f9e0ea ("ARM: Rockchip: Add rkimage tool")
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>> scripts/Makefile | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/Makefile b/scripts/Makefile
>> index 01b21a61692c..b8dd15cbf798 100644
>> --- a/scripts/Makefile
>> +++ b/scripts/Makefile
>> @@ -12,7 +12,7 @@ hostprogs-always-y += bareboxcrc32
>> hostprogs-always-y += kernel-install
>> hostprogs-always-$(CONFIG_QOICONV) += qoiconv
>> hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
>> -HOSTCFLAGS_rsatoc = `$(PKG_CONFIG) --cflags openssl`
>> +HOSTCFLAGS_rsatoc.o = `$(PKG_CONFIG) --cflags openssl`
>> HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
>> hostprogs-always-$(CONFIG_IMD) += bareboximd
>> hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
>> @@ -28,7 +28,7 @@ hostprogs-always-$(CONFIG_LAYERSCAPE_PBLIMAGE) += pblimage
>> hostprogs-always-$(CONFIG_STM32_IMAGE) += stm32image
>> hostprogs-always-$(CONFIG_RISCV) += prelink-riscv
>> hostprogs-always-$(CONFIG_RK_IMAGE) += rkimage
>> -HOSTCFLAGS_rkimage = `$(PKG_CONFIG) --cflags openssl`
>> +HOSTCFLAGS_rkimage.o = `$(PKG_CONFIG) --cflags openssl`
>> HOSTLDLIBS_rkimage = `$(PKG_CONFIG) --libs openssl`
>> KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
>> HOSTLDLIBS_mxsimage = `$(PKG_CONFIG) --libs openssl`
>> --
>> 2.39.2
>>
>>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools
2023-08-02 16:21 [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools Ahmad Fatoum
2023-08-03 5:18 ` Alexander Shiyan
@ 2023-08-07 7:19 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2023-08-07 7:19 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Wed, Aug 02, 2023 at 06:21:08PM +0200, Ahmad Fatoum wrote:
> Source files built for running on the build host can be given extra
> argument via the HOSTCFLAGS variable. This is evaluates in
> scripts/Makefile.host and results in adding $(HOSTCFLAGS_$(target-stem).o)
> during each HOSTCC invocation.
>
> We do that correctly at all places, except for two: rsatoc and rkimage
> both use openssl, but they only have HOSTLDLIBS_rsatoc correctly set for
> linking against openssl. HOSTCFLAGS_ however was incorrectly set for
> the targets without the .o suffix and compiling these files only worked,
> because OpenSSL was installed into a directory that's in the default
> include search path. This is not a given, e.g. when building barebox
> through OpenEmbedded inside a container without openssl headers, so
> let's ensure pkg-config is correctly used.
>
> Fixes: 128ad3cbe043 ("scripts: Add rsatoc tool")
> Fixes: 63f612f9e0ea ("ARM: Rockchip: Add rkimage tool")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> scripts/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/scripts/Makefile b/scripts/Makefile
> index 01b21a61692c..b8dd15cbf798 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -12,7 +12,7 @@ hostprogs-always-y += bareboxcrc32
> hostprogs-always-y += kernel-install
> hostprogs-always-$(CONFIG_QOICONV) += qoiconv
> hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
> -HOSTCFLAGS_rsatoc = `$(PKG_CONFIG) --cflags openssl`
> +HOSTCFLAGS_rsatoc.o = `$(PKG_CONFIG) --cflags openssl`
> HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
> hostprogs-always-$(CONFIG_IMD) += bareboximd
> hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
> @@ -28,7 +28,7 @@ hostprogs-always-$(CONFIG_LAYERSCAPE_PBLIMAGE) += pblimage
> hostprogs-always-$(CONFIG_STM32_IMAGE) += stm32image
> hostprogs-always-$(CONFIG_RISCV) += prelink-riscv
> hostprogs-always-$(CONFIG_RK_IMAGE) += rkimage
> -HOSTCFLAGS_rkimage = `$(PKG_CONFIG) --cflags openssl`
> +HOSTCFLAGS_rkimage.o = `$(PKG_CONFIG) --cflags openssl`
> HOSTLDLIBS_rkimage = `$(PKG_CONFIG) --libs openssl`
> KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
> HOSTLDLIBS_mxsimage = `$(PKG_CONFIG) --libs openssl`
> --
> 2.39.2
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-07 7:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-02 16:21 [PATCH master] scripts: fix pkg-config use for rsatoc/rkimage hosttools Ahmad Fatoum
2023-08-03 5:18 ` Alexander Shiyan
2023-08-03 10:43 ` Ahmad Fatoum
2023-08-07 7:19 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox