CSI400-Reading Linux Kernel Source--tips
-
task_struct and associated macro and other structure definitions;
and the function schedule() are good places to start. I
printed the sched.h file containing the definition of task_struct
-
Kernel source on your own system in the default location:
Install the "kernel source" package of your distribution. It
puts into /usr/src/linux the source for the kernel verison used
by your distribution.
-
Appendix C of Bovet's book outlines the source tree structure.
-
Download:
-
Download from www.kernel.org
a compressed archive, say linux-2.4.15.gz into an ordinary user
directory.
-
tar fvzx compressed-tar-file-name
(f is for use the named file, v is for verbose to show you the files
unarchived, z is for uncompress it first, and x is for extract)
This creates a subdir. containing the source tree, named say linux-2.4.15
cd linux-2.4.15 (say)
ls
observe the directories described
in Appendix C
-
Bovet has a good source code index that references files by pathname relative
to the source tree.
-
"grepping" example (use the grep utility program to
search for files containing a given string or pattern)
cd include/linux
grep task_struct *.h
(observe report of sched.h)
-
Use a kernel source code browser web site such as lxr.linux.no