[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1027306: linux-kbuild-6.0: missing `resolve_btfids` and some scripts



Package: linux-kbuild-6.0
Version: 6.0.12-1~bpo11+1
Severity: important
Tags: patch

Dear Maintainer,

I tried to build my out-of-tree kernel module and noticed a message:
`Skipping BTF generation for PATH_TO_KO due to unavailability of vmlinux`.
After copying `/sys/kernel/btf/vmlinux` to corresponding position and with
`dwarves` installed, building the kernel module throws a error: 
`/bin/sh: 1: ./tools/bpf/resolve_btfids/resolve_btfids: not found`.

Besides I find that some useful scripts are not included in `linux-kbuild`
package such as `clang-tools/gen_compile_commands.py`, and I had to copy
it from kernel source tree.

I patched build scripts to contain those components locally with
following patches.

-- System Information:
Debian Release: 11.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-0.deb11.2-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages linux-kbuild-6.0 depends on:
ii  libc6      2.31-13+deb11u5
ii  libelf1    0.183-1
ii  libssl1.1  1.1.1n-0+deb11u3

linux-kbuild-6.0 recommends no packages.

linux-kbuild-6.0 suggests no packages.

-- no debconf information
>From 1b9e5fa40cc29bd9a8af9cd3355e65d88cd19a8e Mon Sep 17 00:00:00 2001
From: ur4t <46435411+ur4t@users.noreply.github.com>
Date: Thu, 29 Dec 2022 19:10:37 +0800
Subject: [PATCH 1/2] linux-kbuild: Add tools/bpf/resolve_btfids/resolve_btfids

This is a new dependency of OOT module builds with BTF enabled.
---
 debian/rules.d/tools/bpf/resolve_btfids/Makefile | 7 +++++++
 debian/rules.real                                | 2 ++
 2 files changed, 9 insertions(+)
 create mode 100644 debian/rules.d/tools/bpf/resolve_btfids/Makefile

diff --git a/debian/rules.d/tools/bpf/resolve_btfids/Makefile b/debian/rules.d/tools/bpf/resolve_btfids/Makefile
new file mode 100644
index 0000000000..8f5e4e0cb5
--- /dev/null
+++ b/debian/rules.d/tools/bpf/resolve_btfids/Makefile
@@ -0,0 +1,7 @@
+include $(top_rulesdir)/Makefile.inc
+
+all:
+	$(MAKE) -C $(top_srcdir)/tools/bpf/resolve_btfids O=$(CURDIR)
+
+install:
+	install -D -m755 resolve_btfids $(DESTDIR)/$(installdir)/resolve_btfids
diff --git a/debian/rules.real b/debian/rules.real
index 9bb0c617bd..98e8dd7999 100644
--- a/debian/rules.real
+++ b/debian/rules.real
@@ -560,6 +560,7 @@ build_kbuild: $(STAMPS_DIR)/build-tools-headers
 	$(call make-tools,certs)
 	$(call make-tools,scripts)
 	$(call make-tools,tools/objtool)
+	$(call make-tools,tools/bpf/resolve_btfids)
 
 binary_kbuild: PREFIX_DIR = /usr/lib/$(PACKAGE_NAME)
 binary_kbuild: build_kbuild
@@ -569,6 +570,7 @@ binary_kbuild: build_kbuild
 	$(call make-tools,certs) install prefix=$(PREFIX_DIR)
 	$(call make-tools,scripts) install prefix=$(PREFIX_DIR)
 	$(call make-tools,tools/objtool) install prefix=$(PREFIX_DIR)
+	$(call make-tools,tools/bpf/resolve_btfids) install DESTDIR=$(DIR) prefix=$(PREFIX_DIR)
 	dh_link $(PREFIX_DIR) /usr/src/$(PACKAGE_NAME)
 	dh_installchangelogs
 ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
-- 
2.30.2

>From fc0c873389031d1e2e068658d5464e7d70b6f142 Mon Sep 17 00:00:00 2001
From: ur4t <46435411+ur4t@users.noreply.github.com>
Date: Thu, 29 Dec 2022 19:19:08 +0800
Subject: [PATCH 2/2] linux-kbuild: Add missing upstream scripts

---
 debian/rules.d/scripts/Makefile             | 47 +++++++++++++--------
 debian/rules.d/scripts/clang-tools/Makefile |  4 ++
 2 files changed, 34 insertions(+), 17 deletions(-)
 create mode 100644 debian/rules.d/scripts/clang-tools/Makefile

diff --git a/debian/rules.d/scripts/Makefile b/debian/rules.d/scripts/Makefile
index bbfe9c0d10..2e803d1c9f 100644
--- a/debian/rules.d/scripts/Makefile
+++ b/debian/rules.d/scripts/Makefile
@@ -7,37 +7,50 @@ PROGS = \
 
 DATA = \
 	Kbuild.include \
-	Makefile.* \
+	Makefile* \
 	mkversion \
 	module-common.lds \
 	subarch.include
 
-SCRIPTS =  \
-	checkincludes.pl \
+SCRIPTS = \
+	*.pl \
+	*.py \
+	*.sh \
+	Lindent \
+	bloat-o-meter \
 	check-local-export \
-	checkstack.pl \
-	checkversion.pl \
-	depmod.sh \
-	gcc-*.sh \
-	gen_initramfs_list.sh \
-	headers_install.sh \
+	check-sysctl-docs \
+	cleanfile \
+	cleanpatch \
+	coccicheck \
+	config \
+	decodecode \
+	diffconfig \
+	documentation-file-ref-check \
+	extract-ikconfig \
+	extract-vmlinux \
+	faddr2line \
+	get_dvb_firmware \
+	gfp-translate \
+	jobserver-exec \
 	kernel-doc \
-	ld-version.sh \
-	Lindent \
 	makelst \
+	mkcompile_h \
 	mksysmap \
-	mkuboot.sh \
-	modules-check.sh \
-	namespace.pl \
-	pahole-flags.sh \
-	pahole-version.sh \
+	objdiff \
+	objdump-func \
 	patch-kernel \
-	recordmcount.pl \
+	prune-kernel \
+	remove-stale-files \
 	setlocalversion \
+	sphinx-pre-install \
+	stackdelta \
+	stackusage \
 	ver_linux
 
 SUBDIRS = \
 	basic \
+	clang-tools \
 	genksyms \
 	kconfig \
 	mod
diff --git a/debian/rules.d/scripts/clang-tools/Makefile b/debian/rules.d/scripts/clang-tools/Makefile
new file mode 100644
index 0000000000..d41ca61b8e
--- /dev/null
+++ b/debian/rules.d/scripts/clang-tools/Makefile
@@ -0,0 +1,4 @@
+SCRIPTS = \
+	*
+
+include $(top_rulesdir)/Makefile.inc
-- 
2.30.2


Reply to: