Building From Source
From DD-WRT Wiki
Building DD-WRT from source is not that difficult, but don't expect the build system to be as well maintained as OpenWrt. Brainslayer has not the time to do everything. Until the day comes that DD-WRT will build without any extra steps, I've written some scripts that will set up a build environment for DD-WRT. Newer builds of DD-WRT may break compatibility with these scripts. If this happens and I don't update them, please take the time to update them if you are sure your changes are appropriate.
Requirements
To build DD-WRT, you need a Linux machine. It should work on any reasonably modern machine with basic development tools installed. You'll need GNU Make, ncurses, and several other packages. I'd recommend using the OpenWrt pre-requisites as a guideline for what you need to get it building.
Instructions
The first step is to check out the desired revisoin from subversion repository at svn://svn.dd-wrt.com/DD-WRT. Starting with DD-WRT v23 SP2, the svn revision number should be indicated in the DD-WRT version string. Then you'll want to download the appropriate toolchain. This is a set of cross-compile development tools and libraries. Unpack the toolchain wherever you desire, the scripts below will set up symlinks appropriately.
I've created a couple scripts to set up the build environment for you. These scripts only pertain to building for BCM934xx based boards, x86 (MicroTek) and other platforms may need other changes.
After running these scripts, to build DD-WRT you simply need to:
1. Add your toolchains bin folder to your path environment variable. i.e. PATH=$PATH:/home/db90h/toolchains/4.1.0-uclibc 2. In DD-WRT/opt run ./install.sh, or ./install_WHATEVER.sh to build only a particular variant (i.e../install_micro.sh).
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).
--Jcollake 21:05, 5 Aug 2006 (CEST)