Firstly get yourself the toolchains from http://www.dd-wrt.com/dd-wrtv2/downloads/others/sourcecode/toolchains/current-toolchains.tar.bz2 and extract. Be sure to add them to your path.
The next thing you need is the kernel source for the kernel you are running. I'm currently using 188.8.131.52 (which is wrongly labelled 2.6.23 in subversion). To get that run
svn co svn://svn.dd-wrt.com/DD-WRT/src/linux/brcm/linux-2.6.23
This also quite handily comes with the configuration they used to build the image. To use it:
cp .config_std .config make oldconfig
That's the kernel sorted. From what I can remember at this stage, that's all I required to get going. Next time, we'll build ip6tables and get that installed on the router.