From 3424be90c7acddf8ceea22c86f1e4cdd215eb01c Mon Sep 17 00:00:00 2001 From: Andreas Gnau <andreas.gnau@iopsys.eu> Date: Wed, 18 Oct 2023 09:43:21 +0200 Subject: [PATCH] bcmkernel: Put libs in separate directory Install libraries into separate directory (/usr)/lib/broadcom. This is to enable a clean separation between BCM-SDK-built libraries and OpenWrt-built built libraries. More importantly, it avoids binary compatibility issues between the two worlds. As a side-effect is will also enable future enhancements such as hardfloat or 64-bit user space on the IOWRT side, which is not supported in the BCM SDK. Set the RUNPATH of all the binaries in the OpenWrt Makefile after stripping, because OpenWrt will remove the RUNPATH during stripping, otherwise.. Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu> --- bcmkernel/Makefile | 4 +++- bcmkernel/scripts/rstrip_and_set_rpath.sh | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 bcmkernel/scripts/rstrip_and_set_rpath.sh diff --git a/bcmkernel/Makefile b/bcmkernel/Makefile index f1f048a..2d6cea7 100644 --- a/bcmkernel/Makefile +++ b/bcmkernel/Makefile @@ -2,7 +2,7 @@ # Primary/common bcmkernel makefile for all versions of Broadcom SDKs # -PKG_SOURCE_VERSION := c14e656a03c2d3ff5f58b51ba0ffa2244138fcbc +PKG_SOURCE_VERSION := bd547ddcecdf8b560ae355598200bfe9c14760cd BCM_KERNEL_VERSION := 4.19.235 BRCM_SDK_VERSION := 504041 @@ -112,6 +112,8 @@ define CheckDependencies endef # OpenWRT variables +# Override OpenWrt stripping: Run OpenWrt stripping but right after set DT_RUNPATH to account load libs from (/usr)/lib/broadcom +RSTRIP:=$(subst $(SCRIPT_DIR)/rstrip.sh,RSTRIP_SH=$(SCRIPT_DIR)/rstrip.sh $(TOPDIR)/package/feeds/broadcom/bcmkernel/scripts/rstrip_and_set_rpath.sh,$(RSTRIP)) MAKE_FLAGS += KDIR="$(KDIR)" # bcmkernel variables diff --git a/bcmkernel/scripts/rstrip_and_set_rpath.sh b/bcmkernel/scripts/rstrip_and_set_rpath.sh new file mode 100755 index 0000000..2a1b51c --- /dev/null +++ b/bcmkernel/scripts/rstrip_and_set_rpath.sh @@ -0,0 +1,15 @@ +#!/bin/sh -eux +"$RSTRIP_SH" "$@" +# TODO: find out why broadcom wl utility does not run after patching the RUNPATH. Maybe patchelf bug? +find -D exec \ + "$@" \ + -type f \ + -not -name 'ld-linux*.so*' \ + -not -name '*.sh' \ + -not -name wl.brcm \ + '(' \ + -name '*.so' \ + -or \ + -executable \ + ')' \ + -execdir "$PATCHELF" --no-default-lib --add-rpath '/${LIB}/broadcom:/usr/${LIB}/broadcom' '{}' ';' || true -- GitLab