[Unstable][PATCH v2 2/3] UBUNTU: [Packaging] linux-bpf-dev: Skip packaging for additional kernel flavors

Juerg Haefliger juerg.haefliger at canonical.com
Mon Dec 16 11:03:30 UTC 2024


The linux-bpf-dev package is a broken abomination :-( It provides
vmlinux.h which is generated from vmlinux but some kernels have multiple
flavors so which one to use?? It should really be a flavored package...

Anyways, for now just ensure that we do all the packaging install and
binary steps only when processing the main/first flavor and skip them for
any additional flavors. Otherwise we end up with a packaged vmlinux.h that
is generated from the last flavor vmlinux which is likely not what we want.

While at it, add the missing dh_prep step.

Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
 debian/rules.d/2-binary-arch.mk | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index cb8d7d623f24..4bc46a8b4066 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -143,6 +143,13 @@ endif
 ifeq ($(do_extras_package),true)
 	dh_prep -p$(mods_extra_pkg_name)-$*
 endif
+ifeq ($(do_tools_bpftool),true)
+	# Do this only for the primary (first) flavor
+	# linux-bpf-dev is broken: It provides vmlinux.h which is a flavored header file!
+	if [ $* = $(firstword $(flavours)) ] ; then \
+		$(call if_package, linux-bpf-dev, dh_prep -plinux-bpf-dev) ; \
+	fi
+endif
 
 	# The main image
 	# compress_file logic required because not all architectures
@@ -364,9 +371,13 @@ ifeq ($(do_tools_hyperv),true)
 endif
 endif
 ifeq ($(do_tools_bpftool),true)
-	install -d -m755 $(bpfdevpkgdir)/usr/include/$(DEB_HOST_MULTIARCH)/linux/
-	install -m644 $(builddir)/build-$*/vmlinux.h \
-		 $(bpfdevpkgdir)/usr/include/$(DEB_HOST_MULTIARCH)/linux/
+	# Do this only for the primary (first) flavor
+	# linux-bpf-dev is broken: It provides vmlinux.h which is a flavored header file!
+	if [ $* = $(firstword $(flavours)) ] ; then \
+		install -d -m755 $(bpfdevpkgdir)/usr/include/$(DEB_HOST_MULTIARCH)/linux/ ; \
+		install -m644 $(builddir)/build-$*/vmlinux.h \
+			 $(bpfdevpkgdir)/usr/include/$(DEB_HOST_MULTIARCH)/linux/ ; \
+	fi
 endif
 
 	# Build a temporary "installed headers" directory.
@@ -610,7 +621,11 @@ ifeq ($(do_cloud_tools),true)
 	$(call dh_all,$(pkgcloud))
 endif
 ifeq ($(do_tools_bpftool),true)
-	$(call if_package, linux-bpf-dev, $(call dh_all,linux-bpf-dev))
+	# Do this only for the primary (first) flavor
+	# linux-bpf-dev is broken: It provides vmlinux.h which is a flavored header file!
+	if [ $* = $(firstword $(flavours)) ] ; then \
+		$(call if_package, linux-bpf-dev, $(call dh_all_inline,linux-bpf-dev)) ; \
+	fi
 endif
 
 #
-- 
2.43.0




More information about the kernel-team mailing list