Building From Source
From DD-WRT Wiki
Building DD-WRT from source is quite a daunting task. There isn't much documentation on this process on the official site, although Peter Cardoe's site is indeed very helpful. Hopefully expanding on his work will make it an easier process for newbies like me.
Requirements
To build DD-WRT, you need a Linux machine. It should work on any reasonably modern machine, as long as you have a compiler installed - note that this may not be strictly necessary but I haven't tried it any other way.
- The first step is to download the proper source from the download page or check it out of the subversion repository at svn://svn.dd-wrt.com/DD-WRT. Should be straightforward.
- If you downloaded an archive, unpack it into a directory of your choice by running tar jxvf FILENAME. Change to the directory that process creates, probably named "DD-WRT" or something similar.
- Download the appropriate toolchain. This is a set of cross-compile tools. Unpack the toolchain wherever, but one suggestion is /location?/of?/ddwrtdirectory?/toolchain.
- Make a workspace directory and some folders needed by the build process. The name of the "toolchain" directory must be as shown. You may need to be "root" to create the first directory.
Here is my work on building DD-WRT. I've created a couple scripts to set up the build environment for you to make life easier on those wanting to create their own builds of DD-WRT.
After running these scripts, to build DD-WRT you simply need to:
1. Add your toolchains bin folder to your path environment variable. 2. In DD-WRT/opt run ./install.sh, or ./install_WHATEVER.sh to build only a particular variant.
These instructions are valid as of DD-WRT v23 SP2 beta 08/03/06.
#!/bin/sh # # title: ready_ddwrt.sh # version: 1.0 # author: Jeremy Collake <jeremy@bitsum.com> aka db90h # # This silly script will prepare a build environment # for DD-WRT. You must also run ready_ddwrt_root.sh. # MINPARAMS=2 if [ $# -lt "$MINPARAMS" ] then echo usage: echo ready_ddwrt.sh [ddwrt_base_path] [toolchain_base_path] echo echo i.e.: echo ready_ddwrt.sh /home/db90h/DD-WRT /home/db90h/3.4.6-ucliblc-0.9.28 echo exit 1 fi ME=`whoami` DDROOT=$1 TCHAIN=$2 echo I am $ME echo DD-WRT is at $DDROOT echo mipsl-uclibc-x toolchain is at $TCHAIN echo ................................................................ echo creating some symlinks echo ................................................................ rm $DDROOT/src/linux/brcm/linux.v23/include/asm ln -s $DDROOT/src/linux/brcm/linux.v23/include/asm-mips $DDROOT/src/linux/brcm/linux.v23/include/asm echo done echo ................................................................ echo adjusting some attributes echo ................................................................ chmod +x $DDROOT/src/router/iptables/extensions/.dccp-test chmod +x $DDROOT/src/router/iptables/extensions/.layer7-test echo done echo ................................................................ echo re-building some tools echo ................................................................ cd $DDROOT # make bb_mkdep cd src/router/busybox/scripts rm bb_mkdep make bb_mkdep # make jsformat cd ../../../.. cd src/router/tools rm jsformat make jsformat cd ../../.. cd src/squashfs-tools/ rm mksquashfs-lzma make cp mksquashfs-lzma ../linux/brcm/linux.v23/scripts/squashfs cd ../.. echo done
This second script needs to be run as root ...
#!/bin/sh # # title: ready_ddwrt_root.sh # version: 1.0 # author: Jeremy Collake <jeremy@bitsum.com> aka db90h # # This silly script will prepare a build environment # for DD-WRT. You must also run ready_ddwrt.sh. # MINPARAMS=2 if [ $# -lt "$MINPARAMS" ] then echo echo This script needs root access. echo echo usage: echo ready_ddwrt_root.sh [ddwrt_base_path] [toolchain_base_path] echo echo i.e.: echo ready_ddwrt_root.sh /home/db90h/DD-WRT /home/db90h/3.4.6-ucliblc-0.9.28 echo exit 1 fi ME=`whoami` DDROOT=$1 TCHAIN=$2 echo I am $ME echo DD-WRT is at $DDROOT echo mipsl-uclibc-x toolchain is at $TCHAIN echo ................................................................ echo creating some symlinks echo ................................................................ # duh, this will already be here mkdir -p /opt rm /opt/3.3.6 ln -s $TCHAIN /opt/3.3.6 rm /GruppenLW ln -s $DDROOT/image /GruppenLW echo All done!
This page is only marginally useful; you do a lot of work and end up with a stock firmware. You may also want to see modifying DD-WRT (todo: fix this link).