A Brief Overview of the Linux Source Tree


The Bootlin Elixir Cross Referencer is a great tool for searching different releases of the Linux kernel source code to find directories, files, symbols, etc. For the 5.10.17 version of the Linux kernel that we'll be using this semester, the direct link is https://elixir.bootlin.com/linux/v5.10.17/source.

Several source code directories will be especially important in this course. We encourage you to take a look around!

The kernel directory contains source code for core kernel subsystems. For example, later in the semester we will be talking about the kernel scheduler code that can be found under the kernel/sched/ directory, and much sooner than that we will use libraries that invoke the kernel's process fork code that is implemented in the kernel/fork.c file.

The include directory contains most kernel header files. Many of the significant kernel header files (which we will use later in the semester to implement kernel modules) are found under the include/linux directory. These kernel header files are different from the header files found under include/uapi/linux that Linux exports to userspace (which we will use from early on in the semester to implement user space programs).

The arch directory contains core architecture dependent code. For example, all x86 specific code is found under the arch/x86/ directory. The Raspberry Pi (version 3 and later) has an ARM processor architecture, so for this course we're only really interested in the code found under arch/arm. Underneath each architecture specific directory you'll find a directory structure that is very similar to the root linux source directory. For example, the arch/arm/kernel directory contains ARM architecture specific support for core kernel subsystems, and the arch/arm/include directory contains ARM-architecture dependent header files.

You also can use Elixir's powerful search capabilities to find symbols in the source code, even if (and perhaps expecially if) you don't know in which directories and files they are defined or used. For example, go to https://elixir.bootlin.com/linux/v5.10.17/source and type kthread (a kernel thread, something we will use a lot later in the semester) in the field where it says Search Identifier, and then click on the magnifying glass icon to the right. This will bring up a page with links to all the places in any directory or file where that symbol is defined or used.