The Linux kernel source tree can seem daunting at first, especially when you’re just getting started. This guide breaks down the top-level structure of the kernel source directory, so you know where to look for what.
📂 Top-Level Directory Structure of Linux Kernel (v6.1)
Name | Type | Description |
---|---|---|
COPYING |
File | GPL license text (legal terms for usage and distribution). |
CREDITS |
File | List of contributors to the Linux kernel with roles and contacts. |
Kbuild |
File | Build system metadata; included by many Makefiles across subdirs. |
Kconfig |
File | Global configuration menu entry point (used in make menuconfig ). |
LICENSES/ |
Dir | SPDX license texts used in various parts of the kernel. |
MAINTAINERS |
File | List of maintainers per subsystem + file patterns for reporting bugs. |
Makefile |
File | Top-level Makefile: entry point for building the kernel. |
README |
File | Getting-started documentation for building and booting the kernel. |
System.map |
File | Kernel symbol table (maps symbols to addresses). Useful for debugging. |
Module.symvers |
File | Symbol versioning info for external modules to ensure compatibility. |
arch/ |
Dir | Architecture-specific code (x86, ARM, RISC-V, etc.). |
block/ |
Dir | Block layer (e.g., block devices, request queues, I/O scheduling). |
certs/ |
Dir | Code and config for kernel module signature verification. |
crypto/ |
Dir | Cryptographic algorithms and APIs used in-kernel. |
drivers/ |
Dir | All device drivers (USB, GPU, network cards, etc.). |
fs/ |
Dir | File systems (ext4, xfs, NFS, FUSE, VFS layer, etc.). |
include/ |
Dir | Header files (include/linux/ , include/uapi/ , etc.). Used by kernel and modules. |
init/ |
Dir | Code run during kernel initialization (early boot). |
io_uring/ |
Dir | Fast async I/O subsystem introduced in newer kernels. |
ipc/ |
Dir | System V IPC mechanisms: semaphores, message queues, shared memory. |
kernel/ |
Dir | Core kernel code: scheduler, syscalls, fork/exec, timers, locking, etc. |
lib/ |
Dir | Generic helper libraries (math, RCU, string handling, bitmaps, etc.). |
mm/ |
Dir | Memory management subsystem (VM, page cache, slab, etc.). |
net/ |
Dir | Networking stack (TCP/IP, sockets, routing, protocols). |
rust/ |
Dir | [Optional] Rust language support in kernel (emerging in recent kernels). |
samples/ |
Dir | Sample kernel modules and features (e.g., BPF, tracepoints, etc.). |
scripts/ |
Dir | Scripts for building, checking, and preparing kernel modules. |
security/ |
Dir | Security modules: SELinux, AppArmor, Smack, LSM framework. |
sound/ |
Dir | Audio subsystem (ALSA, OSS, SoC audio). |
tools/ |
Dir | User-space tools (e.g., perf , bpf , selftests ). |
usr/ |
Dir | Initramfs image creator (usr/initramfs_data.cpio ). Used during kernel build. |
virt/ |
Dir | Virtualization support (KVM, guest hypervisors). |
🧱 Generated Build Artifacts (After make
)
File/Folder | Type | Description |
---|---|---|
vmlinux |
File | Uncompressed kernel image (ELF format). Contains full kernel. |
vmlinux.o |
File | Linked object file (intermediate format before final vmlinux ). |
vmlinux.a |
File | Archive of compiled objects before linking into vmlinux.o . |
vmlinux.symvers |
File | Symbol version mapping (used by external modules). |
built-in.a |
File | Statically linked object archive (combined .o files). |
modules.order |
File | List of modules compiled and their order of loading. |
modules.builtin |
File | List of built-in modules (not .ko , but statically linked). |
modules.builtin.modinfo |
File | Metadata of built-in modules for modinfo , depmod . |
✅ Pro Tips
- Run
tree -L 1
inside the kernel root directory to visualize the structure. - Most of your time will be spent inside:
kernel/
,arch/x86/
,include/linux/
,arch/x86/entry/syscalls/
— for syscall and core development.drivers/
andfs/
— for device drivers and file systems.tools/
— for advanced tools likeperf
,bpf
, andcpupower
.
This directory map is your compass when navigating the massive Linux kernel. Happy hacking! 🐧💻