[Unstable][PATCH 0/6] Add support for ZFS debug symbols

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 0/6] Add support for ZFS debug symbols

Mauricio Faria de Oliveira-3
BugLink: https://bugs.launchpad.net/bugs/1840704

The ZFS kernel modules aren't built with debug symbols,
which introduces problems/issues for debugging/support.

Patches are required in:

1) linux kernel packaging, to add infrastructure to
   enable/build/strip/package debug symbols on DKMS.
   (this is sufficient with zfs-linux now in Eoan.)

2) zfs-linux and spl-linux, for the stable releases,
   which need a few patches to enable debug symbols
   (add option './configure --enable-debuginfo' and
   '(ZFS|SPL)_DKMS_ENABLE_DEBUGINFO' to dkms.conf.)

Initially submitting the kernel patchset for Unstable,
for review/feedback.  It backports nicely into B/D/E,
should it be accepted; for X (doesn't use DKMS builds)
a simpler patch for the moment (until it does) works.

The zfs/spl-linux patches are ready, to be submitted
once the approach used by the kernel package settles.

Mauricio Faria de Oliveira (6):
  UBUNTU: [Debian]: Remove hardcoded $(pkgdir) in debug symbols handling
  UBUNTU: [Debian]: Handle debug symbols for modules in extras too
  UBUNTU: [Debian]: Check/link modules with debug symbols after DKMS
    modules
  UBUNTU: [Debian]: Warn about modules without debug symbols
  UBUNTU: [Debian]: dkms-build: new parameter for debug package
    directory
  UBUNTU: [Debian]: dkms-build: zfs: support for debug symbols

 debian/rules.d/2-binary-arch.mk             | 50 ++++++++++++---------
 debian/scripts/dkms-build                   | 44 +++++++++++++++++-
 debian/scripts/dkms-build--nvidia-N         |  5 ++-
 debian/scripts/dkms-build--virtualbox-guest |  5 ++-
 4 files changed, 78 insertions(+), 26 deletions(-)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 1/6] UBUNTU: [Debian]: Remove hardcoded $(pkgdir) in debug symbols handling

Mauricio Faria de Oliveira-3
BugLink: https://bugs.launchpad.net/bugs/1840704

The 'find .ko | sed | while read module' loop has the $(pkgdir) path
hardcoded in a couple places to reconstruct the path 'sed' destroyed.

Remove that 'sed' expression to destroy the first components of the
absolute pathname and get its '/lib/modules/'-based path with shell.

This is needed for the next patch.

Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
---
 debian/rules.d/2-binary-arch.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 083b64772439..730373e93e53 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -282,16 +282,17 @@ ifneq ($(skipdbg),true)
  INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
  # Add .gnu_debuglink sections to each stripped .ko
  # pointing to unstripped verson
- find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
+ find $(pkgdir) -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 \
- $(pkgdir)/$$module; \
+ $$path_module; \
  if grep -q CONFIG_MODULE_SIG=y $(builddir)/build-$*/.config; then \
  $(builddir)/build-$*/scripts/sign-file $(MODHASHALGO) \
  $(MODSECKEY) \
  $(MODPUBKEY) \
- $(pkgdir)/$$module; \
+ $$path_module; \
  fi; \
  fi; \
  done
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 2/6] UBUNTU: [Debian]: Handle debug symbols for modules in extras too

Mauricio Faria de Oliveira-3
In reply to this post by Mauricio Faria de Oliveira-3
BugLink: https://bugs.launchpad.net/bugs/1840704

The debug symbols section only searches for modules in the
'$(pkgdir)' path (in linux-modules package) but not in the
'$(pkdir_ex)' path (in linux-modules-extra).

Thus, modules in the extras package have no '.gnu_debuglink'.

Fix it by searching in $(pkgdir_ex) too if extras is enabled.

Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
---
 debian/rules.d/2-binary-arch.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 730373e93e53..ff6e35b697e2 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -282,7 +282,9 @@ ifneq ($(skipdbg),true)
  INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
  # Add .gnu_debuglink sections to each stripped .ko
  # pointing to unstripped verson
- find $(pkgdir) -name '*.ko' | while read path_module ; do \
+ 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 \
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 3/6] UBUNTU: [Debian]: Check/link modules with debug symbols after DKMS modules

Mauricio Faria de Oliveira-3
In reply to this post by Mauricio Faria de Oliveira-3
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 <[hidden email]>
---
 debian/rules.d/2-binary-arch.mk | 40 ++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 18 deletions(-)

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/' \
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 4/6] UBUNTU: [Debian]: Warn about modules without debug symbols

Mauricio Faria de Oliveira-3
In reply to this post by Mauricio Faria de Oliveira-3
BugLink: https://bugs.launchpad.net/bugs/1840704

Print a warning message in the build log if a module does
not have a corresponding file in 'dbgpkgdir/usr/lib/debug'.

This should help to identify any modules without debug symbols,
which introduce additional complexity for their supportability.

In the future, it may be interesting to implement an stricter
check, to fail the build (obviously providing options to skip
the check and an exception list of modules that can bypass it).

Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
---
 debian/rules.d/2-binary-arch.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 9836f9e70b00..9c991b49e868 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -418,6 +418,8 @@ ifneq ($(skipdbg),true)
  $(MODPUBKEY) \
  $$path_module; \
  fi; \
+ else \
+ echo "WARNING: Missing debug symbols for module '$$module'."; \
  fi; \
  done
 endif
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 5/6] UBUNTU: [Debian]: dkms-build: new parameter for debug package directory

Mauricio Faria de Oliveira-3
In reply to this post by Mauricio Faria de Oliveira-3
BugLink: https://bugs.launchpad.net/bugs/1840704

Provide the 'dkms-build' script an argument that specifies
the path for installing modules built with debug symbols,
and update callers (currently just 'build_dkms' function)
and post-processor scripts for consistency (nvidia, vbox).

This is similar to the currently used package directory
argument 'pkgdir/lib/modules/abi-release/kernel', where
modules are installed anyway regardless of debug symbols.

The proposal is that the 'dkms-build' script, if provided
such argument, should handle the generation and stripping
of debug symbols, and installing the non-stripped modules
into the debug package directory and the stripped modules
into the other package directory (which is used currently).

The script double checks whether debug symbols are indeed
present in the module file (via the '.debug_info' section)
to avoid non-debug modules in the debug package directory,
with an additional benefit of backwards compatibility and
gracefully handling DKMS packages that do not yet support
building debug symbols (or that failed to for some reason).

The script should not handle the '.gnu_debuglink' section
to reference the non-stripped modules in stripped modules
(and re-signinig afterward), as this is now done in rules
after the DKMS modules have been built and installed.

This currently does nothing as no DKMS modules are built
with debug symbols (so this keeps the new argument empty).

This will allow for some of the DKMS-built modules to be
shipped with debug symbols to aid with debug and support.

Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
---
 debian/rules.d/2-binary-arch.mk             | 10 +++---
 debian/scripts/dkms-build                   | 34 +++++++++++++++++++--
 debian/scripts/dkms-build--nvidia-N         |  5 +--
 debian/scripts/dkms-build--virtualbox-guest |  5 +--
 4 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 9c991b49e868..90396689de2d 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -60,7 +60,7 @@ define build_dkms_sign =
  )
 endef
 define build_dkms =
- $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4)
+ CROSS_COMPILE=$(CROSS_COMPILE) $(SHELL) $(DROOT)/scripts/dkms-build $(dkms_dir) $(abi_release)-$* '$(call build_dkms_sign,$(builddir)/build-$*)' $(1) $(2) $(3) $(4) $(5)
 endef
 
 define install_control =
@@ -390,15 +390,15 @@ endif
  install -d $(dkms_dir) $(dkms_dir)/headers $(dkms_dir)/build $(dkms_dir)/source
  cp -rp "$(hdrdir)" "$(indep_hdrdir)" "$(dkms_dir)/headers"
 
- $(if $(filter true,$(enable_zfs)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, zfs, pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_linux_version)_all.deb))
+ $(if $(filter true,$(enable_zfs)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, "", zfs, pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_linux_version)_all.deb))
 
 ifeq ($(do_dkms_nvidia),true)
- $(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, nvidia-390, pool/restricted/n/nvidia-graphics-drivers-390/nvidia-kernel-source-390_$(dkms_nvidia_390_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-390/nvidia-dkms-390_$(dkms_nvidia_390_version)_$(arch).deb)
- $(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, nvidia-430, pool/restricted/n/nvidia-graphics-drivers-430/nvidia-kernel-source-430_$(dkms_nvidia_430_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-430/nvidia-dkms-430_$(dkms_nvidia_430_version)_$(arch).deb)
+ $(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-390, pool/restricted/n/nvidia-graphics-drivers-390/nvidia-kernel-source-390_$(dkms_nvidia_390_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-390/nvidia-dkms-390_$(dkms_nvidia_390_version)_$(arch).deb)
+ $(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-430, pool/restricted/n/nvidia-graphics-drivers-430/nvidia-kernel-source-430_$(dkms_nvidia_430_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-430/nvidia-dkms-430_$(dkms_nvidia_430_version)_$(arch).deb)
 endif
 
 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))
+ $(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)
diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build
index 7264852d3133..f77063f7b745 100755
--- a/debian/scripts/dkms-build
+++ b/debian/scripts/dkms-build
@@ -6,8 +6,9 @@ abi_flavour="$2"
 sign="$3"
 pkgname="$4"
 pkgdir="$5"
-package="$6"
-shift 6
+dbgpkgdir="$6"
+package="$7"
+shift 7
 
 srcdir=$(pwd)
 cd "$dkms_dir" || exit 1
@@ -134,6 +135,34 @@ sed -e "s@$dkms_dir@<<DKMSDIR>>@g" <"$log"
 # If this build failed then exit here.
 [ "$rc" != 0 ] && exit "$rc"
 
+# Install the modules with debug symbols we possibly built,
+# and strip the original modules for the next install step.
+if [ -n "$dbgpkgdir" ]; then
+ dbgpkgdir="$dbgpkgdir/$package"
+ echo "II: dkms-build installing $package into $dbgpkgdir (debug symbols)"
+ install -d "$dbgpkgdir"
+ find "$dkms_dir/build/$dkms_package/$dkms_version/$abi_version" -name \*.ko |
+ while read module; do
+ vmodule=$( basename "$module" )
+
+ # Check for '.debug_info' section in order to copy module.
+ # Useful if debug symbols are requested but not built for
+ # any reason (including not yet supported by DKMS package).
+ # Strip module just in case even if section isn't present.
+ if ${CROSS_COMPILE}objdump -h -j '.debug_info' "$module" >/dev/null 2>&1
+ then
+ echo "copying $vmodule"
+ cp "$module" "$dbgpkgdir"
+ else
+ echo "ignoring $vmodule (missing debug symbols)"
+ fi
+
+ # Just 'strip -g' as '/usr/sbin/dkms' does.
+ echo "stripping $vmodule"
+ strip -g "$module"
+ done
+fi
+
 # Install and optionally sign the modules we have built.
 pkgdir="$pkgdir/$package"
 echo "II: dkms-build installing $package into $pkgdir"
@@ -180,6 +209,7 @@ do
  "$sign" \
  "$pkgname" \
  "$pkgdir" \
+ "$dbgpkgdir" \
  "$package" \
  "$@" || exit 1
  break
diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N
index 72673e0ba7d8..bdec78233b43 100755
--- a/debian/scripts/dkms-build--nvidia-N
+++ b/debian/scripts/dkms-build--nvidia-N
@@ -10,8 +10,9 @@ abi_flavour="$2"
 sign="$3"
 pkgname="$4"
 pkgdir="$5"
-package="$6"
-shift 6
+dbgpkgdir="$6"
+package="$7"
+shift 7
 
 build="$( dirname "$objects" )/build"
 
diff --git a/debian/scripts/dkms-build--virtualbox-guest b/debian/scripts/dkms-build--virtualbox-guest
index 29b5a1686bd1..dd981b83e77e 100644
--- a/debian/scripts/dkms-build--virtualbox-guest
+++ b/debian/scripts/dkms-build--virtualbox-guest
@@ -10,8 +10,9 @@ abi_flavour="$2"
 sign="$3"
 pkgname="$4"
 pkgdir="$5"
-package="$6"
-shift 6
+dbgpkgdir="$6"
+package="$7"
+shift 7
 
 # We want to ship the vboxvideo.ko from the upstream staging tree, so
 # remove the one built via dkms.
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[Unstable][PATCH 6/6] UBUNTU: [Debian]: dkms-build: zfs: support for debug symbols

Mauricio Faria de Oliveira-3
In reply to this post by Mauricio Faria de Oliveira-3
BugLink: https://bugs.launchpad.net/bugs/1840704

Add support to enable debug symbols on ZFS in 'dkms-build',
and specify the debug package directory path in the rules.

It's a bit ugly that a change for a particular package is
in the generic build script, but unfortunately this seems
to be less intrusive than other options (eg, rely on file
in /etc/ which needs privileged permissions on build time;
or patch zfs-linux/dkms.conf to detect kernel build time.)

And it seemed short enough not to create 'pre processors'.

Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
---
 debian/rules.d/2-binary-arch.mk |  3 ++-
 debian/scripts/dkms-build       | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 90396689de2d..ca55df647120 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -108,6 +108,7 @@ install-%: MODPUBKEY=$(builddir)/build-$*/certs/signing_key.x509
 install-%: build_dir=$(builddir)/build-$*
 install-%: dkms_dir=$(call dkms_dir_prefix,$(builddir)/build-$*)
 install-%: enable_zfs = $(call custom_override,do_zfs,$*)
+install-%: dbgpkgdir_zfs = $(if $(filter false,$(skipdbg)),$(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/kernel,"")
 install-%: $(stampdir)/stamp-build-% install-headers
  @echo Debug: $@ kernel_file $(kernel_file) kernfile $(kernfile) install_file $(install_file) instfile $(instfile)
  dh_testdir
@@ -390,7 +391,7 @@ endif
  install -d $(dkms_dir) $(dkms_dir)/headers $(dkms_dir)/build $(dkms_dir)/source
  cp -rp "$(hdrdir)" "$(indep_hdrdir)" "$(dkms_dir)/headers"
 
- $(if $(filter true,$(enable_zfs)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, "", zfs, pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_linux_version)_all.deb))
+ $(if $(filter true,$(enable_zfs)),$(call build_dkms, $(mods_pkg_name)-$*, $(pkgdir)/lib/modules/$(abi_release)-$*/kernel, $(dbgpkgdir_zfs), zfs, pool/universe/z/zfs-linux/zfs-dkms_$(dkms_zfs_linux_version)_all.deb))
 
 ifeq ($(do_dkms_nvidia),true)
  $(call build_dkms, $(bldinfo_pkg_name)-$*, $(pkgdir_bldinfo)/usr/lib/linux/$(abi_release)-$*/signatures, "", nvidia-390, pool/restricted/n/nvidia-graphics-drivers-390/nvidia-kernel-source-390_$(dkms_nvidia_390_version)_$(arch).deb pool/restricted/n/nvidia-graphics-drivers-390/nvidia-dkms-390_$(dkms_nvidia_390_version)_$(arch).deb)
diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build
index f77063f7b745..ce587dcbd489 100755
--- a/debian/scripts/dkms-build
+++ b/debian/scripts/dkms-build
@@ -85,10 +85,20 @@ for dkms_conf in "$package/usr/src"/*/"dkms.conf"
 do
  break
 done
+
 # It seems some packages have a # in the name which works fine if the
 # package is installed directly, but not so much if we build it out
 # of the normal location.
 sed -i -e '/^PACKAGE_NAME=/ s/#//g' "$dkms_conf"
+
+# ZFS debug symbols are enabled in dkms.conf via PACKAGE_CONFIG file.
+if [ -n "$dbgpkgdir" ] && [ "$package" = 'zfs' ]; then
+ pkg_cfg="$(dirname "$dkms_conf")/pkg_cfg"
+ echo 'ZFS_DKMS_ENABLE_DEBUGINFO=yes' >"$pkg_cfg"
+ echo 'ZFS_DKMS_DISABLE_STRIP=yes'   >>"$pkg_cfg"
+ sed -i "s,^\(PACKAGE_CONFIG=\).*,\1$pkg_cfg," $dkms_conf
+fi
+
 cat - <<'EOF' >>"$dkms_conf"
 POST_BUILD="ubuntu-save-objects ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/objects $POST_BUILD"
 EOF
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [Unstable][PATCH 1/6] UBUNTU: [Debian]: Remove hardcoded $(pkgdir) in debug symbols handling

Seth Forshee
In reply to this post by Mauricio Faria de Oliveira-3
On Wed, Aug 28, 2019 at 09:25:59AM -0300, Mauricio Faria de Oliveira wrote:

> BugLink: https://bugs.launchpad.net/bugs/1840704
>
> The 'find .ko | sed | while read module' loop has the $(pkgdir) path
> hardcoded in a couple places to reconstruct the path 'sed' destroyed.
>
> Remove that 'sed' expression to destroy the first components of the
> absolute pathname and get its '/lib/modules/'-based path with shell.
>
> This is needed for the next patch.
>
> Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
> ---
>  debian/rules.d/2-binary-arch.mk | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 083b64772439..730373e93e53 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -282,16 +282,17 @@ ifneq ($(skipdbg),true)
>   INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
>   # Add .gnu_debuglink sections to each stripped .ko
>   # pointing to unstripped verson
> - find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
> + find $(pkgdir) -name '*.ko' | while read path_module ; do \
> + module="/lib/modules/$${path_module#*/lib/modules/}"; \

Why not do this instead?

  module=$${path_module#$(pkgdir)}

I don't think it makes a difference in practice, I just find it easier
to parse. I had to stare at what you wrote for a bit to convince myself
that the result was the same as what sed was doing previously, whereas
the above is more obviously equivalent.

Thanks,
Seth

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [Unstable][PATCH 1/6] UBUNTU: [Debian]: Remove hardcoded $(pkgdir) in debug symbols handling

Mauricio Faria de Oliveira-3
On Thu, Sep 5, 2019 at 1:06 PM Seth Forshee <[hidden email]> wrote:

>
> On Wed, Aug 28, 2019 at 09:25:59AM -0300, Mauricio Faria de Oliveira wrote:
> > BugLink: https://bugs.launchpad.net/bugs/1840704
> >
> > The 'find .ko | sed | while read module' loop has the $(pkgdir) path
> > hardcoded in a couple places to reconstruct the path 'sed' destroyed.
> >
> > Remove that 'sed' expression to destroy the first components of the
> > absolute pathname and get its '/lib/modules/'-based path with shell.
> >
> > This is needed for the next patch.
> >
> > Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
> > ---
> >  debian/rules.d/2-binary-arch.mk | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> > index 083b64772439..730373e93e53 100644
> > --- a/debian/rules.d/2-binary-arch.mk
> > +++ b/debian/rules.d/2-binary-arch.mk
> > @@ -282,16 +282,17 @@ ifneq ($(skipdbg),true)
> >               INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
> >       # Add .gnu_debuglink sections to each stripped .ko
> >       # pointing to unstripped verson
> > -     find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
> > +     find $(pkgdir) -name '*.ko' | while read path_module ; do \
> > +             module="/lib/modules/$${path_module#*/lib/modules/}"; \
>
> Why not do this instead?
>
>   module=$${path_module#$(pkgdir)}
>

This would again depend on $(pkgdir) inside the loop,
and the intention is to generalize that for the next patch.

The next patch needs this dependency not to exist,
so that $(dbgpkgdir) can be iterated over too in the loop.

Hope this clarifies things.  Thanks for reviewing!

> I don't think it makes a difference in practice, I just find it easier
> to parse. I had to stare at what you wrote for a bit to convince myself
> that the result was the same as what sed was doing previously, whereas
> the above is more obviously equivalent.
>
> Thanks,
> Seth



--
Mauricio Faria de Oliveira

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [Unstable][PATCH 1/6] UBUNTU: [Debian]: Remove hardcoded $(pkgdir) in debug symbols handling

Mauricio Faria de Oliveira-3
On Thu, Sep 5, 2019 at 3:02 PM Mauricio Faria de Oliveira
<[hidden email]> wrote:

>
> On Thu, Sep 5, 2019 at 1:06 PM Seth Forshee <[hidden email]> wrote:
> >
> > On Wed, Aug 28, 2019 at 09:25:59AM -0300, Mauricio Faria de Oliveira wrote:
> > > BugLink: https://bugs.launchpad.net/bugs/1840704
> > >
> > > The 'find .ko | sed | while read module' loop has the $(pkgdir) path
> > > hardcoded in a couple places to reconstruct the path 'sed' destroyed.
> > >
> > > Remove that 'sed' expression to destroy the first components of the
> > > absolute pathname and get its '/lib/modules/'-based path with shell.
> > >
> > > This is needed for the next patch.
> > >
> > > Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
> > > ---
> > >  debian/rules.d/2-binary-arch.mk | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> > > index 083b64772439..730373e93e53 100644
> > > --- a/debian/rules.d/2-binary-arch.mk
> > > +++ b/debian/rules.d/2-binary-arch.mk
> > > @@ -282,16 +282,17 @@ ifneq ($(skipdbg),true)
> > >               INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
> > >       # Add .gnu_debuglink sections to each stripped .ko
> > >       # pointing to unstripped verson
> > > -     find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
> > > +     find $(pkgdir) -name '*.ko' | while read path_module ; do \
> > > +             module="/lib/modules/$${path_module#*/lib/modules/}"; \
> >
> > Why not do this instead?
> >
> >   module=$${path_module#$(pkgdir)}
> >
>
> This would again depend on $(pkgdir) inside the loop,
> and the intention is to generalize that for the next patch.
>
> The next patch needs this dependency not to exist,
> so that $(dbgpkgdir) can be iterated over too in the loop.

^ oops, s/dbgpkgdir/pkgdir_ex/ (for linux-modules-extras).

>
> Hope this clarifies things.  Thanks for reviewing!
>
> > I don't think it makes a difference in practice, I just find it easier
> > to parse. I had to stare at what you wrote for a bit to convince myself
> > that the result was the same as what sed was doing previously, whereas
> > the above is more obviously equivalent.
> >
> > Thanks,
> > Seth
>
>
>
> --
> Mauricio Faria de Oliveira



--
Mauricio Faria de Oliveira

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [Unstable][PATCH 1/6] UBUNTU: [Debian]: Remove hardcoded $(pkgdir) in debug symbols handling

Seth Forshee
On Thu, Sep 05, 2019 at 03:06:38PM -0300, Mauricio Faria de Oliveira wrote:

> On Thu, Sep 5, 2019 at 3:02 PM Mauricio Faria de Oliveira
> <[hidden email]> wrote:
> >
> > On Thu, Sep 5, 2019 at 1:06 PM Seth Forshee <[hidden email]> wrote:
> > >
> > > On Wed, Aug 28, 2019 at 09:25:59AM -0300, Mauricio Faria de Oliveira wrote:
> > > > BugLink: https://bugs.launchpad.net/bugs/1840704
> > > >
> > > > The 'find .ko | sed | while read module' loop has the $(pkgdir) path
> > > > hardcoded in a couple places to reconstruct the path 'sed' destroyed.
> > > >
> > > > Remove that 'sed' expression to destroy the first components of the
> > > > absolute pathname and get its '/lib/modules/'-based path with shell.
> > > >
> > > > This is needed for the next patch.
> > > >
> > > > Signed-off-by: Mauricio Faria de Oliveira <[hidden email]>
> > > > ---
> > > >  debian/rules.d/2-binary-arch.mk | 7 ++++---
> > > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> > > > index 083b64772439..730373e93e53 100644
> > > > --- a/debian/rules.d/2-binary-arch.mk
> > > > +++ b/debian/rules.d/2-binary-arch.mk
> > > > @@ -282,16 +282,17 @@ ifneq ($(skipdbg),true)
> > > >               INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
> > > >       # Add .gnu_debuglink sections to each stripped .ko
> > > >       # pointing to unstripped verson
> > > > -     find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
> > > > +     find $(pkgdir) -name '*.ko' | while read path_module ; do \
> > > > +             module="/lib/modules/$${path_module#*/lib/modules/}"; \
> > >
> > > Why not do this instead?
> > >
> > >   module=$${path_module#$(pkgdir)}
> > >
> >
> > This would again depend on $(pkgdir) inside the loop,
> > and the intention is to generalize that for the next patch.
> >
> > The next patch needs this dependency not to exist,
> > so that $(dbgpkgdir) can be iterated over too in the loop.
>
> ^ oops, s/dbgpkgdir/pkgdir_ex/ (for linux-modules-extras).
> >
> > Hope this clarifies things.  Thanks for reviewing!

Yes it does, thanks!

> >
> > > I don't think it makes a difference in practice, I just find it easier
> > > to parse. I had to stare at what you wrote for a bit to convince myself
> > > that the result was the same as what sed was doing previously, whereas
> > > the above is more obviously equivalent.
> > >
> > > Thanks,
> > > Seth
> >
> >
> >
> > --
> > Mauricio Faria de Oliveira
>
>
>
> --
> Mauricio Faria de Oliveira

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [Unstable][PATCH 0/6] Add support for ZFS debug symbols

Seth Forshee
In reply to this post by Mauricio Faria de Oliveira-3
On Wed, Aug 28, 2019 at 09:25:58AM -0300, Mauricio Faria de Oliveira wrote:

> BugLink: https://bugs.launchpad.net/bugs/1840704
>
> The ZFS kernel modules aren't built with debug symbols,
> which introduces problems/issues for debugging/support.
>
> Patches are required in:
>
> 1) linux kernel packaging, to add infrastructure to
>    enable/build/strip/package debug symbols on DKMS.
>    (this is sufficient with zfs-linux now in Eoan.)
>
> 2) zfs-linux and spl-linux, for the stable releases,
>    which need a few patches to enable debug symbols
>    (add option './configure --enable-debuginfo' and
>    '(ZFS|SPL)_DKMS_ENABLE_DEBUGINFO' to dkms.conf.)
>
> Initially submitting the kernel patchset for Unstable,
> for review/feedback.  It backports nicely into B/D/E,
> should it be accepted; for X (doesn't use DKMS builds)
> a simpler patch for the moment (until it does) works.
>
> The zfs/spl-linux patches are ready, to be submitted
> once the approach used by the kernel package settles.

I just noticed that I hadn't yet sent an ack for these.

Acked-by: Seth Forshee <[hidden email]>

I've also asked Andy to take a look at these, so awaiting his feedback.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team