Pages

Monday 7 February 2011

DD-WRT Cross Compile Environment

At some stage you'll want to build and run software on your router that wasn't bundled with it, especially if you bought an open source one like I did. You will need a 64bit Linux environment, as the DD-WRT mips toolchains are built for I used Debian Lenny in Virtual Box to do this. You'll need a basic toolchain and subversion installed, so if like me you use Debian you'll need to install the subversion and build-essential packages. This page is adapted from the guides on the DD-WRT wiki.


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 2.6.24.111 (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.

7 comments:

  1. You have my attention, right now i am trying to figure how to build an updated kismet drone binary for my box, as all existing old ipkgs like the one I have used for years don't talk to any new kismet version.

    Documentation on the Xcompilers is scarce unless you want to build a complete dd-wrt image rather than a small app.

    cheers

    ReplyDelete
  2. Yeah, I know what you mean, it took me a lot of fiddling to get it going. Once you have the toolchains listed above, add the bin folder of the toolchain you need to your path.

    Spoiler from next post: most configure scripts accept a --target option. Use that to specify cross-compile options, eg ./configure --target=mipsel-linux-uclibc. However it seems rare that that just works.

    On another note, I've just found another blog that has content I've covered some of the things I have (and am going to) but only appear to have built kernel modules from scratch.

    http://blog.dest-unreach.be/

    ReplyDelete
  3. Yeah well hca, I'm almost on the same boat as you do, except that unlike you, I never have tried kismet in the past, now trying it for the first time, but gosh, WRT54GL is a real PITA!!!

    Cannot get any version to work, so I also thought of trying to cross compile, but with a newborn baby at house I don't have much time (and patience!!) to try it. We hope for the next post Andee, thanks in advance!

    ReplyDelete
  4. The kismet problem is they changed the protocol from the clone around 2007. The old server side wont compile against new distro libs and compilers are a lot more fussy now.

    I ran kismet clone in the GL 50 feet above the house for ages with out issue, same as the ones I put the serial port in.



    I found another chap whose done the kismet into a WRT54 recently and has posted a bin file. I grabbed the bin and split it, using the re-mastering scripts on the dd-wrt wiki.

    I hope a re-tweak of the init and etc and its sorted.

    looks its set up for auto start kismet which I don't want. But I had no problem with putting setserial and ser2net into DDWRT V23 with the The firmware mod tool here

    http://www.dd-wrt.com/wiki/index.php/Building_From_Source#Building_DD-WRT_From_Source


    If you have your app binary and its standalone, you can past it and the config files in with this. Its easy and it works.




    hes is using the tool chains as well.

    I Xcompile for pics alot, easy compared to these toolcahins. I had 3 goes at it over the years. ARRGH


    But check this out http://redlinesec.blogspot.com/

    ReplyDelete
  5. Henrique

    I have dd-wrt in about 6 gls, some v23.1 a couple v24 You want I check the build numbers? Normally they flash ok from the web interface, but I know I did a couple with tftp as well. I remember I thought I had bricked one once. Make sure you flash a small image first then follow with the larger one.

    ReplyDelete
  6. Hi,
    I am trying to crosscompile a file with the firmware for WRT54GL. Do you know here I get a good howto?
    unix1970

    ReplyDelete
    Replies
    1. What firmware are you using for WRT54GL?

      Delete