Installing A Custom Openwrt Build On An ASUS RT-N16
13 Jul 2015
My home router has been acting up recently so I decided to take control of it by installing OpenWRT. I’ve used DD-WRT and tomato in the past, but wanted something a little more hackable and less shiny. OpenWRT seems like a perfect fit!
Luckily the base port for the RT-N16 is already done and there’s a fairly
extensive (though outdated and at times inaccurate)
entry for the RT-N16 on the
OpenWRT wiki. I was able to load the
Barrier Breaker 14.07 build on my
RT-N16 but only one of the ethernet ports worked… I decided to try a
newer OpenWRT release to see if things would work any better.
15.05 isn’t officially released yet I decided I might as well set
my own build environment in case I want to do some additional
hacking/debugging. The information needed to do so is kind of spread out
across the OpenWRT wiki, mailing list, and forum threads, so I thought I’d
document the process all in one place for any future wary travelers.
Most of this is documented on the OpenWRT wiki. The main entry point for the build system documentation is http://wiki.openwrt.org/about/toolchain.
Getting the Sources
First, we’ll clone the base OpenWRT tree:
$ git clone git://git.openwrt.org/15.05/openwrt.git openwrt-15.05
Many of the OpenWRT packages are delivered in “package feeds” that need to be initialized separately:
$ cd openwrt-15.05 $ ./scripts/feeds update -a $ ./scripts/feeds install -a
OpenWRT uses the buildroot build system which has an interface similar to the Linux kernel Kconfig system. These build systems include the concept of a “default config”, or “defconfig”, which selects many of the rudimentary options necessary for basic operation of a given target or platform. We’ll be using the defconfig for the Broadcom system on which the RT-N16 is based as a starting point.
In order for the OpenWRT build system to know which defconfig it should
you must select your target system
make defconfig. You do this through the
$ make menuconfig
For the RT-N16 we’ll select:
Target System: Broadcom BCM47xx/53xx (MIPS) Subtarget: MIPS 74K Target Profile: Broadcom SoC, BCM43xx WiFi (proprietary wl)
Don’t worry about selecting any other packages yet. You can now pull in
the options from the
defconfig by running:
$ make defconfig
We now have a nice baseline with all of the essentials for the RT-N16 selected. We can now select any additional packages we’d like to include in our firmware image:
$ make menuconfig
A few of the packages I selected were
kernel function tracer,
tmux. I believe all of these except
function tracer can be installed on your live target using
opkg rather than building
them into the firmware image, but oh well.
You’re now ready to build:
$ make -jN |& tee build.log
N equals the number of cpus on the build host plus one. To
increase verbosity and also ignore build errors in optional modules, use:
$ make -jN V=99 IGNORE_ERRORS=m |& tee build.log
Once that’s done (took around an hour on my machine) our freshly-cooked
firmware image will be in the
blog comments powered by Disqus
- GitHub Profile
- Stack Overflow Careers Profile
- Stack Overflow Profile
- G+ Profile
- PGP Public Key
- Rafty -- Ripper and Friggin Transcoder, Y'all
- Make Readme Markdown
- Diffview Mode
- Indent Hints Mode
- Track That Thing
- Co-Founder & CEO of Directangular, LLC.
- Previously: Linux Kernel development for QuIC. Some of my work (a little stale) is available on the Code Aurora Forum, here, here, here, and here.
- My nerd hobby: Creating and contributing to a variety of Open Source projects. See my GitHub profile.