Compiling IPv6 modules from source for DD-WRT

IPv6 modules in SSH console

DD-WRT provides a lot of builds for different flash chip sizes. Sometimes though, you might need a module or two that isn’t included in the compiled firmware. Fortunately because of the way DD-WRT is developed (open source) you are able to grab the DD-WRT kernel sources from SVN and do a bit of DIY kernel module compiling. Though its not as simple as it sounds, but hopefully this general guide you get you on your way in compiling kernel modules. For this specific guide I am demonstrating how to compile IPv6 modules.

My setup:

  • Ubuntu 12.10 (Virtual Machine)
  • Compiling for ASUS RT N66U, 3.10.2 kernel and revision 22118


This guide wouldn’t of been possible without the following websites that allowed me to learn how to do this myself:

Installing some development tools:

sudo apt-get install gcc g++ binutils patch bzip2 flex bison make gettext unzip zlib1g-dev libc6 subversion ncurses-dev ccache

These will be required during compiling kernel modules

Getting the required kernel source

Start by creating a directory to hold the kernel source:

cd ~
mkdir -p DD-WRT

Here I created a containing folder, in case you may want to checkout multiple kernel sources in the future.

Now you will need to pull the appropriate kernel source and revision number to match your current DD-WRT firmware via SVN. You can find your kernel version via:

uname -r

You will the need to match the reported number with the correct kernel source within SVN at /src/linux/universal:

svn checkout svn:// -r 22118

Apart from the kernel source, its also important to get the matching SVN revision that your currently running. In my case the revision number is 22118. It will take a bit of time to download everything.

Getting the DD-WRT toolchain(s) for compiling

cd /opt
tar jxvf current-toolchains.tar.bz2

The toolchain tar.bz2 package is about 1.3 GB in size, so grab a drink, do something else for while as it might take a while depending on your internet connection. Once the download is complete it will also take some time to extract as well. Once that’s completed its time to setup the make file.

Adding toolchain to $PATH

Before compiling you’ll need to use the correct toolchain, in my case I used the following:


Creating a .config file

Now you need to create a .config file in order to specify the modules you want to compile. The kernel source actually contains a lot of default config files for different builds. In my case there is a .config_bcmmips config in there that is perfect for my router. Switch into your kernel source directory:

cd ~/DD-WRT/linux-3.10

Change the kernel version to the one you actually downloaded from SVN.

The .config files are on the root of the kernel source, but take note, they are dot files. You simply need to copy the config that matches your router, in my case this config will be fine:

cp .config_bcmmips .config 

Regarding what IPv6 modules to compile, its really up to you, but here is a good set below, it provides the IPv6 modules and various modules for ip6tables to work effectively:


Save this file then run:

make modules ARCH=mips

Older guides on compiling don’t mention the ARCH parameter, but it is now required, otherwise the modules cannot be built. “mips” is likely the arch you want to compile for, but adjust this by all means if mips is not what you want.

You might receive the following error when you do this for the first time:

drivers/net/wireless/Kconfig:284: can't open file "drivers/net/wireless/rt3352/rt2860v2_ap/Kconfig"
make[1]: *** [config] Error 1
make: *** [config] Error 2

The error is referring to Ralink drivers that don’t appear to exist in SVN. I have no need for them, hence I did the most basic of fixes and simply edited the drivers/net/wireless/Kconfig file and commented out the following lines:

#source "drivers/net/wireless/rt3352/rt2860v2_ap/Kconfig"
#source "drivers/net/wireless/rt3352/rt2860v2_sta/Kconfig"

Now re-run the same make command, it should now build the request modules, plus others listed in the default bcmmips config. You may get asked a couple more prompts regarding IPv6 modules, just press enter to advance through the config and continue to the compiling. Compiling will take a bit of time, so be patient.

Finding the compiled IPv6 modules

So everything compiled successfully, now what? Well you need to grab the modules! An easy way to do this is to run a couple of simple find commands such as:

find . -name '6*.ko'
find . -name 'ip6*.ko'
find . -name 'nf*.ko'

You should now copy these out of the kernel source and onto your router on jffs and then insmod the modules one by one. Be careful of dependencies, the order of loading modules can be very important, a good order to use would be:


Your kernel may already contain some of these modules, you should check out my other article on getting an IPv6 tunnel working on K3.x builds to get a better understanding.

That’s pretty much, this has been a semi-generic guide, you may have to adapt some parts slightly if you are not using a Broadcom router for example, but hopefully its been helpful to you!

Share This: