Customizing the Disk Image
You can modify the disk image filesystem by creating async-local.sh script in the project root:
sync-local.sh
mnt/ directory.
See
Base/res/keymaps/ for available keyboard layouts.CMake Build Options
CMake options can be configured using:- Command Line
- ccmake (TUI)
- cmake-gui
Development Options
Sanitizers
Sanitizers
Runtime checks for memory corruption, undefined behavior, and other bugs:
ENABLE_ADDRESS_SANITIZER- Memory corruption checks (Lagom tests)ENABLE_KERNEL_ADDRESS_SANITIZER- Memory corruption checks (kernel)ENABLE_KERNEL_UNDEFINED_SANITIZER- Undefined behavior checks (kernel)ENABLE_KERNEL_UNDEFINED_SANITIZER_ALWAYS_DEADLY- Make UB checks fatalENABLE_MEMORY_SANITIZER- Uninitialized memory checks (Lagom)ENABLE_UNDEFINED_SANITIZER- Undefined behavior checks (userland)UNDEFINED_BEHAVIOR_IS_FATAL- Make UB sanitizer errors non-recoverable
Coverage & Fuzzing
Coverage & Fuzzing
ENABLE_KERNEL_COVERAGE_COLLECTION- KCOV API for kernel fuzzingENABLE_USERSPACE_COVERAGE_COLLECTION- Coverage for userspace (Clang only)ENABLE_FUZZERS- Build fuzzersENABLE_FUZZERS_LIBFUZZER- Clang libFuzzer-based fuzzersENABLE_FUZZERS_OSSFUZZ- OSS-Fuzz compatible fuzzers
Debug Symbols
Debug Symbols
ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS- Build kernel with-Og -ggdb3ENABLE_ALL_DEBUG_FACILITIES- Enable all debug macros + symbols (CI only)ENABLE_ALL_THE_DEBUG_MACROS- Enable all debug macros (CI only)
Compile-Time Checks
Compile-Time Checks
ENABLE_COMPILETIME_FORMAT_CHECK- Validatestd::formatstrings (default: ON)ENABLE_PCI_IDS_DOWNLOAD- Download PCI device database (default: ON)
Build Configuration
Toolchain & Architecture
Toolchain & Architecture
SERENITY_TOOLCHAIN-GNUorClangSERENITY_ARCH-x86_64,aarch64, orriscv64ENABLE_KERNEL_LTO- Build kernel with link-time optimizationENABLE_MOLD_LINKER- Use mold linker (build withToolchain/BuildMold.sh)
Component Selection
Component Selection
BUILD_<COMPONENT>- Enable/disable specific components (e.g.,BUILD_HEARTS)BUILD_EVERYTHING- Build all optional components
See Component Configuration for an interactive tool.
Language & Testing
Language & Testing
ENABLE_JAKT- Build Jakt compiler and Jakt applicationsJAKT_SOURCE_DIR- Path to local Jakt checkout for developmentINCLUDE_WASM_SPEC_TESTS- Include WebAssembly spec tests (requiresprettierandwabt1.0.35+)INCLUDE_FLAC_SPEC_TESTS- Include FLAC test suite
Lagom & Graphics
Lagom & Graphics
BUILD_LAGOM- Build Lagom (host libraries and tools)ENABLE_ACCELERATED_GRAPHICS- Use accelerated graphics APIsENABLE_COMPILER_EXPLORER_BUILD- Skip non-library entities (Lagom only)
Cache & Network
Cache & Network
SERENITY_CACHE_DIR- Location for downloaded files cacheENABLE_NETWORK_DOWNLOADS- Allow downloads during build (default: ON)
Debug Macros
Enable debug output for specific components:See
Meta/CMake/all_the_debug_macros.cmake for a complete list of available debug macros.Component Configuration
Use the interactiveConfigureComponents tool to select which components to build:
Ninja Build Targets
Special targets available inBuild/<architecture>/:
SuperBuild Advanced Usage
The SuperBuild manages two separate builds:- Lagom - Host tools (in
Build/lagom) - Serenity - Target OS (in
Build/<arch>)
Manual SuperBuild
Modifying Child Builds
- Serenity Build
- Lagom Build
Clang-Based Toolchain
Build SerenityOS with Clang instead of GCC:Serenity-Aware Clang Tools
The Clang toolchain includes libTooling-based tools:clang-formatclang-tidyclangd(optional)
Toolchain/Local/clang/bin/ and understand SerenityOS as a valid target.
Building clangd
Point your editor to the custom clang tools and a
compile_commands.json from a Clang build for richer error reporting.Clang-Format Updates
To get the latest clang-format:- LLVM APT (Recommended)
- Build from Source
- Official LLVM
For Debian-based distributions:
Tests
For information on running tests, see the Running Tests documentation.The documentation explains:
- Host tests (run with Lagom)
- Target tests (run on SerenityOS)
- Debugging CI test failures
Alternative Virtualization
Beyond QEMU, SerenityOS can run on:VirtualBox
VMware
Bare Metal
WSL2 Performance Notes
For better performance, copy the disk image to a native Windows partition:SERENITY_DISK_IMAGE to the Windows path (e.g., D:\serenity\_disk_image).
Quick Reference
Common CMake Commands
Common CMake Commands
Environment Variables
Environment Variables
Useful Ninja Targets
Useful Ninja Targets
