diff mbox series

[SRU,L,K,J,F,M,U,v2,1/1] UBUNTU: [Packaging] Expose base (parent) abinum for derivatives

Message ID 20230606094709.31300-2-roxana.nicolescu@canonical.com
State New
Headers show
Series [SRU,L,K,J,F,M,U,v2,1/1] UBUNTU: [Packaging] Expose base (parent) abinum for derivatives | expand

Commit Message

Roxana Nicolescu June 6, 2023, 9:47 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2017006

This will introduce a new variable UTS_UBUNTU_BASE_RELEASE_ABI equal
with the parent abi. For backports with multiple inheritance (like
jammy:linux-aws-5.19) the version from debian.master (kinetic:linux)
wil be used. In case there is no inheritance, the actual kernel abi
will be used.
This will be exposed in <generated/utsrelease.h> so that (dkms)
modules can use this variable for versioning.

This is particularly needed in 5.19 kernels, but in anticipation of
similar usecases, it is best to introduce this in all releases.

The dkms fix that needs this variable is caused by a commit  that
broke the interface between the kernel and the lttng-module dkms.
For other releases, the kernel upstream version was used, but this
version has stayed the same because 5.19 version is not maintained
anymore upstream and the commit that broke the interface was fetched
from the 5.15 stable release.
We do expose the abi version of the kernel, but it alone will not solve
this issue because we deliver many derivatives, each with its own
version. Hence a base main abi version number needs to be exposed in the
headers.

Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
---
 debian/rules.d/0-common-vars.mk | 6 ++++++
 debian/rules.d/2-binary-arch.mk | 4 ++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index 1d8f8b85772f..e03e21b89291 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -88,6 +88,12 @@  ifneq ($(full_build),false)
   uploadnum	:= $(uploadnum)-Ubuntu
 endif
 
+# This exposes the base (parent) abi number
+# For main kernels, this version matches their abi version
+# Because we may deal with multiple inheritance (jammy:linux-aws-5.19)
+# we always extract the abi version from debian.master/changelog
+base_abinum	:= $(shell dpkg-parsechangelog -l"debian.master/changelog" -SVersion | sed -e 's/.*-//' -e 's/\..*//')
+
 # XXX: linux-libc-dev got bumped to -803.N inadvertantly by a ti-omap4 upload
 #      shift our version higher for this package only.  Ensure this only
 #      occurs for the v2.6.35 kernel so that we do not propogate this into
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 6eef2039ec7a..100f3d8e9f7e 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -335,6 +335,10 @@  endif
 		"$(hdrdir)/include/generated/compile.h"
 	# Add UTS_UBUNTU_RELEASE_ABI since UTS_RELEASE is difficult to parse.
 	echo "#define UTS_UBUNTU_RELEASE_ABI $(abinum)" >> $(hdrdir)/include/generated/utsrelease.h
+
+	# Add UTS_UBUNTU_BASE_RELEASE_ABI, needed for dkms modules where we cannot use the upstream version
+	echo "#define UTS_UBUNTU_BASE_RELEASE_ABI $(base_abinum)" >> $(hdrdir)/include/generated/utsrelease.h
+
 	# powerpc kernel arch seems to need some .o files for external module linking. Add them in.
 ifeq ($(build_arch),powerpc)
 	mkdir -p $(hdrdir)/arch/powerpc/lib