From patchwork Mon Jul 29 09:27:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Boccassi X-Patchwork-Id: 1965907 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 4WXY1m3xJsz1yf4 for ; Mon, 29 Jul 2024 19:28:11 +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 1sYMfX-0002G7-7m; Mon, 29 Jul 2024 09:27:51 +0000 Received: from mail-wm1-f42.google.com ([209.85.128.42]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sYMfV-0002Fz-2B for kernel-team@lists.ubuntu.com; Mon, 29 Jul 2024 09:27:49 +0000 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-426526d30aaso15192855e9.0 for ; Mon, 29 Jul 2024 02:27:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722245268; x=1722850068; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bq7oZIZZDi9f/85XqlECdjr+HaYDOk9Z+aoAWc4loAQ=; b=EXis1oHOveztEPcZDP0ZQmqY52Sr5KhbZfeUx5/BbfPhkmqBDyhenRNYC4T2Qdt0GE nydICw4S9ic68QCGx7tbmRM8WEuLqkgQX/hjuBGauaoHHumFRZIAow2oww6UYuCniEza +z3+Q67iC97P8HdWlaDUjCyRXy1IxreyXLk/XtOgnDnsvyUYLgrmd6C9o4yA35HIeCLc OIyUkz5XySzlOH2ZNkkwUQEqs3iUzsd4U6AKQfVjNCN499TPBBAKc9i7JVTeLqiIDSIP DsOy6GhHfkZ6atE7+XUVImybDdfd/SgGa0/acjOYtgQD02RbxNn1HKnhPSV1e+LI4oxk no2w== X-Gm-Message-State: AOJu0YwYfsmDRp+cMvWup44uDhZIjSS/bdWRFMi/2byYXIh/3tbVSAML ZfYGunx0wlisLG0R5WyPOTONM2FHntLnPCaaLDkqI4seNaVb3y0YXa5HEblJ X-Google-Smtp-Source: AGHT+IHJLMjkchN4vwDpRAtFNzf9YX0I+2LUl5frwcLV9C+RFjNTK980bHCtZEFobVBTqiwfF6H8yQ== X-Received: by 2002:a05:600c:4f8e:b0:426:5dd0:a1ea with SMTP id 5b1f17b1804b1-42811dd1906mr41340765e9.28.1722245267719; Mon, 29 Jul 2024 02:27:47 -0700 (PDT) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857f23sm11704898f8f.78.2024.07.29.02.27.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 02:27:47 -0700 (PDT) From: luca.boccassi@gmail.com To: kernel-team@lists.ubuntu.com Subject: [PATCH][oracular] UBUNTU: [Packaging] add linux-bpf-dev package Date: Mon, 29 Jul 2024 10:27:41 +0100 Message-Id: <20240729092741.2570288-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.128.42; envelope-from=luca.boccassi@gmail.com; helo=mail-wm1-f42.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 --- Based on the master-next branch of: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/oracular debian/control.d/linux-bpf-dev.stub | 7 +++++++ debian/rules | 1 + debian/rules.d/2-binary-arch.mk | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) 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..792276bf8458 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -256,9 +256,7 @@ ifeq ($(do_dbgsym_package),true) rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/modules.* rm -fr $(dbgpkgdir)/usr/lib/debug/lib/firmware endif -ifeq ($(do_tools_bpftool),true) cp $(builddir)/build-$*/vmlinux tools/bpf/bpftool/ -endif # The flavour specific headers image # TODO: Would be nice if we didn't have to dupe the original builddir @@ -616,6 +614,7 @@ endif ifeq ($(do_cloud_tools),true) $(call dh_all,$(pkgcloud)) endif + $(call dh_all,linux-bpf-dev) # # per-architecture packages @@ -658,11 +657,10 @@ ifeq ($(do_tools_perf),true) cd $(builddirpa)/tools/perf && \ $(kmake) prefix=/usr NO_LIBTRACEEVENT=1 HAVE_CPLUS_DEMANGLE_SUPPORT=1 CROSS_COMPILE=$(CROSS_COMPILE) NO_LIBPERL=1 WERROR=0 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) cd $(builddirpa)/tools/power/x86/x86_energy_perf_policy && make CROSS_COMPILE=$(CROSS_COMPILE) cd $(builddirpa)/tools/power/x86/turbostat && make CROSS_COMPILE=$(CROSS_COMPILE) @@ -713,6 +711,8 @@ endif ifeq ($(do_tools_bpftool),true) install -m755 $(builddirpa)/tools/bpf/bpftool/bpftool $(toolspkgdir)/usr/lib/$(src_pkg_name)-tools-$(abi_release) endif + 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 ifeq ($(do_tools_x86),true) install -m755 \ $(addprefix $(builddirpa)/tools/power/x86/, x86_energy_perf_policy/x86_energy_perf_policy turbostat/turbostat) \