From 2528672d3978c00559bf9c2b6ab64c5e53d78359 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 8 Jan 2025 23:43:14 +0100 Subject: [PATCH] package/cross-ldd: new package This commit introduces a new cross-ldd package which installs the cross ldd implementation that comes from Crosstool-NG, and which can be used like ldd, but when cross-compiling. We intend to use it as a replacement of host-prelink-cross for our dracut package. The cross-ldd from Crosstool-NG is in fact even recommended by the Dracut documentation, in its docs/README.cross document: To support cross-compiled binaries, a different ldd variant is needed that works on those binaries. One such ldd script is found at https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f This Github Gist in fact contains the xldd.in code from Crosstool-NG. Our package downloads the full tarball of Crosstool-NG. We tried to download only the script and the license file, but we couldn't figure out a way of downloading them *and* have the version in the filename to make sure that when doing an upgrade to a newer version, we wouldn't have a clash between old/new files having the same name (and causing conflicts with the hash verification). So in the end, we opted for download the whole tarball. Signed-off-by: Thomas Petazzoni Signed-off-by: Romain Naour --- DEVELOPERS | 1 + package/cross-ldd/cross-ldd.hash | 4 ++++ package/cross-ldd/cross-ldd.mk | 37 ++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 package/cross-ldd/cross-ldd.hash create mode 100644 package/cross-ldd/cross-ldd.mk diff --git a/DEVELOPERS b/DEVELOPERS index 47644c8d5c..9cc27025f8 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -3145,6 +3145,7 @@ F: package/cifs-utils/ F: package/cloop/ F: package/cmake/ F: package/cramfs/ +F: package/cross-ldd/ F: package/dmidecode/ F: package/double-conversion/ F: package/flashrom/ diff --git a/package/cross-ldd/cross-ldd.hash b/package/cross-ldd/cross-ldd.hash new file mode 100644 index 0000000000..b179aec5e0 --- /dev/null +++ b/package/cross-ldd/cross-ldd.hash @@ -0,0 +1,4 @@ +# From http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.26.0.tar.xz.sha512 +sha512 7834184ae5792fd347455f9f48fee826248dcb82d271954ed4304b1a18f63995ff8a2c3b817564dcf147ac7e16e02d779195b26d97eb57db27f1118a1837002a crosstool-ng-1.26.0.tar.xz +# Locally calculated +sha256 07bc0ccd386469c748c4cf6c8faca5667fbf8c4400386714287fa233acfd68ba COPYING diff --git a/package/cross-ldd/cross-ldd.mk b/package/cross-ldd/cross-ldd.mk new file mode 100644 index 0000000000..357133cdd2 --- /dev/null +++ b/package/cross-ldd/cross-ldd.mk @@ -0,0 +1,37 @@ +################################################################################ +# +# cross-ldd +# +################################################################################ + +CROSS_LDD_VERSION = 1.26.0 +CROSS_LDD_SITE = http://crosstool-ng.org/download/crosstool-ng +CROSS_LDD_SOURCE = crosstool-ng-$(CROSS_LDD_VERSION).tar.xz +CROSS_LDD_LICENSE = GPL-2.0 +CROSS_LDD_LICENSE_FILES = COPYING + +ifeq ($(BR2_ARCH_IS_64),y) +CROSS_LDD_BITNESS = 64 +else +CROSS_LDD_BITNESS = 32 +endif + +CROSS_LDD_TOOLS_PREFIX = $(patsubst %-,%,$(TARGET_CROSS)) + +define HOST_CROSS_LDD_CONFIGURE_CMDS + sed \ + -e "s%@@CT_bash@@%/usr/bin/env bash%" \ + -e "s%@@CT_VERSION@@%$(CROSS_LDD_VERSION)%" \ + -e "s%@@CT_BITS@@%$(CROSS_LDD_BITNESS)%" \ + -e "s%@@CT_sed@@%sed%" \ + -e "s%@@CT_grep@@%grep%" \ + -e "s%^prefix=.*%prefix=$(CROSS_LDD_TOOLS_PREFIX)%" \ + $(@D)/scripts/xldd.in > \ + $(@D)/scripts/xldd +endef + +define HOST_CROSS_LDD_INSTALL_CMDS + $(INSTALL) -m 0755 -D $(@D)/scripts/xldd $(TARGET_CROSS)xldd +endef + +$(eval $(host-generic-package))