* [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution
@ 2026-01-21 18:16 Ihor Solodrai
2026-01-21 18:24 ` Gary Guo
2026-01-21 20:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Ihor Solodrai @ 2026-01-21 18:16 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau
Cc: Gary Guo, Thomas Weißschuh, Nathan Chancellor,
Nicolas Schier, bpf, linux-kbuild, linux-kernel
According to the docs [1], kernel build scripts should be executed via
CONFIG_SHELL, which is sh by default.
Fixup gen-btf.sh to be runnable with sh, and use CONFIG_SHELL at every
invocation site.
See relevant discussion for context [2].
[1] https://docs.kernel.org/kbuild/makefiles.html#script-invocation
[2] https://lore.kernel.org/bpf/CAADnVQ+dxmSNoJAGb6xV89ffUCKXe5CJXovXZt22nv5iYFV5mw@mail.gmail.com/
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
---
scripts/Makefile.modfinal | 2 +-
scripts/gen-btf.sh | 8 ++++----
scripts/link-vmlinux.sh | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index 422c56dc878e..adcbcde16a07 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -43,7 +43,7 @@ quiet_cmd_btf_ko = BTF [M] $@
if [ ! -f $(objtree)/vmlinux ]; then \
printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
else \
- $(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
+ $(CONFIG_SHELL) $(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
fi;
# Same as newer-prereqs, but allows to exclude specified extra dependencies
diff --git a/scripts/gen-btf.sh b/scripts/gen-btf.sh
index be21ccee3487..8ca96eb10a69 100755
--- a/scripts/gen-btf.sh
+++ b/scripts/gen-btf.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2025 Meta Platforms, Inc. and affiliates.
#
@@ -81,7 +81,7 @@ gen_btf_data()
gen_btf_o()
{
- local btf_data=${ELF_FILE}.btf.o
+ btf_data=${ELF_FILE}.btf.o
# Create ${btf_data} which contains just .BTF section but no symbols. Add
# SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
@@ -107,11 +107,11 @@ embed_btf_data()
${OBJCOPY} --add-section .BTF=${ELF_FILE}.BTF ${ELF_FILE}
# a module might not have a .BTF_ids or .BTF.base section
- local btf_base="${ELF_FILE}.BTF.base"
+ btf_base="${ELF_FILE}.BTF.base"
if [ -f "${btf_base}" ]; then
${OBJCOPY} --add-section .BTF.base=${btf_base} ${ELF_FILE}
fi
- local btf_ids="${ELF_FILE}.BTF_ids"
+ btf_ids="${ELF_FILE}.BTF_ids"
if [ -f "${btf_ids}" ]; then
${RESOLVE_BTFIDS} --patch_btfids ${btf_ids} ${ELF_FILE}
fi
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 08cd8e25c65c..16d6a048e07c 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -206,7 +206,7 @@ fi
if is_enabled CONFIG_DEBUG_INFO_BTF; then
info BTF .tmp_vmlinux1
- if ! ${srctree}/scripts/gen-btf.sh .tmp_vmlinux1; then
+ if ! ${CONFIG_SHELL} ${srctree}/scripts/gen-btf.sh .tmp_vmlinux1; then
echo >&2 "Failed to generate BTF for vmlinux"
echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF"
exit 1
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution
2026-01-21 18:16 [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution Ihor Solodrai
@ 2026-01-21 18:24 ` Gary Guo
2026-01-21 18:30 ` Ihor Solodrai
2026-01-21 20:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Gary Guo @ 2026-01-21 18:24 UTC (permalink / raw)
To: Ihor Solodrai, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau
Cc: Gary Guo, Thomas Weißschuh, Nathan Chancellor,
Nicolas Schier, bpf, linux-kbuild, linux-kernel
On Wed Jan 21, 2026 at 6:16 PM GMT, Ihor Solodrai wrote:
> According to the docs [1], kernel build scripts should be executed via
> CONFIG_SHELL, which is sh by default.
>
> Fixup gen-btf.sh to be runnable with sh, and use CONFIG_SHELL at every
> invocation site.
>
> See relevant discussion for context [2].
>
> [1] https://docs.kernel.org/kbuild/makefiles.html#script-invocation
> [2] https://lore.kernel.org/bpf/CAADnVQ+dxmSNoJAGb6xV89ffUCKXe5CJXovXZt22nv5iYFV5mw@mail.gmail.com/
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
I can indeed build again when applying this on top of linux-next. Thanks.
Tested-by: Gary Guo <gary@garyguo.net>
You probably also want to carry some Reported-by, Suggested-by and Fixes tags here.
Best,
Gary
> ---
> scripts/Makefile.modfinal | 2 +-
> scripts/gen-btf.sh | 8 ++++----
> scripts/link-vmlinux.sh | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
> index 422c56dc878e..adcbcde16a07 100644
> --- a/scripts/Makefile.modfinal
> +++ b/scripts/Makefile.modfinal
> @@ -43,7 +43,7 @@ quiet_cmd_btf_ko = BTF [M] $@
> if [ ! -f $(objtree)/vmlinux ]; then \
> printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
> else \
> - $(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
> + $(CONFIG_SHELL) $(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
> fi;
>
> # Same as newer-prereqs, but allows to exclude specified extra dependencies
> diff --git a/scripts/gen-btf.sh b/scripts/gen-btf.sh
> index be21ccee3487..8ca96eb10a69 100755
> --- a/scripts/gen-btf.sh
> +++ b/scripts/gen-btf.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
> # SPDX-License-Identifier: GPL-2.0
> # Copyright (c) 2025 Meta Platforms, Inc. and affiliates.
> #
> @@ -81,7 +81,7 @@ gen_btf_data()
>
> gen_btf_o()
> {
> - local btf_data=${ELF_FILE}.btf.o
> + btf_data=${ELF_FILE}.btf.o
>
> # Create ${btf_data} which contains just .BTF section but no symbols. Add
> # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
> @@ -107,11 +107,11 @@ embed_btf_data()
> ${OBJCOPY} --add-section .BTF=${ELF_FILE}.BTF ${ELF_FILE}
>
> # a module might not have a .BTF_ids or .BTF.base section
> - local btf_base="${ELF_FILE}.BTF.base"
> + btf_base="${ELF_FILE}.BTF.base"
> if [ -f "${btf_base}" ]; then
> ${OBJCOPY} --add-section .BTF.base=${btf_base} ${ELF_FILE}
> fi
> - local btf_ids="${ELF_FILE}.BTF_ids"
> + btf_ids="${ELF_FILE}.BTF_ids"
> if [ -f "${btf_ids}" ]; then
> ${RESOLVE_BTFIDS} --patch_btfids ${btf_ids} ${ELF_FILE}
> fi
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 08cd8e25c65c..16d6a048e07c 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -206,7 +206,7 @@ fi
>
> if is_enabled CONFIG_DEBUG_INFO_BTF; then
> info BTF .tmp_vmlinux1
> - if ! ${srctree}/scripts/gen-btf.sh .tmp_vmlinux1; then
> + if ! ${CONFIG_SHELL} ${srctree}/scripts/gen-btf.sh .tmp_vmlinux1; then
> echo >&2 "Failed to generate BTF for vmlinux"
> echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF"
> exit 1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution
2026-01-21 18:24 ` Gary Guo
@ 2026-01-21 18:30 ` Ihor Solodrai
2026-01-21 20:38 ` Alexei Starovoitov
0 siblings, 1 reply; 5+ messages in thread
From: Ihor Solodrai @ 2026-01-21 18:30 UTC (permalink / raw)
To: Gary Guo, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau
Cc: Thomas Weißschuh, Nathan Chancellor, Nicolas Schier, bpf,
linux-kbuild, linux-kernel
On 1/21/26 10:24 AM, Gary Guo wrote:
> On Wed Jan 21, 2026 at 6:16 PM GMT, Ihor Solodrai wrote:
>> According to the docs [1], kernel build scripts should be executed via
>> CONFIG_SHELL, which is sh by default.
>>
>> Fixup gen-btf.sh to be runnable with sh, and use CONFIG_SHELL at every
>> invocation site.
>>
>> See relevant discussion for context [2].
>>
>> [1] https://docs.kernel.org/kbuild/makefiles.html#script-invocation
>> [2] https://lore.kernel.org/bpf/CAADnVQ+dxmSNoJAGb6xV89ffUCKXe5CJXovXZt22nv5iYFV5mw@mail.gmail.com/
>>
>> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
>
> I can indeed build again when applying this on top of linux-next. Thanks.
>
> Tested-by: Gary Guo <gary@garyguo.net>
>
> You probably also want to carry some Reported-by, Suggested-by and Fixes tags here.
You're right. This should do it:
Reported-by: Gary Guo <gary@garyguo.net>
Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary output")
Alexei, please lmk if I should re-send with tags.
>
>
>> [...]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution
2026-01-21 18:30 ` Ihor Solodrai
@ 2026-01-21 20:38 ` Alexei Starovoitov
0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2026-01-21 20:38 UTC (permalink / raw)
To: Ihor Solodrai
Cc: Gary Guo, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Thomas Weißschuh, Nathan Chancellor,
Nicolas Schier, bpf, Linux Kbuild mailing list, LKML
On Wed, Jan 21, 2026 at 10:30 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>
> On 1/21/26 10:24 AM, Gary Guo wrote:
> > On Wed Jan 21, 2026 at 6:16 PM GMT, Ihor Solodrai wrote:
> >> According to the docs [1], kernel build scripts should be executed via
> >> CONFIG_SHELL, which is sh by default.
> >>
> >> Fixup gen-btf.sh to be runnable with sh, and use CONFIG_SHELL at every
> >> invocation site.
> >>
> >> See relevant discussion for context [2].
> >>
> >> [1] https://docs.kernel.org/kbuild/makefiles.html#script-invocation
> >> [2] https://lore.kernel.org/bpf/CAADnVQ+dxmSNoJAGb6xV89ffUCKXe5CJXovXZt22nv5iYFV5mw@mail.gmail.com/
> >>
> >> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> >
> > I can indeed build again when applying this on top of linux-next. Thanks.
> >
> > Tested-by: Gary Guo <gary@garyguo.net>
> >
> > You probably also want to carry some Reported-by, Suggested-by and Fixes tags here.
>
> You're right. This should do it:
>
> Reported-by: Gary Guo <gary@garyguo.net>
> Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
> Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary output")
>
> Alexei, please lmk if I should re-send with tags.
All good. Applied manually.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution
2026-01-21 18:16 [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution Ihor Solodrai
2026-01-21 18:24 ` Gary Guo
@ 2026-01-21 20:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-21 20:40 UTC (permalink / raw)
To: Ihor Solodrai
Cc: ast, daniel, andrii, martin.lau, gary, linux, nathan, nsc, bpf,
linux-kbuild, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Wed, 21 Jan 2026 10:16:17 -0800 you wrote:
> According to the docs [1], kernel build scripts should be executed via
> CONFIG_SHELL, which is sh by default.
>
> Fixup gen-btf.sh to be runnable with sh, and use CONFIG_SHELL at every
> invocation site.
>
> See relevant discussion for context [2].
>
> [...]
Here is the summary with links:
- [bpf-next,v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution
https://git.kernel.org/bpf/bpf-next/c/26ad5d6e7630
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-21 20:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 18:16 [PATCH bpf-next v1] scripts/gen-btf.sh: Use CONFIG_SHELL for execution Ihor Solodrai
2026-01-21 18:24 ` Gary Guo
2026-01-21 18:30 ` Ihor Solodrai
2026-01-21 20:38 ` Alexei Starovoitov
2026-01-21 20:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox