How To Build LibreWRT

From LibreWRT

Jump to: navigation, search


What do I need to get started?

You will need the following resources to successfully build a LibreWRT image.

  • 7 GB of free disk space for one target (+6 GB for each additional target).
  • A GNU/Linux distribution. See for our recommended list of GNU/Linux distributions. LibreWRT should work with any GNU/Linux distribution, but has been specifically tested in the fully free distribution Trisquel GNU/Linux.
  • bzr
  • flex
  • gcc GNU Compiler Collection
  • gcc-multilib
  • git-core
  • GNU awk or gawk
  • libghc6-zlib-dev
  • ncurses-dev
  • patch
  • perl
  • qemu (if you want to run the x86 build)
  • quilt
  • subversion
  • wget
  • some time to kill

It is also highly recommended to have:

  • ccache

Build LibreWrt

There are two ways to build LibreWrt "Creative Craftsman" 2.0:

Build manually from the source tarball

Get the source code

The first step is to download and unzip the source code of the latest stable version 2, codenamed "Creative Craftsman":


Unzip it and look inside.

tar -jxvf librewrt-src.tar.bz2
cd librewrt

Setup feeds

The supported feeds are inside the Creative Craftsman's source tree already (only a small fraction of packages is included currently), so you don't have to do anything.

Get the default LibreWrt configuration file

You need to get the appropriate .config file for your target. For example, the Ben NanoNote users should get this one:

wget -O .config

For the Buffalo router get this one:

wget -O .config

Configure the initial build

According to bug #34, you'll probably need to do this first:

rm scripts/config/*.o scripts/config/conf

if you build LibreWRT 2.

We then need to configure LibreWRT for our needs. We also need to make sure that we have met all of the requirements that are needed for LibreWRT to build.

make menuconfig

Select the target architecture and any additional packages that you would like to include in your image.

Many GNU packages are available for use: LibreWRT uses a kernel called GNU Linux-libre, which became an official GNU package in March 2012. Also available are things like BASH, Emacs, GDB, gblic, etc. However: There is a great deal of flexibility in compiling the firmware image and almost any package can be included or left out or replaced (glibc can be substituted for a different C library for example.) The only one that can't really be left out though is the kernel called GNU Linux-libre.

If you are building for the Ben Nanonote, please make sure to select / enable u-boot under the Boot Loader menu. Once all configuration settings have been set, exit menuconfig.

The Ben NanoNote users have one more thing to do. Create the following symbolic link to make the default Ben configuration files available to a build process:

ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files

Setup Linux

You may want to change the default kernel configuration for your target hardware. Creative Craftsman contains kernel config files for each target. You can copy one into the LibreWrt source tree like this:

kver=`grep '^CONFIG_LINUX_.\+=y$' .config | sed 's/^CONFIG_LINUX_\(.\+\)=y$/\1/' | sed 's/_/./g'`
mv qi_lb60-kernel-config target/linux/xburst/config-$kver

After this you can tweak the kernel configuration using

make kernel_menuconfig

Build the image

You can then begin compiling the LibreWRT image by issuing:


The speed of the build can be increased by using more than 1 concurrent job process. With the -j-option, the most common suggestion is to use <your number of CPUs + 1>, so on a dual core CPU, do:

make -j 3

If you happen to run into any issues during the compiling process, run make with V=99 to see any errors that are generated during the compiling process.

make V=99

This is going to take a while, depending on the speed of your machine, network connection, and how much software was selected in menuconfig.

Build using the Builder

Quick instructions

Get the builder:

 bzr branch
 cd creative-craftsman

To build the LibreWrt 2 for Ben NanoNote:

 ./ -i -t qi_lb60 -u -r 2.0-release

or to build it for Buffalo WZR-HP-G300NH:

 ./ -i -t wzr-hp-g300nh -u -r 2.0-release

or to build it for some other platform:

 mkdir targets/my-target
 ./ -i -t my-target -u -r 2.0-release

You'll get two menuconfigs sequentially: for the LibreWrt and for the Linux. Select your platform (in case of "my-target") and/or tweak other options, then save each config and say 'yes' when asked to overwrite. After that the build will start.

Next time you run the build, you can omit the "-u -r 2.0-release" part of command line; likewise, if you don't want to tune options anymore, just don't use "-i".


You can find more info about the Builder in its README file and by using the command

 ./ --help

Please note that the Builder is not rock stable, so if you think you've found some bug, please ask at IRC or at the mailing list.

Bright Ben (obsolete)

"Bright Ben" is the codename of the first LibreWrt version which is not supported anymore. This text describes how to build it.

Closing thoughts

If you have any questions, comments or bug-reports, please use the mailing lists.

Personal tools