From patchwork Thu Aug 22 17:10:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Boccassi X-Patchwork-Id: 1975657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WqV8y0LBgz1yXY for ; Fri, 23 Aug 2024 03:11:13 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1shBL0-0007YG-3g; Thu, 22 Aug 2024 17:11:06 +0000 Received: from mail-wr1-f41.google.com ([209.85.221.41]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1shBKv-0007Xd-Ft for kernel-team@lists.ubuntu.com; Thu, 22 Aug 2024 17:11:01 +0000 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-371a13c7c80so1209879f8f.0 for ; Thu, 22 Aug 2024 10:11:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724346660; x=1724951460; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Clg21NnZjVXD9BiZp9jU//OyW2+glqHX6di4ZlndEKU=; b=EtEhpI7UnsrKRg+b7WtXTlOAl5mOyhgjxQ9USWflzgWC5nM5u1Dtfqu/1iXHKb0YiK ARXV53VIzA/i6OT9CeMqNggZ8ZnOu4b3OSoRhreakaDWUIyO2Q5n6fhFpV7OwB5zd2tV me5q9FmD6iec1bxQPSBu8VxMC6rkYjuNF7CuU/4MOy4/d7aVIPYUreDz819V3xlfGTjn MVzSJU+Rqxr0QbZvQU8SpMN+Yiwr3bY2uQUC4fRVptFzGQZ4SsVRM4ianG2/poWbo4Bq kCS8Qdj/UF5tPobL5m/6I3ug1p/rLbY1FSSHsupU3VI0bnXQoWOFWGLGN5PRa2LkDhgo J+LA== X-Gm-Message-State: AOJu0YxuovG+496OhItRc6bWQ1gU98Edlz3WIcDe2j+Y7IsElSCNpbXb A52MJe+1ifDk1+VGFBL+346KpXieGL1Y1pUzD18A4iWwk2URm8aaXAEZnA== X-Google-Smtp-Source: AGHT+IFnx8hkyZCMjnwQaFE8hebhB3NWJIu4+RdUZ36yB7stgKIKxV9pp6dqV8XFY9vbdL1smxSiYA== X-Received: by 2002:adf:e7cd:0:b0:371:8451:5a82 with SMTP id ffacd0b85a97d-37305269526mr2616640f8f.15.1724346660115; Thu, 22 Aug 2024 10:11:00 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5158420sm29841435e9.14.2024.08.22.10.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 10:10:59 -0700 (PDT) From: luca.boccassi@gmail.com To: kernel-team@lists.ubuntu.com Subject: [PATCH] UBUNTU: [Packaging] add linux-bpf-dev package Date: Thu, 22 Aug 2024 18:10:56 +0100 Message-Id: <20240822171056.1638495-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.221.41; envelope-from=luca.boccassi@gmail.com; helo=mail-wr1-f41.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Luca Boccassi BugLink: https://bugs.launchpad.net/bugs/2050083 Add a new binary linux-bpf-dev package that ships a generated vmlinux.h header. This can be used by packages building CO-RE BPF programs instead of generating it at build time based on the kernel running on the package build system, which might or might not match the kernel that is actually shipped. It ensures that a matching header can always be used. Matches changes in Debian, including the package name and header installation location, so that we do not have to ifdef: https://salsa.debian.org/kernel-team/linux/-/commit/f52d006f3915ac4358dc8c98aa417477ebee026e This is already used by systemd to build various CO-RE programs, and right now on Ubuntu due to the lack of this package the header is generated from sysfs in the build system where the systemd packages are built. Signed-off-by: Luca Boccassi --- As requested by Timo at: https://lists.ubuntu.com/archives/kernel-team/2024-August/153047.html second version uses ifeq ($(do_tools_bpftool),true) instead of checking for armhf debian/control.d/linux-bpf-dev.stub | 7 +++++++ debian/rules | 1 + debian/rules.d/2-binary-arch.mk | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 debian/control.d/linux-bpf-dev.stub diff --git a/debian/control.d/linux-bpf-dev.stub b/debian/control.d/linux-bpf-dev.stub new file mode 100644 index 000000000000..2967299aec18 --- /dev/null +++ b/debian/control.d/linux-bpf-dev.stub @@ -0,0 +1,7 @@ +Package: linux-bpf-dev +Architecture: amd64 armhf arm64 i386 ppc64el riscv64 s390x +Depends: ${misc:Depends} +Multi-Arch: same +Description: Headers for BPF development + The vmlinux.h header is provided to allow userspace to build BPF CO-RE + programs targeting the packaged kernel. diff --git a/debian/rules b/debian/rules index 43eae8d5aaa8..5fd39b2b0bcc 100755 --- a/debian/rules +++ b/debian/rules @@ -175,6 +175,7 @@ ifeq ($(src_pkg_name),linux) control_files += debian/control.d/linux-tools-host.stub control_files += debian/control.d/linux-source.stub control_files += debian/control.d/linux-doc.stub + control_files += debian/control.d/linux-bpf-dev.stub endif # Calculate Ubuntu Compatible Signing levels diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index cda3522d7b5b..bb9beb2b381b 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -616,6 +616,9 @@ endif ifeq ($(do_cloud_tools),true) $(call dh_all,$(pkgcloud)) endif +ifeq ($(do_tools_bpftool),true) + $(call dh_all,linux-bpf-dev) +endif # # per-architecture packages @@ -661,6 +664,7 @@ endif ifeq ($(do_tools_bpftool),true) mv $(builddirpa)/tools/bpf/bpftool/vmlinux $(builddirpa)/vmlinux $(kmake) NO_LIBTRACEEVENT=1 CROSS_COMPILE=$(CROSS_COMPILE) -C $(builddirpa)/tools/bpf/bpftool + $(builddirpa)/tools/bpf/bpftool/bpftool btf dump file $(builddirpa)/vmlinux format c > $(builddirpa)/vmlinux.h rm -f $(builddirpa)/vmlinux endif ifeq ($(do_tools_x86),true) @@ -713,6 +717,10 @@ endif ifeq ($(do_tools_bpftool),true) install -m755 $(builddirpa)/tools/bpf/bpftool/bpftool $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release) endif +ifeq ($(do_tools_bpftool),true) + install -d -m755 $(CURDIR)/debian/linux-bpf-dev/usr/include/$(DEB_HOST_MULTIARCH)/linux/ + install -m644 $(builddirpa)/vmlinux.h $(CURDIR)/debian/linux-bpf-dev/usr/include/$(DEB_HOST_MULTIARCH)/linux/vmlinux.h +endif ifeq ($(do_tools_x86),true) install -m755 \ $(addprefix $(builddirpa)/tools/power/x86/, x86_energy_perf_policy/x86_energy_perf_policy turbostat/turbostat) \