Solution for Random Resetting to Default - complete guide

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
dd-write
DD-WRT User


Joined: 05 Jan 2007
Posts: 55

PostPosted: Thu Jan 25, 2007 23:56    Post subject: Solution for Random Resetting to Default - complete guide Reply with quote
This is a complete guide on how to recompile the DD-WRT source code to modify default factory settings for your own use. The need for this came up because the dd-wrt router on my client site keeps resetting back to default and the forum provided no clear fix for it. The procedures described here were proven to work on my machine. This guide is exactly the same as the one in wiki Ddwrtmodificationhowto in our company webpage so if you are from my work then you can print it from there.

tools needed for doing this:

.fedora core 6 with all development tools such as gcc 4.1.1 installed (in my case it runs on virtual pc)
.latest source code as of now (1210-2006-svn5216.snapshot.tar.bz2 from downloads/sourcecode section)
.toolchains (toolchains.x86.debian.sp1.tar.bz2) from the bottom of the downloads/source section, for compiling

steps:

1.unpack the source code with: tar xvf 1210-2006-svn5216.snapshot.tar.bz2

2.move the unpacked directory DD-WRT to /

3.unpack toolchains into /opt

4.create links to the directories for compile scripts:

cd /
ln -s /DD-WRT/image GruppenLW
cd /opt
ln -s 3.4.6-uclibc-0.9.28 3.4.6
ln -s 3.4.6-uclibc-0.9.28 3.3.4
ln -s 3.4.6-uclibc-0.9.28 3.3.6
ln -s 4.1.0-uclibc-0.9.28 4.1.0

5.add toolchain to your path: export PATH=$PATH:/opt/4.1.0/bin/

6.change permission for certain files:

chmod +x /DD-WRT/src/router/iptables/extensions/.dccp-test
chmod +x /DD-WRT/src/router/iptables/extensions/.layer7-test

7.compile some stuff first:

cd /DD-WRT/src/linux/brcm/linux.v23
cp .config_std .config
make oldconfig
make dep

8.save the following script(thanx to tornado) as /DD-WRT/script1.sh:

#!/bin/bash
export MYPATH=$PATH
export PATH=/opt/4.1.0/bin:$MYPATH
cd /DD-WRT/src/router/busybox/scripts
rm -f bb_mkdep *.o
gcc bb_mkdep.c -o bb_mkdep
cd /DD-WRT/src/squashfs-tools
rm -f *.o mksquashfs-lzma
make
cp mksquashfs-lzma /DD-WRT/src/linux/brcm/linux.v23/scripts/squashfs
cp mksquashfs-lzma /DD-WRT/src/linux/brcm/linux.v24/scripts/squashfs
cd /DD-WRT/tools
rm strip
rm write3
rm write4
make strip
make write3
make write4
gcc -o webcomp -DUEMF -DWEBS -DLINUX webcomp.c
cd ../src/router/tools
rm jsformat
make jsformat

9.save the following script(thanx to tornado) as /DD-WRT/script2.sh:

#!/bin/sh
echo "#define BUILD_DATE \"$(date +%D)\"" > build.h
export PATH=/opt/4.1.0/bin:$PATH
cd ../src/linux/brcm/linux.v23
#cd ../src/linux/brcm/linux.v24
cp .config_std .config
make clean
make oldconfig
cd ../../../router
rm -dfr mipsel-uclibc/install
make clean
cd ../../opt

10.give permission to those scripts:

chmod ugo+rwx /DD-WRT/script1.sh
chmod ugo+rwx /DD-WRT/script2.sh

11.now the last step before compiling is edit the default factory settings. The file to modify is /DD-WRT/src/router/services/defaults.c. To know the right variable to modify simple ssh into your dd-wrt router and do: nvram show >list.txt
from the list.txt you will get an idea which variable is which. Then simply search string for the variable name in defaults.c and modify the middle argument. Two things that will not be affected by the modification of defaults.c is lan_ipaddr and wep keys. These will need to be changed in rc_startup variable. Add a startup script to rc_startup to change them: {"rc_startup", "nvram set lan_ipaddr=192.168.11.1\nnvram set rc_startup=\nnvram commit\nreboot", 0}, note the \n is escape sequence for c++ string.

12.now compile the damn thing with:

cd /DD-WRT
./script1.sh
./script2.sh
cd /DD-WRT/opt
./install_normal.sh

13.the binary files created will be in /GruppenLW/


You need to follow this instruction exactly for it to work. And I have not tested it against anything other than fedora core 6 combined with sp3 source code so any other combo may or may not work!
Sponsor
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum