Files
buildroot/package/dracut/dracut_wrapper.in
Thomas Petazzoni b171b7bd78 package/dracut: use host-cross-ldd instead of host-prelink-cross
This commit reworks the dracut package to use the cross-ldd installed
by host-cross-ldd instead of prelink-rtld installed by
host-prelink-cross.

Indeed, prelink-cross is not maintained upstream, and its dependency
on host-libiberty causes problems in Buildroot with other packages.

The only change needed is that the dracut_wrapper script needs to be
generated, as we now need to know the prefix of the cross-compilation
tool (TARGET_CROSS).

Tested by running the dracut tests of the test suite.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
2025-01-14 23:31:13 +01:00

49 lines
1.0 KiB
Bash

#!/bin/bash
set -e
# Find the --sysroot argument
sysroot=
next_arg=false
for arg; do
if ${next_arg}; then
next_arg=false
sysroot="${arg}"
continue # not break, in case there are more than one
fi
case "${arg}" in
(--sysroot|-r)
next_arg=true
continue
;;
(--sysroot=*)
sysroot="${arg#*=}"
continue # not break, in case there are more than one
;;
(-r?*)
sysroot="${arg#-r}"
continue # not break, in case there are more than one
;;
esac
done
if [ -z "${sysroot}" ]; then
echo "${0}: --sysroot argument must be given." 1>&2
exit 1
fi
topdir="$(dirname "$(realpath "$(dirname "${0}")")")"
DRACUT_LDD="$(mktemp /tmp/dracut-ldd.XXXXXX)"
cat >"${DRACUT_LDD}" <<EOL
#!/bin/bash
@@TARGET_CROSS@@xldd --root='${sysroot}' \${1}
EOL
chmod +x "${DRACUT_LDD}"
export DRACUT_LDD
export DRACUT_INSTALL="${topdir}/lib/dracut/dracut-install"
export DRACUT_LDCONFIG=/bin/true
export dracutbasedir="${topdir}/lib/dracut"
(exec "${topdir}/bin/dracut.real" "${@}")
if [ -n "${DRACUT_LDD}" ]; then
rm -f "${DRACUT_LDD}"
fi