Add linux-bpf-dev package for BPF header

This commit is contained in:
Bastian Blank 2024-07-04 22:11:52 +02:00
parent fcb40db277
commit f52d006f39
6 changed files with 38 additions and 11 deletions

1
debian/.gitignore vendored
View file

@ -28,6 +28,7 @@
/linux-*
/rules.gen
/tests/control
!/linux-bpf-dev.*
# Ignore compiled Python files
__pycache__/

View file

@ -438,6 +438,15 @@ linux-signed-{vars['arch']} (@signedtemplate_sourceversion@) {dist}; urgency={ur
self.bundle.add('image-dbg.meta', ruleid, makeflags, vars, arch=arch)
)
if (
config.defs_flavour.is_default
# XXX
and not self.vars['source_suffix']
):
packages_own.extend(
self.bundle.add('image-extra-dev', ruleid, makeflags, vars, arch=arch)
)
# In a quick build, only build the quick flavour (if any).
if not config.defs_flavour.is_quick:
for package in packages_own:

1
debian/changelog vendored
View file

@ -8,6 +8,7 @@ linux (6.9.7-2~exp1) UNRELEASED; urgency=medium
[ Bastian Blank ]
* Use debhelper compatibility level 13.
* Add linux-bpf-dev package for BPF header.
-- Ben Hutchings <benh@debian.org> Sun, 30 Jun 2024 21:54:51 +0200

1
debian/linux-bpf-dev.install vendored Normal file
View file

@ -0,0 +1 @@
vmlinux.h /usr/include/${DEB_HOST_MULTIARCH}/linux/bpf/

29
debian/rules.real vendored
View file

@ -162,16 +162,6 @@ $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR): $(STAMPS_DIR)/setup_$(ARCH
$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR):
+$(MAKE_CLEAN) -C '$(DIR)'
mkdir -p $(DIR)/tools/bpf/bpftool
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)/tools/bpf/bpftool' O=$(DIR)/tools/bpf/bpftool CROSS_COMPILE= FEATURE_TESTS= FEATURE_DISPLAY=
if grep -q CONFIG_DEBUG_INFO_BTF=y $(DIR)/.config; then \
$(DIR)/tools/bpf/bpftool/bpftool btf dump file $(DIR)/vmlinux format c > $(DIR)/vmlinux.h; \
else \
echo '#error "Kernel build without CONFIG_DEBUG_INFO_BTF, no type info available"' > $(DIR)/vmlinux.h; \
fi
debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
@$(stamp)
@ -323,7 +313,7 @@ binary_headers: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
$(dh_binary_pre)
mkdir -p $(DIR)/arch/$(KERNEL_ARCH)/kernel
cp -a $(SOURCE_DIR)/{.config,.kernel*,Module.symvers,include,vmlinux.h} $(DIR)
cp -a $(SOURCE_DIR)/{.config,.kernel*,Module.symvers,include} $(DIR)
cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/include $(DIR)/arch/$(KERNEL_ARCH)
find $(DIR) -name '*.cmd' -delete
@ -371,6 +361,23 @@ binary_libc-dev: $(STAMPS_DIR)/build_libc-dev
$(dh_binary_post)
build_bpf-dev: SOURCE_DIR=$(BUILD_DIR)/source_$(FEATURESET)
build_bpf-dev: DIR=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
build_bpf-dev: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
mkdir -p $(DIR)/tools/bpf/bpftool
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)/tools/bpf/bpftool' O=$(DIR)/tools/bpf/bpftool CROSS_COMPILE= FEATURE_TESTS= FEATURE_DISPLAY=
if grep -q CONFIG_DEBUG_INFO_BTF=y $(DIR)/.config; then \
$(DIR)/tools/bpf/bpftool/bpftool btf dump file $(DIR)/vmlinux format c > $(DIR)/vmlinux.h; \
else \
echo '#error "Kernel build without CONFIG_DEBUG_INFO_BTF, no type info available"' > $(DIR)/vmlinux.h; \
fi
binary_bpf-dev: DH_INSTALL_ARGS = --sourcedir=$(BUILD_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
binary_bpf-dev: build_bpf-dev
$(dh_binary_pre)
$(dh_binary_post)
build_support:
binary_support: PACKAGE_ROOT = /usr/share/$(PACKAGE_NAME)

View file

@ -0,0 +1,8 @@
Package: linux-bpf-dev
Meta-Rules-Target: bpf-dev
Build-Profiles: <!pkg.linux.nokernel !pkg.linux.quick>
Section: devel
Depends: ${misc:Depends}
Description: Headers for BPF development
The vmlinux.h header is provided to allow userspace to build BPF CO-RE
programs targeting the packaged kernel.