[PATCH AUTOSEL 6.19-6.12] kbuild: install-extmod-build: Package resolve_btfids if necessary
From: Sasha Levin
Date: Tue Mar 10 2026 - 05:07:55 EST
From: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
[ Upstream commit 459cb3c054c2352bb321648744b620259a716b60 ]
When CONFIG_DEBUG_INFO_BTF_MODULES is enabled and vmlinux is available,
Makefile.modfinal and gen-btf.sh will try to use resolve_btfids on the
module .ko. install-extmod-build currently does not package
resolve_btfids, so that step fails.
Package resolve_btfids if it may be used.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
Reviewed-by: Nicolas Schier <nsc@xxxxxxxxxx>
Link: https://patch.msgid.link/20260226-kbuild-resolve_btfids-v1-1-2bf38b93dfe7@xxxxxxxxxxxxx
[nathan: Small commit message tweaks]
Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
LLM Generated explanations, may be completely bogus:
Now I have a clear picture. Let me verify the `RESOLVE_BTFIDS` variable
definition and confirm it would fail when building external modules
without this tool packaged.
The issue is clear: When `CONFIG_DEBUG_INFO_BTF_MODULES` is enabled,
`Makefile.modfinal` at line 47 calls `$(RESOLVE_BTFIDS)` (defined as
`$(objtree)/tools/bpf/resolve_btfids/resolve_btfids` in the main
Makefile). If someone builds an external module using the installed
headers/build files (packaged by `install-extmod-build`), and the
`resolve_btfids` binary wasn't packaged, the build will fail at that
step.
## Analysis
### What the commit does
This commit adds packaging of the `resolve_btfids` binary when
`CONFIG_DEBUG_INFO_BTF_MODULES` is enabled in the `install-extmod-build`
script. This script creates the minimal build environment needed for
building external (out-of-tree) kernel modules.
### The bug
When `CONFIG_DEBUG_INFO_BTF_MODULES` is enabled and `vmlinux` is
available, `Makefile.modfinal` (line 47) invokes `$(RESOLVE_BTFIDS)` on
module `.ko` files. The `install-extmod-build` script packages
everything needed to build external modules, but it was missing
`resolve_btfids`. This causes external module builds to **fail** with a
missing binary error.
### Is this a real bug fix?
**Yes** — this is a build fix. Without this change, users who install
kernel headers packages (deb-pkg, rpm-pkg) with
`CONFIG_DEBUG_INFO_BTF_MODULES=y` cannot build external modules.
External module building is a core use case for distributions (DKMS,
NVIDIA drivers, VirtualBox, ZFS, etc.).
### Scope and risk
- **3 lines added** — extremely small and contained
- Follows the exact same pattern as the existing `CONFIG_OBJTOOL`
conditional packaging (lines 31-33)
- No behavioral change to anything else
- Only affects the packaging script, not runtime kernel behavior
- Risk of regression is essentially zero
### Stable tree applicability
- The `install-extmod-build` script exists since v6.6
- The `CONFIG_DEBUG_INFO_BTF_MODULES` and `resolve_btfids` usage in
`Makefile.modfinal` also exists in older stable trees
- The fix would apply cleanly or with minor adaptation to 6.6.y and
newer stable trees
- This matches the "build fix" exception category — it prevents
compilation/build failures
### Concern
The exact form of the script has evolved over time (e.g., v6.6 has
slightly different structure), so backporting to older stable trees may
need minor adjustments, but the logic is the same.
### Verification
- Read `scripts/package/install-extmod-build` — confirmed the fix adds
`resolve_btfids` packaging with same pattern as `objtool`
- Read `scripts/Makefile.modfinal` lines 41-63 — confirmed that
`$(RESOLVE_BTFIDS)` is called when `CONFIG_DEBUG_INFO_BTF_MODULES` is
enabled and `vmlinux` exists
- Checked `Makefile` line 536 — confirmed `RESOLVE_BTFIDS` points to
`$(objtree)/tools/bpf/resolve_btfids/resolve_btfids`
- `git tag --contains` on the earliest form of `install-extmod-build` —
confirmed file exists since v6.6
- Checked `v6.6:scripts/package/install-extmod-build` — confirmed the
script existed with similar structure but without `resolve_btfids`
packaging
- The commit message clearly states the problem: "install-extmod-build
currently does not package resolve_btfids, so that step fails"
- Reviewed-by: Nicolas Schier (kbuild expert) confirms the fix is
correct
This is a clear build fix: small, obvious, low-risk, fixes a real
failure that affects users building external modules with BTF-enabled
kernels. It fits squarely within the stable kernel "build fix" category.
**YES**
scripts/package/install-extmod-build | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build
index 2576cf7902dbb..f12e1ffe409eb 100755
--- a/scripts/package/install-extmod-build
+++ b/scripts/package/install-extmod-build
@@ -32,6 +32,10 @@ mkdir -p "${destdir}"
echo tools/objtool/objtool
fi
+ if is_enabled CONFIG_DEBUG_INFO_BTF_MODULES; then
+ echo tools/bpf/resolve_btfids/resolve_btfids
+ fi
+
echo Module.symvers
echo "arch/${SRCARCH}/include/generated"
echo include/config/auto.conf
--
2.51.0