rss
twitter
  •  

OpenWRT on the D-Link DSL-502T (Gen 1)

| Posted in Personal |

18

NOTE: Much of this isn’t necessary now, because OpenWRT 8.09 now supports AR7. You can just grab the openwrt-ar7-squashfs.bin image to use from http://downloads.openwrt.org/kamikaze/8.09.1/ar7/


I’ve had this old D-Link DSL-502T sitting around, basically working. When I moved place just recently, I took the opportunity to look into getting OpenWRT installed on this thing, basically because I wanted something I could do DNS/DHCP serving on, while giving me some shell access. The D-Link firmware is kinda dodgy, and I always enjoy installing Linux onto something new.

Chris Pascoe’s page is quite dated now, but was a good place to start. Much development has gone into OpenWRT and the AR7 platform, so much of his information is now incorrect. The best place for info is the OpenWRT wiki page for the DSL-502T. It’s much more comprehensive and many of the patches and hacks that Chris Pascoe needed to do have be rolled into the OpenWRT trunk.

Much of this information has been copied and pasted from the above sites. Credits to both of them.

Start by grabbing the SVN trunk of OpenWRT.

$ svn co https://svn.openwrt.org/openwrt/trunk

Once this is done, you can grab any packages you’re interested in. Note that you can install these later using the opkg command once your firmware is running. I grabbed ntpclient, tcpdump, openvpn and the ddns-scripts.

cd openwrt/trunk/package
svn co https://svn.openwrt.org/openwrt/packages/net/ntpclient
svn co https://svn.openwrt.org/openwrt/packages/net/tcpdump
svn co https://svn.openwrt.org/openwrt/packages/libs/lzo
svn co https://svn.openwrt.org/openwrt/packages/net/openvpn
svn co https://svn.openwrt.org/openwrt/packages/net/ddns-scripts

Select firmware components
Enter into the folder and run make menuconfig. Select at least:

  • Target System -> TI AR7 [2.6]
  • Target Profile -> No Wifi
  • Target Images -> SquashFS
  • Image configuration -> LAN IP Address (not required, but makes it easier if you’re already running a network)
  • Base system -> br2684ctl (only needed by PPPoE)
  • Network -> ppp -> ppp-mod-pppoa and/or ppp-mod-pppoe, depending on your ADSL type
  • Kernel Modules -> Network Devices -> select Annex A (which is ADSL over POTS. B is for ADSL over ISDN)

Make sure that you enable your packages from above in the config. E.g. Network -> Time Synchronization -> ntpclient

Quit and save the config.

Get the build dependencies.

For Ubuntu, you’ll need:
sudo apt-get install flex bison autoconf zlib1g-dev libncurses5-dev automake g++ patch gawk

Build your image by doing
make -j3 (for a dual-core system)

The final firmware produced by the build is located in bin/openwrt-ar7-squashfs.bin.

Uploading the initial OpenWRT firmware.

To upload the initial OpenWRT image, there is a tool called adam2flash. It can be found in the OpenWRT trunk, under the scripts directory. To use it, you need to execute the script in the first second or so of the machine being turned on. It’s recommended that you don’t connect the modem directly to your computer, but use a switch in between. This is in case it takes too long for the ethernet cards to negotiate.

One thing I had trouble with was finding out what the initial IP address of the device was. Before you overwrite your firmware, you can find this out by using telnet. Enable the telnet remote management from the D-Link interface and then check out the ADAM2 environment variables. They should be stored in /proc/ticfg (from memory).

If you’re lucky, you might see an entry starting with my_ipaddress. Mine was 10.1.1.199, but many others have mentioned 192.168.1.1. On my DSL-502T (Gen II), it haven’t found it’s IP yet. It wasn’t set in the file.

Lots more info about the ADAM2 bootloader can be found at the Seattle Wireless site. http://www.seattlewireless.net/ADAM2

Here’s the steps:

  • Download a copy of the standard D-Link firmware so you can revert to it if things go wrong! You need the “web upgrade” .BIN version of the firmware, not the .EXE version. D-Link firmware can be downloaded from (for example) http://www.dlink.com.au/tech/
  • Configure your PC for a static IP address on the same subnet as your modem’s default IP address.
  • Choose an IP address for your modem. The OpenWrt firmware will use 192.168.1.1 after rebooting (unless you set it in the menuconfig), so that’s a sensible choice.
  • Turn off the modem.
  • Run adam2flash-502T.pl, providing the modem IP address you chose and the new firmware to upload. If you are changing between D-Link and OpenWrt firmware, you will also need to specify -setmtd1 (if you forget this, the script will tell you that you need it and exit)
  • Turn on the modem.
  • Wait for the upload to complete. Here’s a sample session:

$ scripts/adam2flash-502T.pl 192.168.1.1 -setmtd1 bin/openwrt-ar7-squashfs.bin
Looking for device: ..... found!
ADAM2 version 0.22.2 at 192.168.1.1 (192.168.1.1)
Firmware type: OpenWRT (little-endian)
logging into ADAM2 bootloader.. ok.
checking hardware.. AR7RD / DSL-502T.
checking MTD settings.. ok.
Firmware size: 0x00280004
Available flash space: 0x003e0000
Preparing to flash.. ok.
Erasing flash and establishing data connection (this may take a while): ok.
Writing firmware: ............. lots of dots ......... done.
Rebooting device.

If you have trouble with this (as I did) you might need to hack the adam2flash-502T script a little. I commented out the whole section about doing the UDP probe part, and just passed the IP address right into the $box variable.

Getting the LEDs to work
Grab a copy of the ledsetup script found in the scripts directory of your SVN checkout. Install it into /etc/init.d and it should run on start-up. This will give you the ethernet light, and also map the USB light to ppp0. Very handy.

DSL Sync
When I finally got my ADSL connected in the new place, I couldn’t get DSL sync. It seemed to be because I had the wrong modulation set.

When you boot the device, you should see something like this in your dmesg.

Registered device TI Avalanche SAR
Sangam detected
requesting firmware image "ar0700xx.bin"
avsar firmware released
tn7dsl_set_modulation : Setting mode to 0xffff
Creating new root folder avalanche in the proc for the driver stats
Texas Instruments ATM driver: version:[7.03.01.00]
DSL in Sync

The line about setting the mode to 0xffff is important. For me, my initial mode was being set to 0x7f (which wasn’t for ADSL2+). The 0xffff mode means to negotiate the best speed (ADSL 1 or 2, 2+). This is set in the ADAM2 environment so if this needs to be changed, you’ll have to reboot your modem and use the onboard FTP server’s commands SETENV, UNSETENV, GETENV (all caps matter), by doing telnet to your modem’s default IP address on port 21.

$ telnet 10.1.1.199 21
220 ADAM2 FTP Server ready.
530 Please login with USER and PASS.
USER adam2
331 Password required for adam2.
PASS adam2
230 User adam2 successfully logged in.
GETENV my_ipaddress
200 GETENV command successful
my_ipaddress 10.1.1.199
GETENV modulation
200 GETENV command successful
modulation 127
SETENV modulation,65535
200 SETENV command successful

You can also set/reset your modem’s default IP address here with the variable my_ipaddress.

Backing up and restoring your configuration changes
OpenWRT saves your filesystem (effectively, configuration) changes in a JFFS filesystem mounted at /jffs. As this filesystem is dynamically sized based upon the size of your kernel and SquashFS, uploading a new firmware image may cause your configuration to be lost.

You can back your changes up to a file on your local machine via ssh:
ssh root@172.18.0.1 tar cf - /etc/ > dsl502t-backup.tar

To restore a saved configuration, we reverse the direction of the transfer. The following command checks the configuration copied properly before deleting the old configuration:
ssh root@172.18.0.1 'cat > /tmp/.r.$$ && tar tf /tmp/.r.$$ && cd / && rm -rf etc/* && tar xf /tmp/.r.$$' < dsl502t-backup.tar

Updating your OpenWRT install
SCP over the new image
desktop# scp bin/openwrt-ar7-squashfs.bin root@172.18.0.1:/tmp/newimg

Log into the OpenWRT device, and use the mtd command to write the new image:
openwrt# mtd -r write /tmp/newimg linux

This should then go through a write/verify process, and once completed it will reboot into the new image.

Nokia Sports Tracker

| Posted in Personal, Running |

14

It’s been a while since I’ve posted on here, but I wanted to share something cool that I found.

It’s called the Nokia Sports Tracker and you can use it for tracking your workouts. As friends of mine will know, I do a bit of running. Sometimes it’s handy to know how far you’ve gone or how quickly you did it in.

Just put your recent Nokia phone with built-in GPS (or add a bluetooth GPS unit, if you don’t have it built in) in your pocket when you go running, cycling, walking to track your distance and speed. What’s really cool is that if you have mobile internet access, you can send your data in real-time so others can see your progress plotted on a google maps interface.

Last Saturday, I decided to try it out. You can check out my run details here:

http://sportstracker.nokia.com/nts/workoutdetail/index.do?id=305325

Blogging from my Internet tablet

| Posted in Personal |

1

I am blogging from my Internet tablet. Nice.

Skype for Linux: Finally, with video

| Posted in Personal |

3

About time, Skype guys! We’ve only been waiting for ages for the Linux client to catch up to the Mac and Windows versions to get video.

I have this feeling that it’s been brought on my the new Nokia N810 internet tablet to be released shortly this month. The N800 (which I have) does include Skype, but sans video. I think that video support was something that the Nokia guys would have been pushing for with the N810. I’m really looking forward to using Skype with Video on the N800 once the new version of the Internet Tablet OS is released.

Unfortunately, Skype’s video doesn’t work on my MacBook Pro presumably due to ATI’s shithouse proprietary driver. Even with the newest 8.42.3 driver (which was supposed to be some massive improvement) they are still crap.

Note to ATI: I’m never, ever buying ANYTHING that contains one of your GPU’s. Ever.

Matt’s bucks day

| Posted in Personal |

0

paintball.jpg

Last weekend, we went paintballing at Hot Shots in Anakie to celebrate the fact that someone is crazy enough to want to marry him :) hehe

Playing in Anakie was great because of the bush setting, and I would recommend looking the Hot Shots guys up if you wanted to do paintballing. As you can see from the photo, Matt got the pretty pink overalls, including a target painted on the back.

Geelong: AFL Premiers 2007

| Posted in Personal |

2

geel_tape_l.jpg

Incredible game, Geelong annihilating Port Adelaide by 119 points. I believe it’s the largest winning margin in the history of the AFL/VFL.

It was probably the best game I have ever seen these boys play. Let’s make it back-to-back next season.

GO CATS!

Blue and White fever

| Posted in Personal |

3

After a close (too close..) win over Collingwood, Geelong have advanced into the Grand Final. As you can see, I managed to score some tickets from the random ballot for Geelong members.

I took a trip down to the Cattery (Geelong) and it’s really exciting to see the all the blue and white everywhere. Plenty of people wearing their guernseys, scarves and jackets around town. I’m glad to see now that the ‘lid’ is off, and everyone is getting into the spirit of things.

Through the Chinese whispers, I managed to hear that Kingy’s got a place in the AFL side, after his good performance in Geelong’s VFL premiership yesterday. I think he’s really put in hard after his injury, and although Blake has been very good, I think it’s Kingy’s time.

Go the Catters!

Carlton Draught, now with Geek questions

| Posted in Personal |

3

linux-cap.jpg

NZ Extreme Tour photos now online

| Posted in Personal |

0

I finally got all the photos together from me, Stretch, Jay and Eric. I’ve uploaded them into Google’s Picasa.

http://picasaweb.google.com/andybotting/NZTrip

Extreme Tour, NZ

| Posted in Personal |

5

Started our NZ holiday on Saturday morning, leaving from Melbourne at 6:40am. We landed in Queenstown, NZ at about 11:30am and started to check the place out.

img_8083.JPG
Andy, Jay, Laurelle, Ewan and Stretch in Queenstown. The Remarkables behind.

First stop was some lunch at Fergburger. Some very nice gormet-style burgers, and later checking into our hostel accommodation and visiting some local establishments for some refreshments.

img_8081.JPG
Catching up with Sam at the pub.

I even managed to catch the end of the Geelong v Richmond game. Well done to Blakey for kicking his first 2 goals in AFL, and smashing Richmond to extend their winning streak to 13 games.

We then took the Gondola up the mountain and hit some luge. Total carnage.

img_8096.JPG
The Exteme Team, preparing for some Luge action.

Skiing at Coronet Peak was also carnage, as I am probably the weakest Skier out of the bunch. Let me tell you, I ate some serious snow.

img_8099.JPG
Andy at Sam’s place, with some sexy Ski pants.

We just got back from the Shotover Jet Boat ride. Very high speed jet boat through a little river. Very extreme.

Stay tuned for updates, and more photos.