[PATCH][KINETIC] UBUNTU: [Packaging] Fix dkms builds with linker @module.mod files
Dimitri John Ledkov
dimitri.ledkov at canonical.com
Thu Jul 7 12:57:19 UTC 2022
v5.19 kernel build stopped passing a long list of .o object files to
the linker. Instead it started to emit linker .o files into .mod
file. And then pass said .mod file as a single argument to the linker.
Adjust dkms-build and dkms-build--nvidia-N scripts to account for this
behaviour. Copy .mod files in addition to .o files. Post-process .mod
to remove absolute build paths, and covert them to relative object
paths.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
---
debian/scripts/dkms-build | 10 +++++++++-
debian/scripts/dkms-build--nvidia-N | 4 ++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build
index 9d78fc60e6..a658ad2699 100755
--- a/debian/scripts/dkms-build
+++ b/debian/scripts/dkms-build
@@ -144,7 +144,7 @@ shift 2
# Copy the objects.
echo "II: copying objects to '$to'"
mkdir -p "$to"
-(cd "$from" && find -name \*.o -o -name \*.o.ur-\* | cpio -Lpd "$to")
+(cd "$from" && find -name \*.o -o -name \*.o.ur-\* -o -name \*.mod | cpio -Lpd "$to")
# Call the original post_install script if there is one.
[ "$script" = '' ] && exit 0
@@ -231,6 +231,14 @@ do
"$srcdir/debian/scripts/fix-filenames" "$object" "$dkms_dir"
done
+# This assumes that .mod files are in the top level build tree
+# If there are ever .mod files in sub-directories, the dirname of objectlist needs to be stripped as well
+find "$dkms_dir/build/$dkms_package/$dkms_version/objects" -name \*.mod -print | \
+while read objectlist
+do
+ sed "s|^$dkms_dir/build/$dkms_package/$dkms_version/build/||" -i $objectlist
+done
+
# Finally see if there is a dkms-package specific post processor present. Hand
# it the original source directory, destination package directory, the objects
# as squirreled away, and the log in case it is useful. Finally pass a formed
diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N
index 12d1426c17..279e61055b 100755
--- a/debian/scripts/dkms-build--nvidia-N
+++ b/debian/scripts/dkms-build--nvidia-N
@@ -19,13 +19,13 @@ build="$( dirname "$objects" )/build"
# Copy over the objects ready for reconstruction. The objects copy contains
# the *.o files and the *.o-ur* retpoline files to allow the kernel to track
# any retpoline sequences therein. For our purposes we only want the *.o
-# files, elide the rest.
+# files, elide the rest. And .mod files for ld linking in recentish kernels.
mkdir -p "$pkgdir/bits/scripts"
(
gcc_variant1=$(gcc --version | head -1 | sed -e 's/^gcc/GCC:/')
gcc_variant2=$(gcc --version | head -1 | sed -e 's/^\(gcc\) \((.*)\) \(.*\)$/\1 version \3 \2/')
cd "$objects" || exit 1
- find -name \*.o | \
+ find -name \*.o -o -name \*.mod | \
while read file
do
cp --parents "$file" "$pkgdir/bits"
--
2.32.0
More information about the kernel-team
mailing list