How To Build LibreWRT

From LibreWRT

Jump to: navigation, search

Contents

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.
  • 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:

  • 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

Quick instructions

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

Support

You can find more info about the Builder in its README file.

Please note that the Builder is of alpha quality yet, so if you found some bug, please describe it in our mailing list or report it in the bug tracker.

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):

wget http://download.librewrt.org/creative-craftsman/latest/source/librewrt-src.tar.bz2

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 http://download.librewrt.org/creative-craftsman/latest/source/qi_lb60-config -O .config

For the Buffalo router get this one:

wget http://download.librewrt.org/creative-craftsman/latest/source/wzr-hp-g300nh-config -O .config

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.

make menuconfig

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

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:

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

make kernel_menuconfig

Build the image

You can then begin compiling the LibreWRT image by issuing:

make

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.

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