[PATCH 5/9] UBUNTU: [Packaging] dkms-build--nvidia-N -- add unsigned build mode to helpers

Andy Whitcroft apw at canonical.com
Mon Mar 8 15:00:00 UTC 2021


We are going to use the helpers from linux-restricted-generate directly
and would like the option there to invoke building of an unsigned .ko
set.  Add an 'unsigned' parameter to the BUILD helper for this purpose.
Switch to that internally as this form is much clearer.

BugLink: https://bugs.launchpad.net/bugs/1918134
Signed-off-by: Andy Whitcroft <apw at canonical.com>
---
 debian/scripts/dkms-build--nvidia-N | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N
index 29e4152..b79404b 100755
--- a/debian/scripts/dkms-build--nvidia-N
+++ b/debian/scripts/dkms-build--nvidia-N
@@ -49,7 +49,10 @@ do
 done
 
 # Build helper scripts.
-grep /usr/bin/ld.bfd "$log" | grep -v scripts/genksyms/genksyms | sed -e "s@$build/@@g" >"$pkgdir/bits/BUILD"
+cat - <<'EOL' >"$pkgdir/bits/BUILD"
+[ "$1" = "unsigned" ] && signed_only=:
+EOL
+grep /usr/bin/ld.bfd "$log" | grep -v scripts/genksyms/genksyms | sed -e "s@$build/@@g" >>"$pkgdir/bits/BUILD"
 sed -e 's/.*-o  *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/CLEAN"
 
 # As the builds contain the absolute filenames as used.  Use RECONSTRUCT to
@@ -57,15 +60,20 @@ sed -e 's/.*-o  *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/C
 # up again.
 (
 	cd "$pkgdir/bits" || exit 1
-	sh ./CLEAN
-	sh ./BUILD
-	for ko in *.ko
+
+	# Add .ko handling to the CLEAN/BUILD dance.
+	for ko in "$pkgdir"/*.ko
 	do
-		echo "cat '$ko' '$ko.sig' >'../$ko'" >>"$pkgdir/bits/BUILD"
-		echo "rm -f '$ko'" >>"$pkgdir/bits/BUILD"
+		ko=$(basename "$ko")
+		echo "\$signed_only cat '$ko' '$ko.sig' >'../$ko'" >>"$pkgdir/bits/BUILD"
+		echo "\$signed_only rm -f '$ko'" >>"$pkgdir/bits/BUILD"
 		echo "rm -f '../$ko'" >>"$pkgdir/bits/CLEAN"
 	done
 
+	# Clear out anything we are not going to distribute and build unsigned .kos.
+	sh ./CLEAN
+	sh ./BUILD unsigned
+
 	if [ "$sign" = "--custom" ]; then
 		# We are building for and archive custom signing upload.  Keep everything.
 		:
-- 
2.29.2




More information about the kernel-team mailing list