[Buildroot] [PATCH v2] boot/arm-trusted-firmware: fix the RPATH of fiptool

Peter Korsgaard peter at korsgaard.com
Wed Jan 3 12:29:03 UTC 2024


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

 > Hi Peter,
 > On Wed, Jan 03 2024, Peter Korsgaard wrote:
 >>>>>>> "Louis" == Louis Chauvet via buildroot <buildroot at 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 at bootlin.com>
 >> > Co-authored-by: Thomas Petazzoni <thomas.petazzoni at 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



More information about the buildroot mailing list