Posted: Mon Nov 19, 2012 9:07 Post subject: Help with changing nvram defaults
I use many asus wl-520gu for hotspot purposes in on site deployment. Thats cheap APs with BR5354 which can do trunking vlans which is critical to me. So everything is pretty good - it runs my pretty complex config more or less flawlessly, but has one nasty problem - random resets to default.
As internet suggests it's hardware fault tied to not so good on board capacitors tien to power supply of a router, that means that i can solve this problem by software and replacing all already instaled APs is not an option.
So, only way i figured to work around is to change nvram defaults of a firmware to my config. And for that i need to recompile firmware from scratch.
I, myself, has pretty scarce knowledge of linux development, so having only svn snapshot and toolchain will take me a long time to figure out how to compile working firmware. Only thig i'va accomplished on that is compiling modified udhcpc which was injected with firmware-mod-kit, but that was nearly a year ago, so much of it already forgotten. So you can more or less imagine my level of skill/understanding.
Now for question part. Is somebody willing to help me by compiling firmware with nvram config and udhcpc mod supplied by me? And i will be extremely thankfull if somebody will help me to install building enviorement for later use. As a matter of community thankfullness i promice that will make a small tutorial for peoples like me.
PS. There is some articles on compilin firmware, but they all look pretty outdated/writen for more edukaded readers.
And i use build 14929.
Well, so far I was able to create some kind of build environment. As far as I can understand make logs compiling finish successfully, but make fails on install stage with some missing switch drivers. May be somebody can give some insight on the problem?
I am using toolchain from ftp, specifically
toolchain-mipsel_3.3.6_BRCM24
toolchain-mipsel_4.1.1_BRCM24
my compilation scripts:
First one just to automate process a bit
Code:
#!/bin/bash
cd /DD-WRT/src/router
export MYPATH=$PATH
export PATH=/opt/toolchain-mipsel_3.3.6_BRCM24/bin:$MYPATH
make clean
make rflow
#export PATH=/opt/toolchain-mipsel_gcc4.1.2/bin:$MYPATH
export PATH=/opt/toolchain-mipsel_4.1.1_BRCM24/bin:$MYPATH
#export PATH=/opt/mipsel-uclibc-4.6.3-K26/bin:$MYPATH
make configure
cd bird
./configure --disable-client
make
cd ../pptpd
./configure
make
#cd ../iptables
#./configure
#make
cd ../../../opt
./install_brcm5354.sh
export PATH=$MYPATH
Second one based on recommendations from different sources install_brcm5354.sh
Code:
#!/bin/bash
cd ../src
cd router
rm -rf mipsel-uclibc/install
make rc-clean
make services-clean
make shared-clean
make httpd-clean
rm busybox/busybox
rm busybox/applets/busybox.o
cd ..
make
cd ../opt
mkdir ../src/router/mipsel-uclibc/target/etc/config
./sstrip/sstrip ../src/router/mipsel-uclibc/target/bin/*
./sstrip/sstrip ../src/router/mipsel-uclibc/target/sbin/rc
./sstrip/sstrip ../src/router/mipsel-uclibc/target/usr/sbin/*
make[2]: Leaving directory `/DD-WRT/src/linux/brcm/linux.v24_bcm5354'
# quick n dirty - stuff Nikki's module where it belongs
#mkdir /DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.32-rc3/kernel/drivers/net/adm6996
rm -f /DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37/build
if test -d "/DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37/kernel/drivers/net/diag"; then mv /DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37/kernel/drivers/net/diag/* /DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37; fi
mv -f /DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37/kernel/drivers/net/switch/* /DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37
mv: cannot stat `/DD-WRT/src/router/mipsel-uclibc/target/lib/modules/2.4.37/kernel/drivers/net/switch/*': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/DD-WRT/src/router'
make: *** [install] Error 2
For reference:
Router .config file http://pastebin.com/bias803L basicaly just .config_std.v2-nokaid_bcm5354 from svn
Kernel .config file http://pastebin.com/h4BtYyB9 which is unmodified .config_std from linux.v24_brcm5354 folder from svn
Issue with missing switch drivers was overcomed. Solution was to issue.
Code:
make menuconfig
After that everything finaly compiles successfully. New issue was squashfs packer failing. And so i decided to leave a way of full recompiling, because i already have everything i need. In directory /YourTrunkDir/src/router/mipsel-uclibc/target there is newly compiled but unpacked file system of a firmware. I grab firmware-mod-kit and replaced /etc/defaults.bin with the one i made and voila, there is my router with my modified defaults. One thing you should be aware of is that even if defaults.bin contain plaintext default values, there is more invisible charaters and, i think, after compilation there is data about value length so changing it often breaks that settings. So you need to recompile that part every time.
Last problem i need to solve is how i can disable forsed username/password change after factory reset. I already tried changing default password and changind is_default constant to 0. No luck. I assume there is some constant added to nvram when you set password, but i cant check it because there is no way to log into router before password setup. Reading sources will take long time so may be some body knows how it works and how i can overcome it?