| Message ID | 20260729024416.1443-1-wangmy@fujitsu.com |
|---|---|
| State | Changes Requested |
| Headers | show |
| Series | kernel-devsrc: include tools needed for BTF when enabled | expand |
On Tue, Jul 28, 2026 at 10:44 PM wangmy via lists.openembedded.org <wangmy=fujitsu.com@lists.openembedded.org> wrote: > > From: Wang Mingyu <wangmy@fujitsu.com> > > When CONFIG_DEBUG_INFO_BTF is enabled in the kernel, building external > modules that use BPF requires the 'resolve_btfids' host tool. This tool > and its dependencies live in tools/bpf/ and tools/lib/, but were not > included in the kernel-devsrc package. > > This caused a build failure in the SDK when running 'make scripts prepare': > > make[4]: *** No rule to make target '.../tools/bpf/resolve_btfids/main.o' > > Copy tools/bpf/ and tools/lib/ into the devsrc build directory when > CONFIG_DEBUG_INFO_BTF=y is detected in the kernel config, matching the > existing pattern for the 'rust' directory and for objtool. > > Signed-off-by: Wang Mingyu <wangmy@fujitsu.com> > --- > meta/recipes-kernel/linux/kernel-devsrc.bb | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb > index 237dec6b12..23779ed107 100644 > --- a/meta/recipes-kernel/linux/kernel-devsrc.bb > +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb > @@ -176,6 +176,19 @@ do_install() { > cp -a --parents $(find tools/arch/${ARCH}/ -type f) $kerneldir/build/ > fi > > + # In sdk, when CONFIG_DEBUG_INFO_BTF is enabled, building external modules > + # that use BPF may require the 'resolve_btfids' host tool. This tool > + # and others require sources from tools/bpf/ and tools/lib/ to be built > + # within the SDK environment. > + if grep -q "CONFIG_DEBUG_INFO_BTF=y" ${B}/.config; then You need to find another way to make this conditional, or if the files are small, just copy them over. kernel devsrc cannot grep and be coupled to specific CONFIG_ symbols. > + echo "NOTE: CONFIG_DEBUG_INFO_BTF is enabled, including BPF host tools sources in kernel-devsrc." > + # The 'rust' example copies the whole dir. We do the same for consistency. > + # This includes resolve_btfids and other potential BPF tools. > + cp -r tools/bpf ${kerneldir}/build/tools/ > + # This also requires the shared tools/lib directory. > + cp -r tools/lib ${kerneldir}/build/tools/ What does it actually use from those directories? We avoid complete copies whenever possible. Rarely are all the files needed. Bruce > + fi > + > if [ "${ARCH}" = "arm64" ]; then > # arch/arm64/include/asm/xen references arch/arm > cp -a --parents arch/arm/include/asm/xen $kerneldir/build/ > -- > 2.43.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#242224): https://lists.openembedded.org/g/openembedded-core/message/242224 > Mute This Topic: https://lists.openembedded.org/mt/120497655/1050810 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb index 237dec6b12..23779ed107 100644 --- a/meta/recipes-kernel/linux/kernel-devsrc.bb +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb @@ -176,6 +176,19 @@ do_install() { cp -a --parents $(find tools/arch/${ARCH}/ -type f) $kerneldir/build/ fi + # In sdk, when CONFIG_DEBUG_INFO_BTF is enabled, building external modules + # that use BPF may require the 'resolve_btfids' host tool. This tool + # and others require sources from tools/bpf/ and tools/lib/ to be built + # within the SDK environment. + if grep -q "CONFIG_DEBUG_INFO_BTF=y" ${B}/.config; then + echo "NOTE: CONFIG_DEBUG_INFO_BTF is enabled, including BPF host tools sources in kernel-devsrc." + # The 'rust' example copies the whole dir. We do the same for consistency. + # This includes resolve_btfids and other potential BPF tools. + cp -r tools/bpf ${kerneldir}/build/tools/ + # This also requires the shared tools/lib directory. + cp -r tools/lib ${kerneldir}/build/tools/ + fi + if [ "${ARCH}" = "arm64" ]; then # arch/arm64/include/asm/xen references arch/arm cp -a --parents arch/arm/include/asm/xen $kerneldir/build/