[SRU][R][PATCH v2 1/1] UBUNTU: [Packaging] add stripped-down vmlinux with only BTF sections to flavour headers package
Jacob Martin
jacob.martin at canonical.com
Thu Mar 26 14:18:13 UTC 2026
BugLink: https://bugs.launchpad.net/bugs/2133794
Out-of-tree module builds warn about failed BTF generation without a
vmlinux image with BTF information included with the kernel headers.
Generate a stripped down vmlinux with only .BTF and .BTF_ids sections to
silence this warning and allow for the automatic generation of BTF debug
information during out-of-tree module builds.
This solution matches the one in Debian by Bastian Blank:
https://salsa.debian.org/kernel-team/linux/-/commit/0dedced119aea5426f81a9318c36e0a6c7339547.
Signed-off-by: Jacob Martin <jacob.martin at canonical.com>
---
debian/rules.d/2-binary-arch.mk | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index e79cd23290d7..d038df77d5cf 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -274,6 +274,14 @@ endif
# Copy over the compilation version.
cp "$(build_dir)/include/generated/compile.h" \
"$(hdrdir)/include/generated/compile.h"
+ # Generate a stripped-down vmlinux with only BTF sections to enable BTF
+ # generation on out-of-tree module builds. Skip this on arches with
+ # do_tools_bpftool_stub=true, which declares the kernel is built with
+ # CONFIG_DEBUG_INFO_BTF disabled, and thus vmlinux lacks BTF info.
+ifneq ($(do_tools_bpftool_stub),true)
+ $(CROSS_COMPILE)objcopy --only-section .BTF --only-section .BTF_ids $(build_dir)/vmlinux $(hdrdir)/vmlinux
+ chmod 644 $(hdrdir)/vmlinux
+endif
# Add UTS_UBUNTU_RELEASE_ABI since UTS_RELEASE is difficult to parse.
echo "#define UTS_UBUNTU_RELEASE_ABI $(abinum)" >> $(hdrdir)/include/generated/utsrelease.h
# powerpc kernel arch seems to need some .o files for external module linking. Add them in.
--
2.43.0
More information about the kernel-team
mailing list