Browsing the Linux Kernel source

I recently started using cscope and I thought I’d briefly type up the quick start for browsing the kernel source

1. emerge cscope
2. identify a directory to put your cscope generated files (~/cscope)
3. run the command to extract the appropiate files that will included in the search. This command and more detailed instructions can be obtained from here thanks to Jason Duell.


find $LNX \
-path "$LNX/arch/*" ! -path "$LNX/arch/i386*" -prune -o \
-path "$LNX/include/asm-*" ! -path "$LNX/include/asm-i386*" -prune -o \
-path "$LNX/tmp*" -prune -o \
-path "$LNX/Documentation*" -prune -o \
-path "$LNX/scripts*" -prune -o \
-path "$LNX/drivers*" -prune -o \
-name "*.[chxsS]" -print >~/cscope/cscope.files

4. execute cscope -b -q -k in ~/cscope
5. run cscope -d

I was looking for the define of module_param_named and cscope told me where was in sub-second time:

Global definition: module_param_named

File Line
0 moduleparam.h 81 #define module_param_named(name, value, type, perm) \

Find this C symbol:
Find this global definition: module_param_named
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:

cscope home page:
http://cscope.sourceforge.net/large_projects.html

1 Comment

  1. Az

    Thank you! This functionality was exactly what I was looking for, today.

Leave a Comment

Your email address will not be published. Required fields are marked *