summaryrefslogblamecommitdiffstats
path: root/scripts/kopt2mod
blob: 8eb540e425c5a3cddc0aeabed4eee9b13f35fc25 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                      




                                                                                               
                                                               



                        
#!/bin/bash

[ $# -ne 1 ] && echo "Usage: ./kopt2mod <kernel_source_dir>" && exit 1

FILES=$(find $1 -name Kconfig)

for file in $FILES; do
	CURRENT=
	while read line; do
		if [[ "$line" =~ ^(config|menuconfig) ]]; then
			CURRENT=$(awk '{print $2}' <<<$line)
			continue
		fi
		[ -z "$CURRENT" ] && continue
		MOD="$(echo "$line" | grep -o -E "called [a-z0-9_\-]+\." | awk '{print $2}')ko"
		[[ "$MOD" == "ko" ]] && continue
		echo "$CURRENT activates $(dirname $file)/$MOD"
		CURRENT=
	done < "$file"
done