[Unstable,3/6] UBUNTU: [Debian]: Check/link modules with debug symbols after DKMS modules
diff mbox series

Message ID 20190828122604.6829-4-mfo@canonical.com
State New
Headers show
Series
  • Add support for ZFS debug symbols
Related show

Commit Message

Mauricio Faria de Oliveira Aug. 28, 2019, 12:26 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1840704

Move the snippet that checks for existing debug symbol files
and then link/re-sign them, to after DKMS modules are built.

This provides the means to check the DKMS-built modules too.

Move just that snippet, not the whole 'ifneq skipdbg' snippet
because 'modules_install' does 'rm -rf lib/modules/.../kernel'
which would remove the modules just built/installed with DKMS.

For now, only move that code, no changes to it.

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
---
 debian/rules.d/2-binary-arch.mk | 40 ++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 18 deletions(-)

Patch
diff mbox series

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index ff6e35b697e2..9836f9e70b00 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -280,24 +280,7 @@  ifneq ($(skipdbg),true)
 		$(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
 	$(build_cd) $(kmake) $(build_O) modules_install $(vdso) \
 		INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
-	# Add .gnu_debuglink sections to each stripped .ko
-	# pointing to unstripped verson
-	find $(pkgdir) \
-	  $(if $(filter true,$(do_extras_package)),$(pkgdir_ex)) \
-	  -name '*.ko' | while read path_module ; do \
-		module="/lib/modules/$${path_module#*/lib/modules/}"; \
-		if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
-			$(CROSS_COMPILE)objcopy \
-				--add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \
-				$$path_module; \
-			if grep -q CONFIG_MODULE_SIG=y $(builddir)/build-$*/.config; then \
-				$(builddir)/build-$*/scripts/sign-file $(MODHASHALGO) \
-					$(MODSECKEY) \
-					$(MODPUBKEY) \
-					$$path_module; \
-			fi; \
-		fi; \
-	done
+	# Add .gnu_debuglink sections only after all/DKMS modules are built.
 	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/build
 	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/source
 	rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/modules.*
@@ -418,6 +401,27 @@  ifeq ($(do_extras_package),true)
 	$(if $(filter true,$(do_dkms_vbox)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel, virtualbox-guest, http://archive.ubuntu.com/ubuntu/pool/multiverse/v/virtualbox/virtualbox-guest-dkms_$(dkms_vbox_guest_version)_all.deb))
 endif
 
+ifneq ($(skipdbg),true)
+	# Add .gnu_debuglink sections to each stripped .ko
+	# pointing to unstripped verson
+	find $(pkgdir) \
+	  $(if $(filter true,$(do_extras_package)),$(pkgdir_ex)) \
+	  -name '*.ko' | while read path_module ; do \
+		module="/lib/modules/$${path_module#*/lib/modules/}"; \
+		if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
+			$(CROSS_COMPILE)objcopy \
+				--add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \
+				$$path_module; \
+			if grep -q CONFIG_MODULE_SIG=y $(builddir)/build-$*/.config; then \
+				$(builddir)/build-$*/scripts/sign-file $(MODHASHALGO) \
+					$(MODSECKEY) \
+					$(MODPUBKEY) \
+					$$path_module; \
+			fi; \
+		fi; \
+	done
+endif
+
 	# Build the final ABI information.
 	install -d $(abidir)
 	sed -e 's/^\(.\+\)[[:space:]]\+\(.\+\)[[:space:]]\(.\+\)$$/\3 \2 \1/'	\