How To Build LibreWRT
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 gnu.org/distros 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.
- gcc GNU Compiler Collection
- GNU awk or gawk
- qemu (if you want to run the x86 build)
- some time to kill
It is also highly recommended to have:
There are two ways to build LibreWrt:
- Use the Builder (recommended). It will automate most of the job. Using the Builder you can either build the recent alpha release of Creative Craftsman or build the bleeding edge version of Creative Craftsman.
- Build it manually from the source tarball. This way involves more typing. You'll get the recent alpha release of Creative Craftsman.
Build using the Builder
Get the builder:
bzr branch http://bzr.librewrt.org/builder/creative-craftsman cd creative-craftsman
Option 1. To build the bleeding edge LibreWrt:
./deblob.sh # For Ben NanoNote: ./build.sh -t qi_lb60 -l # For Buffalo WZR-HP-G300NH: ./build.sh -t wzr-hp-g300nh -l
Option 2. To download and build the latest alpha release:
# For Ben NanoNote: ./build.sh -t qi_lb60 -u -r latest # For Buffalo WZR-HP-G300NH: ./build.sh -t wzr-hp-g300nh -u -r latest
You can find more info about the Builder in its README file.
Build manually from the source tarball
Get the source code
The first step is to download and unzip the source code of the upcoming version 2, codenamed "Creative Craftsman" (Note: this is just a development snapshot, so it may contain bugs):
Unzip it and look inside.
tar -jxvf librewrt-src.tar.bz2 cd librewrt
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:
For the Buffalo router get this one:
Configure the initial build
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.
Select the target architecture and any additional packages that you would like to include in your image. 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
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:
wget http://download.librewrt.org/creative-craftsman/latest/source/qi_lb60-kernel-config 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
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.
This is going to take a while, depending on the speed of your machine, network connection, and how much software was selected in menuconfig.
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.
If you have any questions, comments or bug-reports, please use the mailing lists.