Prerequisites
Before you begin, ensure your system meets the requirements. Install the build dependencies for your distribution:You need at least 15 GB of free disk space and 4 GB of RAM. The first build downloads source archives and compiles a complete cross-compilation toolchain, which takes 30–90 minutes on modern hardware.
Build your firmware
Clone the repository
Clone OpenWrt from GitHub and enter the directory:To build a specific stable release instead of the development branch:
Update and install feeds
Feeds are external package repositories. Update their package lists and create symlinks for all packages:This populates
package/feeds/ with symlinks to all feed packages, making them available in menuconfig.Configure your build
Launch the interactive configuration menu:At minimum, select:
- Target System — the CPU architecture (e.g.,
Atheros ATH79,MediaTek Ralink MIPS,x86) - Subtarget — the specific SoC or board family
- Target Profile — your specific router model
[*]— built into the firmware image[M]— compiled as a separate.ipkinstallable package[ ]— excluded
S, then exit with Q.Build
Start the build with parallel jobs:For verbose output useful when troubleshooting:The build compiles in this order:
- Host tools (e.g.,
mkimage,mksquashfs) - Cross-compilation toolchain (GCC + musl libc)
- Linux kernel for your target
- All selected packages
- Firmware image assembly
Rebuild a single package
After the initial build, you can recompile just one package without rebuilding everything:curl:
Clean the build
| Command | What it removes |
|---|---|
make clean | Build output (build_dir/, bin/) |
make dirclean | Everything clean removes, plus the cross-toolchain and host tools in staging_dir/ |
make distclean | Everything dirclean removes, plus .config*, dl/ (downloaded sources), feeds/, and signing keys |
Next steps
Build System
Understand the full build pipeline and available make targets
Supported Devices
Find your device and check supported features
Package Development
Create and port packages to OpenWrt
Core Concepts
Learn the OpenWrt architecture and subsystems