tools/bootconfig/scripts/ftrace2bconf.sh

Source file repositories/reference/linux-study-clean/tools/bootconfig/scripts/ftrace2bconf.sh

File Facts

System
Linux kernel
Corpus path
tools/bootconfig/scripts/ftrace2bconf.sh
Extension
.sh
Size
5908 bytes
Lines
261
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only

usage() {
	echo "Dump boot-time tracing bootconfig from ftrace"
	echo "Usage: $0 [--debug] [ > BOOTCONFIG-FILE]"
	exit 1
}

DEBUG=
while [ x"$1" != x ]; do
	case "$1" in
	"--debug")
		DEBUG=$1;;
	-*)
		usage
		;;
	esac
	shift 1
done

if [ x"$DEBUG" != x ]; then
	set -x
fi

TRACEFS=`grep -m 1 -w tracefs /proc/mounts | cut -f 2 -d " "`
if [ -z "$TRACEFS" ]; then
	if ! grep -wq debugfs /proc/mounts; then
		echo "Error: No tracefs/debugfs was mounted."
		exit 1
	fi
	TRACEFS=`grep -m 1 -w debugfs /proc/mounts | cut -f 2 -d " "`/tracing
	if [ ! -d $TRACEFS ]; then
		echo "Error: ftrace is not enabled on this kernel." 1>&2
		exit 1
	fi
fi

######## main #########

set -e

emit_kv() { # key =|+= value
	echo "$@"
}

global_options() {
	val=`cat $TRACEFS/max_graph_depth`
	[ $val != 0 ] && emit_kv kernel.fgraph_max_depth = $val
	if grep -qv "^#" $TRACEFS/set_graph_function $TRACEFS/set_graph_notrace ; then
		cat 1>&2 << EOF
# WARN: kernel.fgraph_filters and kernel.fgraph_notrace are not supported, since the wild card expression was expanded and lost from memory.
EOF
	fi
}

kprobe_event_options() {
	cat $TRACEFS/kprobe_events | while read p args; do
		case $p in
		r*)
		cat 1>&2 << EOF
# WARN: A return probe found but it is not supported by bootconfig. Skip it.
EOF
		continue;;
		esac
		p=${p#*:}
		event=${p#*/}
		group=${p%/*}
		if [ $group != "kprobes" ]; then
			cat 1>&2 << EOF

Annotation

Implementation Notes