本文主要是介绍如何快速了解一个内核模块,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
EXPORT_SYMBOL
EXPORT_SYMBOL_GPL
grep -E "EXPORT_SYMBOL|EXPORT_SYMBOL_GPL" * -nr | awk -F ":" '{print $3}' | awk -F "(" '{print $2}' |awk -F ")" '{print $1}' > log.EXPORT_SYMBOLcflow alais
方法1 指定目录
-
- 配置环境
sudo apt-get install graphviz;sudo apt-get install cflow
将 tree2dotx 放入 ~/bin
source ~/.profile
-
- 运行脚本生成 .svg 图
#在你感兴趣的目录下运行,最好不是linux 顶层目录下.
#dotdir
mkdir ../out
grep -E "EXPORT_SYMBOL|EXPORT_SYMBOL_GPL" * -nr --exclude=${0##*/} > ../out/log.EXPORT_SYMBOL_origin
grep -E "EXPORT_SYMBOL|EXPORT_SYMBOL_GPL" * -nr --exclude=${0##*/} | awk -F ":" '{print $3}' | awk -F "(" '{print $2}' |awk -F ")" '{print $1}' > ../out/log.EXPORT_SYMBOLcat ../out/log.EXPORT_SYMBOL| while read line
do
echo $line
find . -regex ".*\.c\|.*\.h" |xargs cflow -b -d 10 -m $line 2>/dev/null | tree2dotx 2>/dev/null | dot -Tsvg -o ../out/$line.svg
done
-
- 根据Kconfig Makefile .svg图分析
方法2 指定符号
# dotgif [ $# -ne 1 ];then
echo dotg symbol
exit -1
fisymbol=$1find . -regex ".*\.c\|.*\.h" |xargs cflow -b -d 10 -m ${symbol} 2>/dev/null | tree2dotx 2>/dev/null | dot -Tsvg -o ${symbol}.svg
echo output is ${symbol}.svg
资源下载
这篇关于如何快速了解一个内核模块的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!