CSI400-Reading Linux Kernel Source--tips

  1. 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
  2. Kernel source on your own system in the default location:

  3. Install the "kernel source" package of your distribution.  It puts into /usr/src/linux the source for the kernel verison used by your distribution.
  4. Appendix C of Bovet's book outlines the source tree structure.
  5. Download:
    1. Download from  www.kernel.org   a compressed archive, say linux-2.4.15.gz into an ordinary user directory.
    2. tar fvzx compressed-tar-file-name
      1. (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
  6. Bovet has a good source code index that references files by pathname relative to the source tree.
  7. "grepping"  example  (use the grep utility program to search for files containing a given string or pattern)
    1. cd include/linux
      grep task_struct *.h
      (observe report of sched.h)
  8. Use a kernel source code browser web site such as  lxr.linux.no

  9.