All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
@ 2023-12-08 17:42 Louis Chauvet via buildroot
  2023-12-08 21:29 ` Yann E. MORIN
  2024-01-03 12:01 ` Peter Korsgaard
  0 siblings, 2 replies; 8+ messages in thread
From: Louis Chauvet via buildroot @ 2023-12-08 17:42 UTC (permalink / raw)
  To: buildroot; +Cc: Louis Chauvet, Thomas Petazzoni, Sergey Matyukevich

The arm-trusted-firmware package builds a host tool called "fiptool",
which is used during the build process of arm-trusted-firmware
itself. This tool links against the OpenSSL host library, and
therefore needs to be built with the correct RPATH pointing to
$HOST_DIR/lib.

This is why commit a957d9a90ade4194dffe3eb2fc0136bc5d077c28
("boot/arm-trusted-firmware: build fiptool separately with dependency
o n host-openssl") added the ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
variable, which builds the fiptool tool first, with the right
variables set, before invoking the full build of TF-A. This ensured
that fiptool was built with the correct RPATH.

However, more recent versions of TF-A have modified their Makefile
machinery, and fiptool is being rebuilt even if it was built
before. Unfortunately, this rebuild is no longer done with the right
flags, so we end up with a fiptool binary that no longer has the right
RPATH, and fiptool fails to find the OpenSSL libraries from
$HOST_DIR/lib.

In order to fix this, we take a different approach: we do not build
fiptool separately first, but we inject the necessary flags through
the HOSTCC variable. Indeed, there's no HOST_LDFLAGS or HOST_LDLIBS
variable or similar that would allow us to pass the -Wl,-rpath flag
that is needed. Shoe-horning this flag into HOSTCC gets the job done,
and actually simplifies our arm-trusted-firmware.mk.

This patch break the compatibility with version prior to 1.4 (upstream
commit 72610c4102990 ("build: Introduce HOSTCC flag")). v1.4 is very old
(July 2017), not used anymore in-tree and probably not used anymore
outside the tree.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
Previous version:
   https://lore.kernel.org/buildroot/20231206164437.22191-1-louis.chauvet@bootlin.com/

Changes v1->v2:
   Update commit log about compatibilty


 .../arm-trusted-firmware/arm-trusted-firmware.mk | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 049beed36a91..bed873a1821c 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -63,7 +63,8 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
 	BUILD_STRING=$(ARM_TRUSTED_FIRMWARE_VERSION) \
 	$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
 	PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM) \
-	TARGET_BOARD=$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)
+	TARGET_BOARD=$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD) \
+	HOSTCC="$(HOSTCC) $(HOST_LDFLAGS)"
 
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP),y)
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
@@ -147,18 +148,6 @@ ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
 ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += fip
 ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-openssl
-# fiptool only exists in newer (>= 1.3) versions of ATF, so we build
-# it conditionally. We need to explicitly build it as it requires
-# OpenSSL, and therefore needs to be passed proper variables to find
-# the host OpenSSL.
-define ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
-	if test -d $(@D)/tools/fiptool; then \
-		$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/tools/fiptool \
-			$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
-			CPPFLAGS="$(HOST_CPPFLAGS)" \
-			LDLIBS="$(HOST_LDFLAGS) -lcrypto" ; \
-	fi
-endef
 endif
 
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_RCW),y)
@@ -206,7 +195,6 @@ define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
 	$(if $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH),
 		cp -f $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH) $(@D)/fdts/
 	)
-	$(ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL)
 	$(ARM_TRUSTED_FIRMWARE_MAKE_ENV) $(MAKE) -C $(@D) \
 		$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
 		$(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
-- 
2.41.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2023-12-08 17:42 [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool Louis Chauvet via buildroot
@ 2023-12-08 21:29 ` Yann E. MORIN
  2024-01-03 12:01 ` Peter Korsgaard
  1 sibling, 0 replies; 8+ messages in thread
From: Yann E. MORIN @ 2023-12-08 21:29 UTC (permalink / raw)
  To: Louis Chauvet; +Cc: Sergey Matyukevich, Thomas Petazzoni, buildroot

Louis, All,

On 2023-12-08 18:42 +0100, Louis Chauvet via buildroot spake thusly:
> The arm-trusted-firmware package builds a host tool called "fiptool",
> which is used during the build process of arm-trusted-firmware
> itself. This tool links against the OpenSSL host library, and
> therefore needs to be built with the correct RPATH pointing to
> $HOST_DIR/lib.
> 
> This is why commit a957d9a90ade4194dffe3eb2fc0136bc5d077c28
> ("boot/arm-trusted-firmware: build fiptool separately with dependency
> o n host-openssl") added the ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
> variable, which builds the fiptool tool first, with the right
> variables set, before invoking the full build of TF-A. This ensured
> that fiptool was built with the correct RPATH.
> 
> However, more recent versions of TF-A have modified their Makefile
> machinery, and fiptool is being rebuilt even if it was built
> before. Unfortunately, this rebuild is no longer done with the right
> flags, so we end up with a fiptool binary that no longer has the right
> RPATH, and fiptool fails to find the OpenSSL libraries from
> $HOST_DIR/lib.
> 
> In order to fix this, we take a different approach: we do not build
> fiptool separately first, but we inject the necessary flags through
> the HOSTCC variable. Indeed, there's no HOST_LDFLAGS or HOST_LDLIBS
> variable or similar that would allow us to pass the -Wl,-rpath flag
> that is needed. Shoe-horning this flag into HOSTCC gets the job done,
> and actually simplifies our arm-trusted-firmware.mk.
> 
> This patch break the compatibility with version prior to 1.4 (upstream
> commit 72610c4102990 ("build: Introduce HOSTCC flag")). v1.4 is very old
> (July 2017), not used anymore in-tree and probably not used anymore
> outside the tree.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> Previous version:
>    https://lore.kernel.org/buildroot/20231206164437.22191-1-louis.chauvet@bootlin.com/
> 
> Changes v1->v2:
>    Update commit log about compatibilty
> 
> 
>  .../arm-trusted-firmware/arm-trusted-firmware.mk | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> index 049beed36a91..bed873a1821c 100644
> --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> @@ -63,7 +63,8 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
>  	BUILD_STRING=$(ARM_TRUSTED_FIRMWARE_VERSION) \
>  	$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
>  	PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM) \
> -	TARGET_BOARD=$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)
> +	TARGET_BOARD=$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD) \
> +	HOSTCC="$(HOSTCC) $(HOST_LDFLAGS)"
>  
>  ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP),y)
>  ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
> @@ -147,18 +148,6 @@ ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
>  ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
>  ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += fip
>  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-openssl
> -# fiptool only exists in newer (>= 1.3) versions of ATF, so we build
> -# it conditionally. We need to explicitly build it as it requires
> -# OpenSSL, and therefore needs to be passed proper variables to find
> -# the host OpenSSL.
> -define ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
> -	if test -d $(@D)/tools/fiptool; then \
> -		$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/tools/fiptool \
> -			$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
> -			CPPFLAGS="$(HOST_CPPFLAGS)" \
> -			LDLIBS="$(HOST_LDFLAGS) -lcrypto" ; \
> -	fi
> -endef
>  endif
>  
>  ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_RCW),y)
> @@ -206,7 +195,6 @@ define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
>  	$(if $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH),
>  		cp -f $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH) $(@D)/fdts/
>  	)
> -	$(ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL)
>  	$(ARM_TRUSTED_FIRMWARE_MAKE_ENV) $(MAKE) -C $(@D) \
>  		$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
>  		$(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
> -- 
> 2.41.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2023-12-08 17:42 [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool Louis Chauvet via buildroot
  2023-12-08 21:29 ` Yann E. MORIN
@ 2024-01-03 12:01 ` Peter Korsgaard
  2024-01-03 12:10   ` Baruch Siach via buildroot
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2024-01-03 12:01 UTC (permalink / raw)
  To: Louis Chauvet via buildroot
  Cc: Louis Chauvet, Sergey Matyukevich, Thomas Petazzoni

>>>>> "Louis" == Louis Chauvet via buildroot <buildroot@buildroot.org> writes:

 > The arm-trusted-firmware package builds a host tool called "fiptool",
 > which is used during the build process of arm-trusted-firmware
 > itself. This tool links against the OpenSSL host library, and
 > therefore needs to be built with the correct RPATH pointing to
 > $HOST_DIR/lib.

 > This is why commit a957d9a90ade4194dffe3eb2fc0136bc5d077c28
 > ("boot/arm-trusted-firmware: build fiptool separately with dependency
 > o n host-openssl") added the ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
 > variable, which builds the fiptool tool first, with the right
 > variables set, before invoking the full build of TF-A. This ensured
 > that fiptool was built with the correct RPATH.

 > However, more recent versions of TF-A have modified their Makefile
 > machinery, and fiptool is being rebuilt even if it was built
 > before. Unfortunately, this rebuild is no longer done with the right
 > flags, so we end up with a fiptool binary that no longer has the right
 > RPATH, and fiptool fails to find the OpenSSL libraries from
 > $HOST_DIR/lib.

 > In order to fix this, we take a different approach: we do not build
 > fiptool separately first, but we inject the necessary flags through
 > the HOSTCC variable. Indeed, there's no HOST_LDFLAGS or HOST_LDLIBS
 > variable or similar that would allow us to pass the -Wl,-rpath flag
 > that is needed. Shoe-horning this flag into HOSTCC gets the job done,
 > and actually simplifies our arm-trusted-firmware.mk.

 > This patch break the compatibility with version prior to 1.4 (upstream
 > commit 72610c4102990 ("build: Introduce HOSTCC flag")). v1.4 is very old
 > (July 2017), not used anymore in-tree and probably not used anymore
 > outside the tree.

 > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
 > Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > ---
 > Previous version:
 >    https://lore.kernel.org/buildroot/20231206164437.22191-1-louis.chauvet@bootlin.com/

 > Changes v1->v2:
 >    Update commit log about compatibilty

Committed to 2023.02.x and 2023.11.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2024-01-03 12:01 ` Peter Korsgaard
@ 2024-01-03 12:10   ` Baruch Siach via buildroot
  2024-01-03 12:29     ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Baruch Siach via buildroot @ 2024-01-03 12:10 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Köry Maincent, Louis Chauvet, Thomas Petazzoni,
	Sergey Matyukevich, buildroot

Hi Peter,

On Wed, Jan 03 2024, Peter Korsgaard wrote:
>>>>>> "Louis" == Louis Chauvet via buildroot <buildroot@buildroot.org> writes:
>
>  > The arm-trusted-firmware package builds a host tool called "fiptool",
>  > which is used during the build process of arm-trusted-firmware
>  > itself. This tool links against the OpenSSL host library, and
>  > therefore needs to be built with the correct RPATH pointing to
>  > $HOST_DIR/lib.
>
>  > This is why commit a957d9a90ade4194dffe3eb2fc0136bc5d077c28
>  > ("boot/arm-trusted-firmware: build fiptool separately with dependency
>  > o n host-openssl") added the ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
>  > variable, which builds the fiptool tool first, with the right
>  > variables set, before invoking the full build of TF-A. This ensured
>  > that fiptool was built with the correct RPATH.
>
>  > However, more recent versions of TF-A have modified their Makefile
>  > machinery, and fiptool is being rebuilt even if it was built
>  > before. Unfortunately, this rebuild is no longer done with the right
>  > flags, so we end up with a fiptool binary that no longer has the right
>  > RPATH, and fiptool fails to find the OpenSSL libraries from
>  > $HOST_DIR/lib.
>
>  > In order to fix this, we take a different approach: we do not build
>  > fiptool separately first, but we inject the necessary flags through
>  > the HOSTCC variable. Indeed, there's no HOST_LDFLAGS or HOST_LDLIBS
>  > variable or similar that would allow us to pass the -Wl,-rpath flag
>  > that is needed. Shoe-horning this flag into HOSTCC gets the job done,
>  > and actually simplifies our arm-trusted-firmware.mk.
>
>  > This patch break the compatibility with version prior to 1.4 (upstream
>  > commit 72610c4102990 ("build: Introduce HOSTCC flag")). v1.4 is very old
>  > (July 2017), not used anymore in-tree and probably not used anymore
>  > outside the tree.
>
>  > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
>  > Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>  > ---
>  > Previous version:
>  >    https://lore.kernel.org/buildroot/20231206164437.22191-1-louis.chauvet@bootlin.com/
>
>  > Changes v1->v2:
>  >    Update commit log about compatibilty
>
> Committed to 2023.02.x and 2023.11.x, thanks.

Köry Maincent reported that this commit breaks fiptool build for some
platforms.

  https://lore.kernel.org/all/20231224162254.589b395c@kmaincent-XPS-13-7390/

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2024-01-03 12:10   ` Baruch Siach via buildroot
@ 2024-01-03 12:29     ` Peter Korsgaard
  2024-01-03 12:39       ` Baruch Siach via buildroot
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2024-01-03 12:29 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Köry Maincent, Louis Chauvet, Thomas Petazzoni,
	Sergey Matyukevich, buildroot

>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:

 > Hi Peter,
 > On Wed, Jan 03 2024, Peter Korsgaard wrote:
 >>>>>>> "Louis" == Louis Chauvet via buildroot <buildroot@buildroot.org> writes:
 >> 
 >> > The arm-trusted-firmware package builds a host tool called "fiptool",
 >> > which is used during the build process of arm-trusted-firmware
 >> > itself. This tool links against the OpenSSL host library, and
 >> > therefore needs to be built with the correct RPATH pointing to
 >> > $HOST_DIR/lib.
 >> 
 >> > This is why commit a957d9a90ade4194dffe3eb2fc0136bc5d077c28
 >> > ("boot/arm-trusted-firmware: build fiptool separately with dependency
 >> > o n host-openssl") added the ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
 >> > variable, which builds the fiptool tool first, with the right
 >> > variables set, before invoking the full build of TF-A. This ensured
 >> > that fiptool was built with the correct RPATH.
 >> 
 >> > However, more recent versions of TF-A have modified their Makefile
 >> > machinery, and fiptool is being rebuilt even if it was built
 >> > before. Unfortunately, this rebuild is no longer done with the right
 >> > flags, so we end up with a fiptool binary that no longer has the right
 >> > RPATH, and fiptool fails to find the OpenSSL libraries from
 >> > $HOST_DIR/lib.
 >> 
 >> > In order to fix this, we take a different approach: we do not build
 >> > fiptool separately first, but we inject the necessary flags through
 >> > the HOSTCC variable. Indeed, there's no HOST_LDFLAGS or HOST_LDLIBS
 >> > variable or similar that would allow us to pass the -Wl,-rpath flag
 >> > that is needed. Shoe-horning this flag into HOSTCC gets the job done,
 >> > and actually simplifies our arm-trusted-firmware.mk.
 >> 
 >> > This patch break the compatibility with version prior to 1.4 (upstream
 >> > commit 72610c4102990 ("build: Introduce HOSTCC flag")). v1.4 is very old
 >> > (July 2017), not used anymore in-tree and probably not used anymore
 >> > outside the tree.
 >> 
 >> > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
 >> > Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 >> > ---
 >> > Previous version:
 >> >    https://lore.kernel.org/buildroot/20231206164437.22191-1-louis.chauvet@bootlin.com/
 >> 
 >> > Changes v1->v2:
 >> >    Update commit log about compatibilty
 >> 
 >> Committed to 2023.02.x and 2023.11.x, thanks.

 > Köry Maincent reported that this commit breaks fiptool build for some
 > platforms.

 >   https://lore.kernel.org/all/20231224162254.589b395c@kmaincent-XPS-13-7390/

Hmm, yes. I didn't see any communication about this since then or
defconfig failures, but I may have missed them. Louis?

I'll do a test build of octavo_osd32mp1_red_defconfig on 2023.02.x here
on a machine without libssl-dev.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2024-01-03 12:29     ` Peter Korsgaard
@ 2024-01-03 12:39       ` Baruch Siach via buildroot
  2024-01-03 12:46         ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 8+ messages in thread
From: Baruch Siach via buildroot @ 2024-01-03 12:39 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Köry Maincent, Louis Chauvet, Thomas Petazzoni,
	Sergey Matyukevich, buildroot

Hi Peter,

On Wed, Jan 03 2024, Peter Korsgaard wrote:
>>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
>
>  > Hi Peter,
>  > On Wed, Jan 03 2024, Peter Korsgaard wrote:
>  >>>>>>> "Louis" == Louis Chauvet via buildroot <buildroot@buildroot.org> writes:
>  >> 
>  >> > The arm-trusted-firmware package builds a host tool called "fiptool",
>  >> > which is used during the build process of arm-trusted-firmware
>  >> > itself. This tool links against the OpenSSL host library, and
>  >> > therefore needs to be built with the correct RPATH pointing to
>  >> > $HOST_DIR/lib.
>  >> 
>  >> > This is why commit a957d9a90ade4194dffe3eb2fc0136bc5d077c28
>  >> > ("boot/arm-trusted-firmware: build fiptool separately with dependency
>  >> > o n host-openssl") added the ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL
>  >> > variable, which builds the fiptool tool first, with the right
>  >> > variables set, before invoking the full build of TF-A. This ensured
>  >> > that fiptool was built with the correct RPATH.
>  >> 
>  >> > However, more recent versions of TF-A have modified their Makefile
>  >> > machinery, and fiptool is being rebuilt even if it was built
>  >> > before. Unfortunately, this rebuild is no longer done with the right
>  >> > flags, so we end up with a fiptool binary that no longer has the right
>  >> > RPATH, and fiptool fails to find the OpenSSL libraries from
>  >> > $HOST_DIR/lib.
>  >> 
>  >> > In order to fix this, we take a different approach: we do not build
>  >> > fiptool separately first, but we inject the necessary flags through
>  >> > the HOSTCC variable. Indeed, there's no HOST_LDFLAGS or HOST_LDLIBS
>  >> > variable or similar that would allow us to pass the -Wl,-rpath flag
>  >> > that is needed. Shoe-horning this flag into HOSTCC gets the job done,
>  >> > and actually simplifies our arm-trusted-firmware.mk.
>  >> 
>  >> > This patch break the compatibility with version prior to 1.4 (upstream
>  >> > commit 72610c4102990 ("build: Introduce HOSTCC flag")). v1.4 is very old
>  >> > (July 2017), not used anymore in-tree and probably not used anymore
>  >> > outside the tree.
>  >> 
>  >> > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
>  >> > Co-authored-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>  >> > ---
>  >> > Previous version:
>  >> >    https://lore.kernel.org/buildroot/20231206164437.22191-1-louis.chauvet@bootlin.com/
>  >> 
>  >> > Changes v1->v2:
>  >> >    Update commit log about compatibilty
>  >> 
>  >> Committed to 2023.02.x and 2023.11.x, thanks.
>
>  > Köry Maincent reported that this commit breaks fiptool build for some
>  > platforms.
>
>  >   https://lore.kernel.org/all/20231224162254.589b395c@kmaincent-XPS-13-7390/
>
> Hmm, yes. I didn't see any communication about this since then or
> defconfig failures, but I may have missed them. Louis?

The last defconfig test report shows these failures:

  https://lists.buildroot.org/pipermail/buildroot/2023-December/681835.html

For example (solidrun_macchiatobin):

  https://gitlab.com/buildroot.org/buildroot/-/jobs/5834758777

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2024-01-03 12:39       ` Baruch Siach via buildroot
@ 2024-01-03 12:46         ` Thomas Petazzoni via buildroot
  2024-01-03 13:31           ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-01-03 12:46 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Köry Maincent, Louis Chauvet, Sergey Matyukevich, buildroot

On Wed, 03 Jan 2024 14:39:18 +0200
Baruch Siach <baruch@tkos.co.il> wrote:

> The last defconfig test report shows these failures:
> 
>   https://lists.buildroot.org/pipermail/buildroot/2023-December/681835.html
> 
> For example (solidrun_macchiatobin):
> 
>   https://gitlab.com/buildroot.org/buildroot/-/jobs/5834758777

I guess:

	HOSTCC="$(HOSTCC) $(HOST_LDFLAGS)"

should be:

	HOSTCC="$(HOSTCC) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)"

However, I don't understand how it could have worked for us without
this.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool
  2024-01-03 12:46         ` Thomas Petazzoni via buildroot
@ 2024-01-03 13:31           ` Peter Korsgaard
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2024-01-03 13:31 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Köry Maincent, Louis Chauvet, Sergey Matyukevich, buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > On Wed, 03 Jan 2024 14:39:18 +0200
 > Baruch Siach <baruch@tkos.co.il> wrote:

 >> The last defconfig test report shows these failures:
 >> 
 >> https://lists.buildroot.org/pipermail/buildroot/2023-December/681835.html
 >> 
 >> For example (solidrun_macchiatobin):
 >> 
 >> https://gitlab.com/buildroot.org/buildroot/-/jobs/5834758777

 > I guess:

 > 	HOSTCC="$(HOSTCC) $(HOST_LDFLAGS)"

 > should be:

 > 	HOSTCC="$(HOSTCC) $(HOST_CPPFLAGS) $(HOST_LDFLAGS)"

 > However, I don't understand how it could have worked for us without
 > this.

I can confirm that the build fails with the current patch and works
after adding HOST_CPPFLAGS.

Can you send a patch for it for master?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-01-03 13:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-08 17:42 [Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool Louis Chauvet via buildroot
2023-12-08 21:29 ` Yann E. MORIN
2024-01-03 12:01 ` Peter Korsgaard
2024-01-03 12:10   ` Baruch Siach via buildroot
2024-01-03 12:29     ` Peter Korsgaard
2024-01-03 12:39       ` Baruch Siach via buildroot
2024-01-03 12:46         ` Thomas Petazzoni via buildroot
2024-01-03 13:31           ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.