[PATCH 2/2] tools/bootconfig: Export tracing state without the function graph tracer
From: Eduardo Mucelli Rezende Oliveira
Date: Sat Nov 28 2026 - 06:58:18 EST
The function graph tracer provides max_graph_depth. With that tracer
omitted, the unconditional read fails under set -e, and ftrace2bconf
exits before exporting any ordinary tracing state.
Read the depth only when tracefs provides it. Check each available
function graph filter file and keep the existing warning when an
expanded filter list is present.
Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@xxxxxxxxx>
---
tools/bootconfig/scripts/ftrace2bconf.sh | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index b685dd6b070b0c..de571ec11b4392 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -45,14 +45,20 @@ emit_kv() { # key =|+= value
}
global_options() {
- val=`cat $TRACEFS/max_graph_depth`
- [ $val != 0 ] && emit_kv kernel.ftrace_graph_max_depth = $val
- if grep -qv "^#" $TRACEFS/set_graph_function $TRACEFS/set_graph_notrace ; then
+ if [ -f "$TRACEFS/max_graph_depth" ]; then
+ val=$(cat "$TRACEFS/max_graph_depth")
+ [ "$val" != 0 ] && emit_kv kernel.ftrace_graph_max_depth = "$val"
+ fi
+ for filter in "$TRACEFS/set_graph_function" "$TRACEFS/set_graph_notrace"; do
+ if [ ! -f "$filter" ] || ! grep -qv "^#" "$filter"; then
+ continue
+ fi
cat 1>&2 << EOF
# WARN: Cannot export kernel.ftrace_graph_filter and kernel.ftrace_graph_notrace.
# Only the expanded function list is available.
EOF
- fi
+ break
+ done
}
kprobe_event_options() {
--
2.53.0