Tutorial to compile DD-WRT for WNR3500L?

29 posts / 0 new
Last post
Yong woon Ahn
Yong woon Ahn's picture
Tutorial to compile DD-WRT for WNR3500L?

Hi guys,

I am now trying to compile DD-WRT by myself to install it on my WNR3500L. 

I have downloaded all source codes and toolchains from the DD-WRT's web site and their SVN. 

But their tutorials looks old, and some of them can not be applied to the current revision. (Especially, to compile the toolchains.)

Does any one have a tutorial to compile the source codes?

Please, help me. 

Best regards,

 

Yong.

Kong
Kong's picture
I've setup a machine last

I've setup a machine last week to compile dd-wrt. I took me about 3h till my first successful compile. Basically you have to create a few dirs and symlinks. You find out which one if you checkout the Makefiles and by reading the compile errors:-)

Since the first attempt was just a quick setup inside a virtual machine I did not write down all the neccessary steps.

But I intend to prepare my main linux workstation in order to compile dd-wrt. This time I'm going to write down all the neccessary steps.

Yong woon Ahn
Yong woon Ahn's picture
Thanks for your comment. I am

Thanks for your comment. I am trying to follow the thread from the DD-WRT forum. I will update, if I succeed compiling with that.

Thanks again,

Yong woon Ahn

Ralf
Ralf's picture
Hi, where did you got the

Hi, where did you got the toolchain?
I ask because the link for the toolchain in the above said thread isn't working anymore (the toolchain with the name "Debian" in it).
I need the toolchain for x86 PC environment (Debian 6, 32bit).

Yong woon Ahn
Yong woon Ahn's picture
Ralf said: Hi, where did you

Ralf said: Hi, where did you got the toolchain? I ask because the link for the toolchain in the above said thread isn't working anymore (the toolchain with the name "Debian" in it). I need the toolchain for x86 PC environment (Debian 6, 32bit).

Hi, Ralf, 

Actually, I also could not find the toolchain mentioned  in their tutorial to compile the toolchain.

Maybe some people like me are facing on the same problem. See this page. I think you also need to find out the particular toolchains which are not located the dd-wrt web site.

If you find a solution for this problem. please, post here.

Best regards,

Yong

Ralf
Ralf's picture
I think I have to give up

I think I have to give up compiling dd-wrt.
Just for curiosity I tried openwrt, and to my surprise its process of compilation is IMHO exceptionally good made. Just try yourself:

svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk
make menuconfig ( make

Beware: One must do it as a non-root user!
Mine is compiling right now, and not even a single warning so far! :-)

admin2@comp11:/FILES/openwrt_svn/trunk$ make
make[4]: Entering directory `/FILES/openwrt_svn/trunk/target/linux'
make[5]: Entering directory `/FILES/openwrt_svn/trunk/target/linux/brcm-2.4'
make[6]: Entering directory `/FILES/openwrt_svn/trunk/target/linux/brcm-2.4/image'
make[6]: Leaving directory `/FILES/openwrt_svn/trunk/target/linux/brcm-2.4/image'
make[5]: Leaving directory `/FILES/openwrt_svn/trunk/target/linux/brcm-2.4'
make[4]: Leaving directory `/FILES/openwrt_svn/trunk/target/linux'
make[1] world
make[2] tools/install
make[3] -C tools/m4 compile
make[3] -C tools/m4 install
make[3] -C tools/autoconf compile
make[3] -C tools/autoconf install
make[3] -C tools/automake compile
make[3] -C tools/automake install
make[3] -C tools/bison compile
make[3] -C tools/bison install
make[3] -C tools/sed compile
make[3] -C tools/sed install
make[3] -C tools/pkg-config compile
make[3] -C tools/pkg-config install
make[3] -C tools/mklibs compile
make[3] -C tools/mklibs install
make[3] -C tools/sstrip compile
make[3] -C tools/sstrip install
make[3] -C tools/ipkg-utils compile
make[3] -C tools/ipkg-utils install
make[3] -C tools/genext2fs compile
make[3] -C tools/genext2fs install
make[3] -C tools/libuuid compile
make[3] -C tools/libuuid install
make[3] -C tools/mtd-utils compile
make[3] -C tools/mtd-utils install
make[3] -C tools/mkimage compile
make[3] -C tools/mkimage install
make[3] -C tools/firmware-utils compile
make[3] -C tools/firmware-utils install
make[3] -C tools/patch-cmdline compile
make[3] -C tools/patch-cmdline install
make[3] -C tools/quilt compile
make[3] -C tools/quilt install
make[3] -C tools/yaffs2 compile
make[3] -C tools/yaffs2 install
make[3] -C tools/lzma-old compile
make[3] -C tools/lzma-old install
make[3] -C tools/squashfs compile
make[3] -C tools/squashfs install
make[2] toolchain/install
make[3] -C toolchain/binutils prepare
...

Kong
Kong's picture
@Yong woon Ahn

@Yong woon Ahn

Just use the latest toolchain which is linked on the wiki "Development" Page.
All you have to do is add toolchain-mipsel_gcc4.1.2/bin to your PATH. It is the only toolchain you will need to compile K26 for the wnr3500l

@Ralf, if you are feeling fine with kernel 2.4 which your are compiling right now, ok:-)

Ralf
Ralf's picture
@Kong

@Kong
yes, at the moment kernel 2.4 is enough for me because I've also a WGR614v9
which does not have that much memory.
Generally, I really don't need that much options in the firmware, not even a webserver on the router; iptables is enough for me :-)

Ralf
Ralf's picture
# Still TRYING to compile ANY

# Still TRYING to compile ANY ONE of the target versions of "dd-wrt"...
# (of course my attempts continue failing misarebly... :-)

# set these:
DDWRT_DIR=/FILES/dd-wrt
TOOLCHAIN_DIR=/FILES/dd-wrt_toolchains/toolchain-mipsel_gcc4.1.2
TOOLCHAIN_VERSION=4.1.2

ln -s $TOOLCHAIN_DIR /opt/$TOOLCHAIN_VERSION

export MYPATH=$PATH
export PATH=/opt/$TOOLCHAIN_VERSION/bin:$MYPATH

cd $DDWRT_DIR

#cd $DDWRT_DIR/src/router
#cp .config_mini.v24 .config
#cp ../linux/linux/.config_std ../linux/linux/.config

make configure
make

#----- And the result is... ----- :-)

comp11:/FILES/dd-wrt# ./MY_make.sh
make: *** No rule to make target `configure'. Stop.
make -C src all
make[1]: Entering directory `/FILES/dd-wrt/src'
make -C router all
make[2]: Entering directory `/FILES/dd-wrt/src/router'
rules/iptables.mk:37: warning: overriding commands for target `iptables-clean'
rules/iptables.mk:2: warning: ignoring old commands for target `iptables-clean'
rules/all.mk:114: rules/mmc-ixp4xx.mk: No such file or directory
rules/all.mk:181: rules/strace.mk: No such file or directory
[ ! -d rules/strace.mk ] || make -C rules/strace.mk
[ ! -d rules/mmc-ixp4xx.mk ] || make -C rules/mmc-ixp4xx.mk
rm -rf /FILES/dd-wrt/src/router/mipsel-uclibc/target
rm -rf /FILES/dd-wrt/src/router/mipsel-uclibc/install
rm -f /FILES/dd-wrt/src/router/mipsel-uclibc/linux.trx /FILES/dd-wrt/src/router/mipsel-uclibc/vmlinuz /FILES/dd-wrt/src/router/mipsel-uclibc/target.squashfs
make -C nvram
make[3]: Entering directory `/FILES/dd-wrt/src/router/nvram'
mipsel-linux-uclibc-gcc -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I. -I/FILES/dd-wrt/src/include.v24 -Wall -s -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fPIC -c -o nvram_linux.o nvram_linux.c
/opt/4.1.2/bin/mipsel-linux-uclibc-gcc: 1: Syntax error: "(" unexpected
make[3]: *** [nvram_linux.o] Error 2
make[3]: Leaving directory `/FILES/dd-wrt/src/router/nvram'
make[2]: *** [nvram] Error 2
make[2]: Leaving directory `/FILES/dd-wrt/src/router'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/FILES/dd-wrt/src'
make: *** [all] Error 2
comp11:/FILES/dd-wrt#

I wonder where *I* did a mistake? did I? :-)

Yong woon Ahn
Yong woon Ahn's picture
@Tathagata, thanks for

@Tathagata, thanks for replying.
Now, I can understand why the compilation command in the make scripts has 64 bit options. Actually, I have tried modify them to 32 bit options manually because of my 32 bit OS.

To compile any kinds of openWRT based firmware for WNR3500L, do we have to use 64bit machine, or only for DD-WRT?

(Actually, as Ralf posted, it looks OpenWRT's menu_config has no problem with compiling OpenWRT.)

However, it looks really hard to retrieve source codes, make a modification, and recompile for WNR3500L.

Since my final goal is to implement a new QoS mechanism for WNR3500L with 802.11n, I am now trying to play with Tomato. (The stock opened source codes only have precompiled wireless drives by Broadcom.)

Best regards,

Yong

Ralf
Ralf's picture
I think with the "multilib"

I think with the "multilib" library one should be able to compile also 64bit under a 32bit OS (and vice versa), at least under Debian / Ubuntu.

# dpkg -l | grep -i multilib
ii g++-4.4-multilib 4.4.3-5 The GNU C++ compiler (multilib files)
ii gcc-4.4-multilib 4.4.3-5 The GNU C compiler (multilib files)
ii gcc-multilib 4:4.4.3-1 The GNU C compiler (multilib files)

Ralf
Ralf's picture
Tathagata Das said:

Tathagata Das said:
Below is the DD-WRT compilation procedure for WNR3500L board
Requirement:
1.) 64-bit machine with kernel version 2.6.23 above.
Procedure:
1.) Checkout source code.
2.) Go to router directory.
3.) Copy .config-mini.v24 to .config
4.) Edit .config file
a.) LINUXDIR=$(SRCBASE)/linux/brcm/linux-2.6.23.
b.) Add CONFIG_BCMMODERN=y
c.) Remove CONFIG_SPUTNIK_APD macro.

The .config file(ie. config_mini.v24) says at top "# Automatically generated make config: don't edit",
and yes it's a fresh checkout done just two days ago.
It seems the above edit tasks under #4 must be done somewhere else, right?..

Kong
Kong's picture
I addition to what Tathagata

I addition to what Tathagata said, with the latest svn checkout compile stopps when building bird since some files are not in sync, so one needs to go into bird directory run make clean ./configure and make, after that compile will succeed.

If you want to change some of the build options in .config you can run:

make menuconfig

in dir "router"

Ralf
Ralf's picture
If someone succeeds let me

If someone succeeds let me know pls! :-)

Kong
Kong's picture
I did yesterday, using trunk

I did yesterday, using trunk with basically the same steps as Tathagata mentioned.

Kong
Kong's picture
Ah and of course you have to

Ah and of course you have to compile some tools:

#!bin/bash
cd ~/DD-WRT/src/router/tools
rm jsformat
make jsformat
cd ~/DD-WRT/src/squashfs-tools/lzma/C/7zip/Compress/LZMA_Alone
mv makefile makefile.disabled
mv makefile.gcc makefile
make
cp -vf lzma ~/DD-WRT/opt/loader-0.02/
mv makefile makefile.gcc
mv makefile.disabled makefile
cd ~/DD-WRT/src/squashfs-tools
rm mksquashfs-lzma
make
cp mksquashfs-lzma ../linux/brcm/linux-2.6.23/scripts/squashfs
cd ~/DD-WRT/tools/
rm ./strip
gcc strip.c -o ./strip
rm ./write3
gcc write3.c -o ./write3
rm ./write4
gcc write4.c -o ./write4
rm ./webcomp
gcc -o webcomp -DUEMF -DWEBS -DLINUX webcomp.c
gcc -o trx trx.c

Kong
Kong's picture
Sorry little error in the

Sorry little error in the script posted before:

gcc -o trx trx.c

you need to cd:

cd ~/DD-WRT/opt/tools/

deathwing64
deathwing64's picture
Tathagata Das said: I

Tathagata Das said: I personally able to compile that code.

thank Tathagata Das a lot, your instruction is very useful :)

netserver
netserver's picture
SVN=14875

SVN=14875
1 to 8 ok
9.) In router directory run make -f Makefile.brcm26 clean all install.
NOK

make : [bird-symlinks] Error 1 ( no tiene efecto)
cf-parse.y: In function 'cf_parse'
cf-parse.y:892 error : too few arguments to function 'proto_debug'
cf-parse.y:1464 error : 'bgp_as4_support' undeclared (first use in thins function)
cf-parse.y:1464 error : (Each undeclared indentifier is reported only once
cf-parse.y:1464 error : for each function it appears in.)
make[3]: **** [cf-parse.tab.o] Error 1
make[2]: **** [subdir] Error 2
make[1]: **** [all] Error 2
make: **** [bird] Error 2

solved bird issue with make clean and ./configure and make

now have another error: missing defconfig-bcm947xx
missing file ../DD-WRT/src/linux/brcm/linux2.6.23/arch/mips/defconfig-bcm947xx

i view only defconfig-bcm947xx-slimrtr

fredriki21
fredriki21's picture
Hi, maybe this is a stupid

Hi, maybe this is a stupid question, but what do I need to download in svn://svn.dd-wrt.com/DD-WRT to compile firmware for WNR3500L? Do I need to download the whole site or just a part of it?

Saint Atique
Saint Atique's picture
You need to use svn download

You need to use svn download required sources from the site.

harryddwrt
harryddwrt's picture
Its a stupid question but

Its a stupid question but please don't mind and help me out.

I am unable to download source using command

svn co svn://svn.dd-wrt.com/DD-WRT

please help me if i am missing something...I am new to linux..
I did installed latest release of Subversion but still no success...kindly tell me how did you solve it?

Subhra
Subhra's picture
I can't see any wrong in your

I can't see any wrong in your command and using your command I am able to checkout DD-WRT.
Few times I also faced this problem, and figured that DD-WRT svn repository was down. I would advice you to try again with the same command.

harryddwrt
harryddwrt's picture
Thank you very much for your

Thank you very much for your reply

ReDaLeRt
ReDaLeRt's picture
Hi,

Hi,

Can anyone create a VirtualBox linux machine and share it to compile DD-WRT firmware?

I want to try some features on the compiler but don't have so much time to spare on setups... :-/

Thanks!

gvk
gvk's picture
Hi All/Tathagata Das,

Hi All/Tathagata Das,

I am new to dd-wrt and the world of networking. Presently I am trying to build dd-wrt source for my Linksys-e3200.

At present my router is running big version of dd-wrt with the pre-built firmware.

Here I am confused with the build system, like how i should select a make file for my router. Which make file I should use and how to decide choosing the make file.

Irrespective of board I tried to setup a build first, for that I followed this post

1.) Checkout source code.
2.) Go to router directory.
3.) Copy .config-mini.v24 to .config
4.) Edit .config file
a.) LINUXDIR=$(SRCBASE)/linux/brcm/linux-2.6.23.
b.) Add CONFIG_BCMMODERN=y
c.) Remove CONFIG_SPUTNIK_APD macro.
5.) Open the file $(BASEDIR)/src/linux/brcm/linux-2.6.23/drivers/net/wireless/Kconfig and remove the following lines.
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/bcm43xx/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig"
source "drivers/net/wireless/madwifi/Kconfig"

6.) export PATH=/opt/toolchain-mipsel_gcc4.1.2/bin/:$PATH
7.) Build trx in $(BASEDIR)/opt/tools/
8.) In router directory run make -f Makefile.brcm26 configure.
9.) In router directory run make -f Makefile.brcm26 clean all install.

Here in step
4.a) i dont have a folder with name "linux-2.6.23" instead i have "linux.v24_2"

5) at the following path of my source "/src/linux/brcm/linux.v24_2/drivers/net/wireless" there is no Kconfig file

6) from the dowloaded tool-chain, I have copied the "toolchain-mipsel_gcc4.1.2" dir to /opt, added and exported the path variable.

7) I did not understand this step "Build trx"

and running step 8, 9 gave some erros

./nvram -lnvram -lcrypt -Lmipsel -liksemel
mipsel-linux-uclibc-gcc: src/apd.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/adler32.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/compress.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/crc32.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/deflate.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/gzio.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/infback.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/inffast.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/inflate.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/inftrees.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/trees.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/uncompr.o: No such file or directory
mipsel-linux-uclibc-gcc: zlib/zutil.o: No such file or directory
mipsel-linux-uclibc-gcc: src/base64.o: No such file or directory
mipsel-linux-uclibc-gcc: src/blowfish.o: No such file or directory
mipsel-linux-uclibc-gcc: src/brcm.o: No such file or directory
mipsel-linux-uclibc-gcc: src/cbc.o: No such file or directory
mipsel-linux-uclibc-gcc: src/control.o: No such file or directory
mipsel-linux-uclibc-gcc: src/diag.o: No such file or directory
mipsel-linux-uclibc-gcc: src/duette.o: No such file or directory
mipsel-linux-uclibc-gcc: src/firewall.o: No such file or directory
mipsel-linux-uclibc-gcc: src/hexstring.o: No such file or directory
mipsel-linux-uclibc-gcc: src/httpd.o: No such file or directory
mipsel-linux-uclibc-gcc: src/jauth.o: No such file or directory
mipsel-linux-uclibc-gcc: src/keys.o: No such file or directory
mipsel-linux-uclibc-gcc: src/license.o: No such file or directory
mipsel-linux-uclibc-gcc: src/log.o: No such file or directory
mipsel-linux-uclibc-gcc: src/lsk.o: No such file or directory
mipsel-linux-uclibc-gcc: src/md5.o: No such file or directory
mipsel-linux-uclibc-gcc: src/md5_util.o: No such file or directory
mipsel-linux-uclibc-gcc: src/pf.o: No such file or directory
mipsel-linux-uclibc-gcc: src/pppoe.o: No such file or directory
mipsel-linux-uclibc-gcc: src/status.o: No such file or directory
mipsel-linux-uclibc-gcc: src/usage.o: No such file or directory
make[1]: *** [sputnik] Error 1
make[1]: Leaving directory `/home/testpc01/Public/Project/Router/dd-WRT/DDWRT/DD-WRT/src/router/sputnik'
make: *** [sputnik] Error 2
rules/all.mk:121: rules/mmc-ixp4xx.mk: No such file or directory
rules/all.mk:198: rules/strace.mk: No such file or directory
rules/all.mk:209: rules/oled.mk: No such file or directory
rules/all.mk:219: /home/testpc01/Public/Project/Router/dd-WRT/DDWRT/DD-WRT/src/router/private/ath9k-rules/ath9k.mk: No such file or directory
rules/all.mk:223: rules/atm.mk: No such file or directory

Please help me....!!!

Thanks in advance

johnathonm
johnathonm's picture
Would anyone be willing to

Would anyone be willing to work with me to put together a clean, straightforward guide to compiling the firmware?

Thanks.

gvk
gvk's picture
Hi johnathonm,

Hi johnathonm,

Its nice to come up with such document, I would like to be part of your work :)

Raj
Raj's picture
I am new to dd-wrt and

I am new to dd-wrt and struggling to build wnr3500l.

I have ubuntu 14.04 x64 bit dev machine. Could you provide latest build procedure?

I can download the source but I cant get the tool chains for this one.