---
tags: Openwrt
---
# Building guide
---
# Update and install feeds
---
[OpenWrt Feeds](https://openwrt.org/docs/guide-developer/feeds)
In OpenWrt, a “feed” is a collection of packages which share a common location.
```bash
./scripts/feeds update -a
./scripts/feeds install -a
```
# Configure target and options
---
```bash
make menuconfig
```
E.g. for target "armvirt32"
```bash
Target System (QEMU ARM Virtual Machine) ---> │ │
Subtarget (QEMU ARM Virtual Machine (cortex-a15)) ---> │ │
```
# Build image
---
```bash
make -j1 V=sc
```
The parameter V=x specifies level of messages in the process of the build.
```bash
V=99 and V=1 are now deprecated in favor of a new verbosity class system,
though the old flags are still supported.
You can set the V variable on the command line (or OPENWRT_VERBOSE in the
environment) to one or more of the following characters:
- s: stdout+stderr (equal to the old V=99)
- c: commands (for build systems that suppress commands by default, e.g. kbuild, cmake)
- w: warnings/errors only (equal to the old V=1)
```
Completion can take time. If successful, the images are in directory `./bin/targets/armvirt/32`
```bash
~/openwrt/bin/targets/armvirt/32$ ls
config.buildinfo openwrt-armvirt-32-root.ext4 openwrt-armvirt-32-zImage version.buildinfo
feeds.buildinfo openwrt-armvirt-32-root.ext4.gz openwrt-armvirt-32-zImage-initramfs
openwrt-armvirt-32-default.manifest openwrt-armvirt-32-rootfs.cpio.gz packages
openwrt-armvirt-32-default-rootfs.tar.gz openwrt-armvirt-32-root.squashfs.gz sha256sums
```
## Building single packages
---
```bash
~/openwrt$ make package/network/services/dnsmasq/compile V=s
```
For a rebuild
```bash
~/openwrt$ make package/network/services/dnsmasq/clean V=s
~/openwrt$ make package/network/services/dnsmasq/compile V=s
```
# Cleaning up
---
## Clean
---
```bash
make clean
```
deletes contents of the directories `/bin` and `/build_dir`.
## Dirclean
---
```bash
make dirclean
```
deletes contents of the directories `/bin` and `/build_dir` and additionally `/staging_dir` and `/toolchain` (=the cross-compile tools), /tmp (e.g data about packages) and `/logs`.
## Distclean
---
```bash
make distclean
```
nukes everything you have compiled or configured and also deletes all downloaded feeds contents and package sources.
In addition to all else, this will erase your build configuration (`<buildroot_dir>/.config`).
## Clean less
---
Clean linux objects.
```bash
make target/linux/clean
```
Clean package base-files objects.
```bash
make package/base-files/clean
```