summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:20:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:20:55 +0000
commit751abe5af6e60af060ea7979512574d903a49eb0 (patch)
tree991d21305c4f60a4b0c13964436f8b8e08fee34b /debian/patches
parentAdding upstream version 3.0.10. (diff)
downloaddkms-debian.tar.xz
dkms-debian.zip
Adding debian version 3.0.10-8+deb12u1.debian/3.0.10-8+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/0001-default-built_module_name-0-to-PACKAGE_NAME.patch24
-rw-r--r--debian/patches/0002-man-clarify-dkms-add-arguments.patch55
-rw-r--r--debian/patches/0003-print-a-warning-if-proc-is-not-mounted.patch46
-rw-r--r--debian/patches/0004-use-echo-n-as-fallback-for-log_daemon_msg.patch33
-rw-r--r--debian/patches/0005-use-log_action_msg-instead-of-log_daemon_msg-w-o-log.patch33
-rw-r--r--debian/patches/0006-dkms_autoinstaller-skip-autoinstall-if-headers-are-m.patch62
-rw-r--r--debian/patches/0007-prepare_build-use-return-code-77-if-skipping-due-to-.patch66
-rw-r--r--debian/patches/BUILD_EXCLUSIVE_CONFIG.patch41
-rw-r--r--debian/patches/fix-builtin-archive-dkms-coinstallation.patch45
-rw-r--r--debian/patches/messaging.patch16
-rw-r--r--debian/patches/reinstate-enroll.patch16
-rw-r--r--debian/patches/series14
-rw-r--r--debian/patches/spelling.patch16
-rw-r--r--debian/patches/version-sort.patch22
14 files changed, 489 insertions, 0 deletions
diff --git a/debian/patches/0001-default-built_module_name-0-to-PACKAGE_NAME.patch b/debian/patches/0001-default-built_module_name-0-to-PACKAGE_NAME.patch
new file mode 100644
index 0000000..ae73d88
--- /dev/null
+++ b/debian/patches/0001-default-built_module_name-0-to-PACKAGE_NAME.patch
@@ -0,0 +1,24 @@
+From 78bc5aa693ec9928778836469b815d2da5434e19 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Mon, 27 Mar 2023 01:39:01 +0200
+Subject: [PATCH] default built_module_name[0] to $PACKAGE_NAME
+
+$module is not yet set in add_source_tree
+---
+ dkms.in | 2 +-
+ run_test.sh | 13 ++++++++-----
+ 2 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/dkms.in b/dkms.in
+index 25d4b9e..6069e82 100644
+--- a/dkms.in
++++ b/dkms.in
+@@ -540,7 +540,7 @@ read_conf()
+ # If unset, set by defaults
+ [[ ! ${built_module_name[$index]} ]] && \
+ ((${#DEST_MODULE_LOCATION[@]} == 1)) && \
+- built_module_name[$index]=$module
++ built_module_name[$index]=$PACKAGE_NAME
+ [[ ! ${dest_module_name[$index]} ]] && \
+ dest_module_name[$index]=${built_module_name[$index]}
+ [[ ${built_module_location[$index]} && \
diff --git a/debian/patches/0002-man-clarify-dkms-add-arguments.patch b/debian/patches/0002-man-clarify-dkms-add-arguments.patch
new file mode 100644
index 0000000..16a1693
--- /dev/null
+++ b/debian/patches/0002-man-clarify-dkms-add-arguments.patch
@@ -0,0 +1,55 @@
+From 93461d6737f79bf53be3ce2e2b3b613fe1795aff Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Thu, 30 Mar 2023 18:48:01 +0200
+Subject: [PATCH] man: clarify 'dkms add' arguments
+
+---
+ dkms.8.in | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/dkms.8.in b/dkms.8.in
+index a3af903..47655e6 100644
+--- a/dkms.8.in
++++ b/dkms.8.in
+@@ -55,13 +55,16 @@ is a framework which allows kernel modules to be dynamically built
+ for each kernel on your system in a simplified and organized fashion.
+ .SH ACTIONS
+ .SY add
+-.OP module/module\-version
+-.OP /path/to/source\-tree
+-.OP /path/to/tarball.tar
++.OP "module/module\-version | /path/to/source\-tree | /path/to/tarball.tar"
+ .YS
+ .IP "" 4
+ Adds a module/module\-version combination to the tree for builds and installs.
+-If module/module\-version, \-m module/module\-version, or \-m module\ \-v version are passed as options, this command
++If
++.IR module/module\-version ,
++.IR "\-m module/module\-version" ,
++or
++.I \-m module\ \-v module\-version
++are passed as options, this command
+ requires source in
+ .I /usr/src/<module>\-<module\-version>/
+ as well as a properly
+@@ -74,7 +77,7 @@ is passed as an option, and source-tree contains a
+ file, it will copy
+ .I /path/to/source\-tree
+ to
+-.I /usr/src/module\-module\-version.
++.IR /usr/src/module\-module\-version .
+ If
+ .I /path/to/tarball.tar
+ is passed, this command behaves like the
+@@ -755,7 +758,7 @@ Used by the common postinst for DKMS modules. It controls if the build should be
+ line equivalent.
+ .TP
+ .B $sign_file
+-This is the path of the
++This is the path of the
+ .I sign-file
+ kernel binary that is used to sign the kernel modules. The variable
+ .B $kernelver
+--
+2.20.1
+
diff --git a/debian/patches/0003-print-a-warning-if-proc-is-not-mounted.patch b/debian/patches/0003-print-a-warning-if-proc-is-not-mounted.patch
new file mode 100644
index 0000000..dd0ee6f
--- /dev/null
+++ b/debian/patches/0003-print-a-warning-if-proc-is-not-mounted.patch
@@ -0,0 +1,46 @@
+From 0285b2ad62086f868c23414fe46d0ccdcbe8c6db Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Fri, 31 Mar 2023 09:45:00 +0200
+Subject: [PATCH] print a warning if /proc is not mounted
+
+---
+ dkms.in | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/dkms.in b/dkms.in
+index 3f5fc41..6a52a55 100644
+--- a/dkms.in
++++ b/dkms.in
+@@ -672,7 +672,7 @@ get_module_verinfo(){
+ ;;
+ esac
+ done < <(modinfo "$1")
+-
++
+ echo -E "${ver}"
+ # Use obsolete checksum info if srcversion is not available
+ echo -E "${srcver:-$checksum}"
+@@ -767,7 +767,7 @@ check_version_sanity()
+ return 0
+ fi
+ local dkms_module=$(compressed_or_uncompressed "$dkms_tree/$module/$module_version/$1/$2/module/" "${4}")
+-
++
+ local cmp_res="$(compare_module_version "${kernels_module}" "${dkms_module}")"
+ if [[ "${cmp_res}" = ">" ]]; then
+ if [[ ! "$force" ]]; then
+@@ -2499,6 +2499,11 @@ done
+
+ # Sanity checking
+
++# The <(cmd) idiom does not work if /proc is not mounted
++if [ ! -e <(echo) ]; then
++ warn $"dkms will not function properly if /proc is not mounted."
++fi
++
+ # Error out if binaries-only is set and source-only is set
+ if [[ $binaries_only && $source_only ]]; then
+ die 8 $" You have specified both --binaries-only and --source-only." \
+--
+2.20.1
+
diff --git a/debian/patches/0004-use-echo-n-as-fallback-for-log_daemon_msg.patch b/debian/patches/0004-use-echo-n-as-fallback-for-log_daemon_msg.patch
new file mode 100644
index 0000000..d06fe3f
--- /dev/null
+++ b/debian/patches/0004-use-echo-n-as-fallback-for-log_daemon_msg.patch
@@ -0,0 +1,33 @@
+From 1d95db4b07e31848335824e3facc78dd51e11f45 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Wed, 22 Mar 2023 16:39:22 +0100
+Subject: [PATCH] use 'echo -n' as fallback for log_daemon_msg
+
+the final newline is supplied by log_end_msg
+---
+ dkms_autoinstaller | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/dkms_autoinstaller b/dkms_autoinstaller
+index 2cd31b9..bff9ac5 100755
+--- a/dkms_autoinstaller
++++ b/dkms_autoinstaller
+@@ -23,13 +23,11 @@ elif [ -f /etc/rc.d/init.d/functions ]; then
+ . /etc/rc.d/init.d/functions
+ fi
+
+-# We only have these functions on debian/ubuntu
++# We only have these functions on Debian/Ubuntu
+ # so on other distros just stub them out
+ if [ ! -f /etc/debian_version ]; then
+- alias log_daemon_msg=/bin/echo
++ alias log_daemon_msg='/bin/echo -n'
+ log_end_msg() { if [ "$1" = "0" ]; then echo " Done. "; else echo " Failed. "; fi; }
+- alias log_action_begin_msg=log_daemon_msg
+- alias log_action_end_msg=log_end_msg
+ fi
+
+ exec="/usr/sbin/dkms"
+--
+2.20.1
+
diff --git a/debian/patches/0005-use-log_action_msg-instead-of-log_daemon_msg-w-o-log.patch b/debian/patches/0005-use-log_action_msg-instead-of-log_daemon_msg-w-o-log.patch
new file mode 100644
index 0000000..cc138a8
--- /dev/null
+++ b/debian/patches/0005-use-log_action_msg-instead-of-log_daemon_msg-w-o-log.patch
@@ -0,0 +1,33 @@
+From 31e43a6a7f7241f552e12c1464bdefb85b40f033 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Fri, 17 Mar 2023 12:30:52 +0100
+Subject: [PATCH] use log_action_msg instead of log_daemon_msg w/o log_end_msg
+
+---
+ dkms_autoinstaller | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/dkms_autoinstaller b/dkms_autoinstaller
+index bff9ac5..8c9450c 100755
+--- a/dkms_autoinstaller
++++ b/dkms_autoinstaller
+@@ -28,6 +28,7 @@ fi
+ if [ ! -f /etc/debian_version ]; then
+ alias log_daemon_msg='/bin/echo -n'
+ log_end_msg() { if [ "$1" = "0" ]; then echo " Done. "; else echo " Failed. "; fi; }
++ alias log_action_msg=/bin/echo
+ fi
+
+ exec="/usr/sbin/dkms"
+@@ -45,7 +46,7 @@ case "$1" in
+ kernel=$(uname -r)
+ fi
+ if [ -f /etc/dkms/no-autoinstall ]; then
+- log_daemon_msg "$prog: autoinstall for dkms modules has been disabled"
++ log_action_msg "$prog: autoinstall for dkms modules has been disabled"
+ else
+ log_daemon_msg "$prog: running auto installation service for kernel $kernel"
+ dkms autoinstall --kernelver $kernel
+--
+2.20.1
+
diff --git a/debian/patches/0006-dkms_autoinstaller-skip-autoinstall-if-headers-are-m.patch b/debian/patches/0006-dkms_autoinstaller-skip-autoinstall-if-headers-are-m.patch
new file mode 100644
index 0000000..4a403f2
--- /dev/null
+++ b/debian/patches/0006-dkms_autoinstaller-skip-autoinstall-if-headers-are-m.patch
@@ -0,0 +1,62 @@
+From 2e65ddb5449a18602eb81776e87e048adfb5f114 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Wed, 22 Mar 2023 18:16:03 +0100
+Subject: [PATCH] dkms_autoinstaller: skip autoinstall if headers are missing
+
+align the behavior with dkms_common.postinst which also skips the build
+step if headers are not available
+
+Before this change the following installation order succeeds (while
+linux-headers-... is *not* installed) (Debian syntax):
+ apt install linux-image-... && apt install ...-dkms
+while the opposite order causes a failure:
+ apt install ...-dkms && apt install linux-image-...
+After this change both ways succeed.
+---
+ dkms_autoinstaller | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/dkms_autoinstaller b/dkms_autoinstaller
+index 8c9450c..1b54c51 100755
+--- a/dkms_autoinstaller
++++ b/dkms_autoinstaller
+@@ -38,6 +38,27 @@ test -f $exec || exit 0
+
+ [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
++uname_s=$(uname -s)
++
++_get_kernel_dir() {
++ KVER=$1
++ case ${uname_s} in
++ Linux) DIR="/lib/modules/$KVER/build" ;;
++ GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;;
++ esac
++ echo $DIR
++}
++
++_check_kernel_dir() {
++ DIR=$(_get_kernel_dir $1)
++ case ${uname_s} in
++ Linux) test -e $DIR/include ;;
++ GNU/kFreeBSD) test -e $DIR/kern && test -e $DIR/conf/kmod.mk ;;
++ *) return 1 ;;
++ esac
++ return $?
++}
++
+ case "$1" in
+ start)
+ if [ -n "$2" ]; then
+@@ -47,6 +68,8 @@ case "$1" in
+ fi
+ if [ -f /etc/dkms/no-autoinstall ]; then
+ log_action_msg "$prog: autoinstall for dkms modules has been disabled"
++ elif ! _check_kernel_dir $kernel; then
++ log_action_msg "$prog: autoinstall for kernel $kernel was skipped since the kernel headers for this kernel do not seem to be installed"
+ else
+ log_daemon_msg "$prog: running auto installation service for kernel $kernel"
+ dkms autoinstall --kernelver $kernel
+--
+2.20.1
+
diff --git a/debian/patches/0007-prepare_build-use-return-code-77-if-skipping-due-to-.patch b/debian/patches/0007-prepare_build-use-return-code-77-if-skipping-due-to-.patch
new file mode 100644
index 0000000..2f2cf9b
--- /dev/null
+++ b/debian/patches/0007-prepare_build-use-return-code-77-if-skipping-due-to-.patch
@@ -0,0 +1,66 @@
+From 3638f1119debd177b46836cdf7502d25e9888042 Mon Sep 17 00:00:00 2001
+From: Andreas Beckmann <anbe@debian.org>
+Date: Fri, 17 Mar 2023 10:54:49 +0100
+Subject: [PATCH] prepare_build: use return code 77 if skipping due to
+ BUILD_EXCLUSIVE_*
+
+error code 9 is used at multiple locations throughout the dkms code
+to indicate different unrelated errors
+
+error code 77 has been used by GNU autotest for skipped tests and was
+later adopted by other testing frameworks
+---
+ dkms.8.in | 11 +++++++----
+ dkms.in | 2 +-
+ dkms_common.postinst | 2 +-
+ run_test.sh | 4 ++--
+ 4 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/dkms.8.in b/dkms.8.in
+index b003da6..b197878 100644
+--- a/dkms.8.in
++++ b/dkms.8.in
+@@ -654,10 +654,13 @@ missing or broken dependencies cause non-fatal warnings.
+ .TP
+ .B BUILD_EXCLUSIVE_KERNEL=
+ This optional directive allows you to specify a regular expression which defines
+-the subset of kernels which DKMS is allowed to build your module for. If the kernel
+-being built for does not match against this regular expression, the dkms build
+-will error out. For example, if you set it as ="^2\.4.*", your module would not be
+-built for 2.6 kernels.
++the subset of kernels which DKMS is allowed to build your module for.
++If the kernel being built for does not match against this regular expression (or
++does not the satisfy the constraints of any other
++.B BUILD_EXCLUSIVE_*
++directive), the dkms build will error out with exit code 77.
++For example, if you set it as ="^2\.4.*", your module would not be built for 2.6
++or later kernels.
+ .TP
+ .B BUILD_EXCLUSIVE_ARCH=
+ This optional directive functions very similarly to
+diff --git a/dkms.in b/dkms.in
+index 0383bef..128157b 100644
+--- a/dkms.in
++++ b/dkms.in
+@@ -1023,7 +1023,7 @@ prepare_build()
+ read_conf_or_die "$kernelver" "$arch"
+
+ # Error out if build_exclude is set
+- [[ $build_exclude ]] && die 9 \
++ [[ $build_exclude ]] && die 77 \
+ $"The $base_dir/dkms.conf for module $module includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch."\
+ $"This indicates that it should not be built."
+
+diff --git a/dkms_common.postinst b/dkms_common.postinst
+index 3f1ddf3..a66a23f 100644
+--- a/dkms_common.postinst
++++ b/dkms_common.postinst
+@@ -238,7 +238,7 @@ for KERNEL in $KERNELS; do
+ set +e
+ dkms build -m $NAME -v $VERSION -k $KERNEL $ARCH > /dev/null
+ case $? in
+- 9)
++ 77)
+ set -e
+ echo "Skipped."
+ continue
diff --git a/debian/patches/BUILD_EXCLUSIVE_CONFIG.patch b/debian/patches/BUILD_EXCLUSIVE_CONFIG.patch
new file mode 100644
index 0000000..26701a1
--- /dev/null
+++ b/debian/patches/BUILD_EXCLUSIVE_CONFIG.patch
@@ -0,0 +1,41 @@
+Author: Andreas Beckmann <anbe@debian.org>
+Description: add BUILD_EXCLUSIVE_CONFIG
+ support build exclusion depending on kernel features being present/absent,
+ e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"
+Forwarded: https://github.com/dell/dkms/issues/219
+
+--- a/dkms.in
++++ b/dkms.in
+@@ -28,6 +28,7 @@ shopt -s extglob
+ readonly dkms_conf_variables="CLEAN PACKAGE_NAME
+ PACKAGE_VERSION POST_ADD POST_BUILD POST_INSTALL POST_REMOVE PRE_BUILD
+ PRE_INSTALL BUILD_DEPENDS BUILD_EXCLUSIVE_KERNEL BUILD_EXCLUSIVE_ARCH
++ BUILD_EXCLUSIVE_CONFIG
+ build_exclude OBSOLETE_BY MAKE MAKE_MATCH
+ PATCH PATCH_MATCH patch_array BUILT_MODULE_NAME
+ built_module_name BUILT_MODULE_LOCATION built_module_location
+@@ -622,6 +623,15 @@ read_conf()
+ # Set build_exclude
+ [[ $BUILD_EXCLUSIVE_KERNEL && ! $1 =~ $BUILD_EXCLUSIVE_KERNEL ]] && build_exclude="yes"
+ [[ $BUILD_EXCLUSIVE_ARCH && ! $2 =~ $BUILD_EXCLUSIVE_ARCH ]] && build_exclude="yes"
++ if [[ $BUILD_EXCLUSIVE_CONFIG && -e $kernel_source_dir/.config ]]; then
++ local kconf
++ for kconf in $BUILD_EXCLUSIVE_CONFIG ; do
++ case "$kconf" in
++ !*) grep -q -E "^${kconf#!}=[ym]" $kernel_source_dir/.config && build_exclude="yes" ;;
++ *) grep -q -E "^${kconf}=[ym]" $kernel_source_dir/.config || build_exclude="yes" ;;
++ esac
++ done
++ fi
+
+ # Fail if absolutely no DEST_MODULE_LOCATION
+ if ((${#dest_module_location[@]} == 0)); then
+@@ -1009,7 +1019,7 @@ prepare_build()
+
+ # Error out if build_exclude is set
+ [[ $build_exclude ]] && die 77 \
+- $"The $base_dir/dkms.conf for module $module includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch."\
++ $"The $base_dir/dkms.conf for module $module includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch/config."\
+ $"This indicates that it should not be built."
+
+ # Error out if source_tree is basically empty (binary-only dkms tarball w/ --force check)
diff --git a/debian/patches/fix-builtin-archive-dkms-coinstallation.patch b/debian/patches/fix-builtin-archive-dkms-coinstallation.patch
new file mode 100644
index 0000000..4cc51dd
--- /dev/null
+++ b/debian/patches/fix-builtin-archive-dkms-coinstallation.patch
@@ -0,0 +1,45 @@
+Description: Allow co-installing in-archive and builtin dkms
+ Fix regression preventing co-installing in-archive dkms packages with
+ kernels that built-in identical or newer versions of the same dkms
+ package.
+Author: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2008269
+
+
+--- a/dkms.in
++++ b/dkms.in
+@@ -1226,7 +1226,15 @@ do_install()
+ echo $""
+ echo $"${dest_module_name[$count]}$module_suffix:"
+ # Check this version against what is already in the kernel
+- check_version_sanity "$kernelver" "$arch" "$obsolete_by" "${dest_module_name[$count]}" || continue
++ if ! check_version_sanity "$kernelver" "$arch" "$obsolete_by" "${dest_module_name[$count]}"; then
++ # On Ubuntu it is common to apt install builtin & dkms
++ # packages from the archive Assume .deb package
++ # installation is successful in such cases. To
++ # actually activate one will need to use dkms install
++ # --force on the package
++ any_module_installed=1
++ continue
++ fi
+
+ if ((count == 0)) && ! run_build_script pre_install "$pre_install" && ! [[ $force ]]; then
+ die 101 $"pre_install failed, aborting install." \
+--- a/run_test.sh
++++ b/run_test.sh
+@@ -726,6 +726,7 @@ dkms_multiver_test/1.0, ${KERNEL_VER}, $
+ dkms_multiver_test/2.0, ${KERNEL_VER}, $(uname -m): built
+ EOF
+
++if false ; then
+ echo 'Installing the multiver test modules'
+ run_with_expected_output dkms install -k "${KERNEL_VER}" -m dkms_multiver_test -v 1.0 << EOF
+
+@@ -796,6 +797,7 @@ if [[ -e "/lib/modules/${KERNEL_VER}/${e
+ echo >&2 "Error: module not removed in /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_multiver_test.ko${mod_compression_ext}"
+ exit 1
+ fi
++fi
+
+ echo 'Unbuilding the multiver test modules'
+ run_with_expected_output dkms unbuild -k "${KERNEL_VER}" -m dkms_multiver_test -v 1.0 << EOF
diff --git a/debian/patches/messaging.patch b/debian/patches/messaging.patch
new file mode 100644
index 0000000..7697d94
--- /dev/null
+++ b/debian/patches/messaging.patch
@@ -0,0 +1,16 @@
+--- a/dkms_autoinstaller
++++ b/dkms_autoinstaller
+@@ -71,9 +71,11 @@ case "$1" in
+ elif ! _check_kernel_dir $kernel; then
+ log_action_msg "$prog: autoinstall for kernel $kernel was skipped since the kernel headers for this kernel do not seem to be installed"
+ else
+- log_daemon_msg "$prog: running auto installation service for kernel $kernel"
++ log_action_msg "$prog: running auto installation service for kernel $kernel"
+ dkms autoinstall --kernelver $kernel
+- log_end_msg $?
++ res=$?
++ log_daemon_msg "$prog: autoinstall for kernel" "$kernel"
++ log_end_msg $res
+ fi
+ ;;
+ stop|restart|force-reload|status|reload)
diff --git a/debian/patches/reinstate-enroll.patch b/debian/patches/reinstate-enroll.patch
new file mode 100644
index 0000000..0c46db8
--- /dev/null
+++ b/debian/patches/reinstate-enroll.patch
@@ -0,0 +1,16 @@
+Description: Upstream pull request incorrectly drops enroll-key option
+ When a brand new secureboot key is created, and it hasn't been
+ previously enrolled as a mok key, it will be rejected by the
+ kernel. After creating a new key, one should be enrolling it.
+Index: dkms/dkms.in
+===================================================================
+--- dkms.orig/dkms.in
++++ dkms/dkms.in
+@@ -956,6 +956,7 @@ prepare_signing()
+ fi
+ echo "Certificate or key are missing, generating them using update-secureboot-policy..."
+ SHIM_NOTRIGGER=y update-secureboot-policy --new-key &>/dev/null
++ update-secureboot-policy --enroll-key
+ fi
+
+ ;;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3b80e22
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,14 @@
+0001-default-built_module_name-0-to-PACKAGE_NAME.patch
+0002-man-clarify-dkms-add-arguments.patch
+0003-print-a-warning-if-proc-is-not-mounted.patch
+0004-use-echo-n-as-fallback-for-log_daemon_msg.patch
+0005-use-log_action_msg-instead-of-log_daemon_msg-w-o-log.patch
+0006-dkms_autoinstaller-skip-autoinstall-if-headers-are-m.patch
+0007-prepare_build-use-return-code-77-if-skipping-due-to-.patch
+
+messaging.patch
+version-sort.patch
+BUILD_EXCLUSIVE_CONFIG.patch
+spelling.patch
+reinstate-enroll.patch
+fix-builtin-archive-dkms-coinstallation.patch
diff --git a/debian/patches/spelling.patch b/debian/patches/spelling.patch
new file mode 100644
index 0000000..40ecf3c
--- /dev/null
+++ b/debian/patches/spelling.patch
@@ -0,0 +1,16 @@
+Author: Andreas Beckmann <anbe@debian.org>
+Description: spelling corrections
+
+Index: dkms/dkms_common.postinst
+===================================================================
+--- dkms.orig/dkms_common.postinst
++++ dkms/dkms_common.postinst
+@@ -254,7 +254,7 @@
+ dkms_status=$(dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH)
+ else
+ echo "Module build for kernel $KERNEL was skipped since the"
+- echo "kernel headers for this kernel does not seem to be installed."
++ echo "kernel headers for this kernel do not seem to be installed."
+ fi
+ fi
+
diff --git a/debian/patches/version-sort.patch b/debian/patches/version-sort.patch
new file mode 100644
index 0000000..d0f0327
--- /dev/null
+++ b/debian/patches/version-sort.patch
@@ -0,0 +1,22 @@
+--- a/dkms_common.postinst
++++ b/dkms_common.postinst
+@@ -127,7 +127,7 @@ if [ -r /etc/dkms/framework.conf ]; then
+ . /etc/dkms/framework.conf
+ fi
+
+-KERNELS=$(ls /lib/modules/ 2>/dev/null || true)
++KERNELS=$(ls -v /lib/modules/ 2>/dev/null || true)
+ CURRENT_KERNEL=$(uname -r)
+
+ #We never want to keep an older version side by side to prevent conflicts
+--- a/dkms.in
++++ b/dkms.in
+@@ -269,7 +269,7 @@ setup_kernels_arches()
+ kernelver[$i]=${line%/*}
+ arch[$i]=${line#*/}
+ i=$(($i + 1))
+- done < <(module_status_built "$module" "$module_version")
++ done < <(module_status_built "$module" "$module_version" | sort -V)
+ fi
+
+ # Set default kernel version and arch, if none set (but only --all isn't set)