torvalds/linux
Getting started
This page is a quick reference for cloning, configuring, building, and running a Linux kernel from this tree. It is intentionally short. The authoritative how-to is Documentation/admin-guide/quickly-build-trimmed-linux.rst and Documentation/process/changes.rst.
Prerequisites
Read Documentation/process/changes.rst for the canonical list. The minimum versions of the most common tools (as of this revision) are:
| Tool | Minimum | Used for |
|---|---|---|
GNU C (gcc) |
8.1 | Compiling the kernel |
| Clang/LLVM | 13.0.1 | Optional alternative compiler |
Rust (rustc) |
1.78.0 | Building Rust support (CONFIG_RUST=y) |
| GNU make | 4.0 | Driving Kbuild |
| binutils | 2.30 | Linking |
| flex, bison | recent | Building kconfig |
| openssl | 1.1.1 | Module signing |
| pahole | 1.16 | BTF debug info (BPF) |
| bc | any | A few in-tree scripts |
On Debian/Ubuntu a starter set is:
sudo apt install build-essential bc bison flex libssl-dev libelf-dev \
dwarves zstd python3 git ccacheBuild
# Pick a defconfig matching your machine
make defconfig # Generic for the host arch
# or: make x86_64_defconfig
# or: make ARCH=arm64 defconfig
# Trim it down (optional) to only modules you have loaded
make localmodconfig
# Build the kernel and modules in parallel
make -j"$(nproc)"
make modules
# Install (test machine, not your daily driver)
sudo make modules_install
sudo make installCommon Make targets are documented at the top of Makefile and via make help. Useful ones:
make menuconfig— interactive Kconfig UImake olddefconfig— accept defaults for any new optionsmake savedefconfig— write a minimaldefconfigthat reproduces the current.configmake C=1— run sparse static analysis on changed filesmake W=1— turn on extra warnings
Cross-compiling
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j"$(nproc)" Image modules dtbsARCH= selects the directory under arch/. CROSS_COMPILE= is prefixed to all toolchain invocations.
Running in QEMU
For x86_64:
qemu-system-x86_64 \
-kernel arch/x86/boot/bzImage \
-append "console=ttyS0" \
-nographicFor arm64:
qemu-system-aarch64 -M virt -cpu cortex-a57 \
-kernel arch/arm64/boot/Image \
-append "console=ttyAMA0" -nographicAdd -initrd <cpio> to mount a root file system.
Building Rust
Rust support is opt-in. After installing rustc, bindgen, and the matching rust-src:
make LLVM=1 rustavailable # Self-check
make LLVM=1 menuconfig # Enable CONFIG_RUST and a Rust sample
make LLVM=1 -j"$(nproc)"See rust/ and the Rust support page.
Running tests
There are several test layers (see How to contribute → Testing for detail):
tools/testing/selftests/— kselftest harness, runnable user-space test programstools/testing/kunit/— KUnit, the in-kernel unit-test framework- BPF and KVM selftests under
tools/testing/selftests/{bpf,kvm}/
make kselftest # Build and run kselftest in place
./tools/testing/kunit/kunit.py run # KUnitWhere to read next
- Architecture — how the source tree maps to the running kernel.
- Subsystems — per-area deep dives.
- How to contribute — patch-by-email workflow.
- Reference → Configuration — Kconfig,
.config, and module signing.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.