Quick Image Building Guide

This is a short guide for building an OpenWrt snapshot firmware image. To build a stable release, look to the beginners guide to building your own firmware. There is a FAQ about difference between a release and a snapshot build.
This guide is not intended to cover all pitfalls, but provides a quick way to build an OpenWrt image, if everything goes well. Guides with more information about building an OpenWrt image:
- Using the image builder;
- Beginners guide to building your own firmware.

The development branch can contain experimental code that is under active development and should not be used for production environments. Snapshot images may support additional hardware; however, it is experimental, considered unstable, and sometimes won't compile.

Prebuilt snapshot images do not come with any web interface or GUI. You will need to be comfortable using a command line and remote shell to install one yourself → See How to install LuCI and Use SSH to connect to the internet and install Luci Web interface

→

In Debian GNU/Linux 10 (buster) for example with:

sudo apt update

See examples of package installations.

If package list information is not downloaded (step 1.1), message can be:
E: Unable to locate package

In Debian GNU/Linux 10 (buster) leave sudo privileged mode for example by:


Maybe alter permissions. For Fedora 30?

umask 0022
git clone https://git.openwrt.org/openwrt/openwrt.git

For more info see: the OpenWrt source code.
If dependency is not installed (step 1.2), message can be:
-bash: git: command not found
If trying second time, message can be:
fatal: destination path 'openwrt' already exists and is not an empty directory.

For following steps go to the openwrt directory.

cd openwrt

If repository is not cloned (step 2.1), message can be:
-bash: cd: openwrt: No such file or directory


Select a branch to build (or leave this out to build from master)

git branch
git checkout <branch name>
./scripts/feeds update -a
./scripts/feeds install -a

If dependencies are not installed (step 1.2), messages can be:
Can't exec “make”: No such file or directory at ./scripts/feeds line 22.
Unsupported version of make found: make
Checking 'gcc'… failed.
Checking 'working-gcc'… failed.
Checking 'g++'… failed.
Checking 'working-g++'… failed.
Checking 'ncurses'… failed.
Checking 'awk'… failed.
Checking 'unzip'… failed.
Checking 'bzip2'… failed.
Checking 'wget'… failed.
Checking 'python'… failed.
Checking 'python3'… failed.
Checking 'file'… failed.
If directory is wrong (step 2.2), message can be:
-bash: ./scripts/feeds: No such file or directory

make menuconfig

This opens the OpenWrt configuration menu for setting target and options.

E.g. for target “TL-WR841N v11” Wi-Fi router do following:

  • “Target System” ⇒ “Select” ⇒ “Atheros AR7xxx/AR9xxx” ⇒ “Select”
  • “Subtarget” ⇒ “Select” ⇒ “Devices with small flash” ⇒ “Select”
  • “Target Profile” ⇒ “Select” ⇒ “TP-LINK TL-WR841N/ND v11” ⇒ “Select”

To exit OpenWrt configuration and save target with options settings do following:

  • “Exit” ⇒ “Yes”

Completion can take time.If successful, the images are in directory ./bin/targets/ar71xx/generic/

  • The *-factory.bin image file is for the first installation of OpenWrt on the target.
  • The *-sysupgrade.bin image file is for updating an existing OpenWrt installation.


  • For recompiling the images, just execute make again.
  • For faster compiling, use make -j N, where N is the number of CPU cores + 1. Be aware that this method is prone to errors during compiling. In case you encounter compile errors, your very first step is to compile again without -j N. Use of make download prior to parallel compilation is recommended to prevent some of these errors (-jN is generally safe for the download step for those with faster Internet connectivity.)
  • Change settings with make menuconfig and compile again.
  • You can include custom files in your image by placing them in <buildroot>/files, e.g. if you want to have my_config included in your image in the directory /etc/config/<buildroot>/files/etc/config/my_config. If the files directory doesn't exist on your buildsystem, then create it.
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2021/04/18 14:36
  • by spyro1248