summaryrefslogtreecommitdiff
path: root/scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-06-25 17:14:49 +0200
committerChristian Breunig <christian@breunig.cc>2026-06-25 17:14:49 +0200
commitc6479a4be4351e8b2f07bfc40b73134d2ad16509 (patch)
tree8633a7b1658ef3e553e06dc2bffb88ed2ff816ea /scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch
parent0e7145fec66dd4ac7bc1cc6fa9c0af0ec15eea93 (diff)
downloadvyos-build-c6479a4be4351e8b2f07bfc40b73134d2ad16509.tar.gz
vyos-build-c6479a4be4351e8b2f07bfc40b73134d2ad16509.zip
Kernel: T9010: update existing patches to remove "hunk off" notices
Diffstat (limited to 'scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch')
-rw-r--r--scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch b/scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch
new file mode 100644
index 00000000..3ca6d248
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch
@@ -0,0 +1,105 @@
+From: Christian Breunig <christian@breunig.cc>
+Subject: [PATCH] VyOS: build a linux-perf Debian package alongside the kernel
+
+The upstream "make bindeb-pkg" target stopped emitting a perf package
+quite a while ago. Re-add it by hooking into the new builddeb / mkdebian
+infrastructure:
+
+ * mkdebian: emit a "linux-perf-${KERNELRELEASE}" stanza in
+ debian/control whenever the architecture is not user-mode-linux.
+ * scripts/package/debian/rules: add a "binary-perf" target so the
+ binary build loop processes the new package.
+ * builddeb: add an install_perf() helper that invokes
+ "make -C tools/perf install" with prefix=/usr and DESTDIR pointing
+ at the package staging directory, plus a dispatch case for
+ "linux-perf-*" packages.
+
+Refreshed for Linux 6.18.x: the old patch targeted the previous loop
+based scripts/package/builddeb (one-shot builddeb invocation that
+iterated over every package); since v6.7 the package build is driven
+per-package from debian/rules, so we have to extend that mechanism
+instead.
+---
+ scripts/package/builddeb | 16 ++++++++++++++++
+ scripts/package/debian/rules | 3 ++-
+ scripts/package/mkdebian | 12 ++++++++++++
+ 3 files changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/package/builddeb b/scripts/package/builddeb
+index ba1defc61652..61e5d3b8447d 100755
+--- a/scripts/package/builddeb
++++ b/scripts/package/builddeb
+@@ -162,6 +162,20 @@ install_libc_headers () {
+ mv "$pdir/usr/include/asm" "$pdir/usr/include/${DEB_HOST_MULTIARCH}"
+ }
+
++install_perf () {
++ pdir=debian/$1
++
++ rm -rf "$pdir"
++ mkdir -p "$pdir"
++
++ # In-source kernel builds export srctree as a relative path (".").
++ # "make -C tools/perf" changes the working directory, which breaks
++ # Makefile.perf's "include $(srctree)/tools/build/Makefile.include"
++ # unless srctree is absolute. Force an absolute path here.
++ $MAKE -C "$srctree/tools/perf" srctree="$(realpath "$srctree")" \
++ prefix=/usr DESTDIR="$(pwd)/$pdir" install
++}
++
+ package=$1
+
+ case "${package}" in
+@@ -173,4 +187,6 @@ linux-libc-dev)
+ install_libc_headers "${package}";;
+ linux-headers-*)
+ install_kernel_headers "${package}";;
++linux-perf-*)
++ install_perf "${package}";;
+ esac
+diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
+index a417a7f8bbc1..3b6905034b4c 100755
+--- a/scripts/package/debian/rules
++++ b/scripts/package/debian/rules
+@@ -27,13 +27,14 @@ make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) \
+ $(addprefix KBUILD_BUILD_VERSION=,$(revision)) \
+ $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))
+
+-binary-targets := $(addprefix binary-, image image-dbg headers libc-dev)
++binary-targets := $(addprefix binary-, image image-dbg headers libc-dev perf)
+
+ all-packages = $(shell dh_listpackages)
+ image-package = $(filter linux-image-% user-%, $(filter-out %-dbg, $(all-packages)))
+ image-dbg-package = $(filter %-dbg, $(all-packages))
+ libc-dev-package = $(filter linux-libc-dev, $(all-packages))
+ headers-package = $(filter linux-headers-%, $(all-packages))
++perf-package = $(filter linux-perf-%, $(all-packages))
+
+ mk-files = $(patsubst binary-%,debian/%.files,$1)
+ package = $($(@:binary-%=%-package))
+diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
+index d4b007b38a47..45a5f06b803d 100755
+--- a/scripts/package/mkdebian
++++ b/scripts/package/mkdebian
+@@ -247,6 +247,18 @@ Description: Linux kernel headers for ${KERNELRELEASE} on $debarch
+ This is useful for people who need to build external modules
+ EOF
+ fi
++
++cat <<EOF >> debian/control
++
++Package: linux-perf-${KERNELRELEASE}
++Section: devel
++Architecture: $debarch
++Depends: libpfm4, libslang2, libtraceevent1
++Description: Performance analysis tools for Linux ${KERNELRELEASE}
++ This package contains the 'perf' performance analysis tools for Linux
++ kernel version ${KERNELRELEASE}.
++Multi-Arch: same
++EOF
+ fi
+
+ if is_enabled CONFIG_DEBUG_INFO; then
+--
+2.39.5
+