From charlesreid1

Notes on getting the WRT54GL set up as an OpenWRT router.

This follows instructions on the OpenWRT wiki: https://wiki.openwrt.org/toh/linksys/wrt54g

Connect to Router

Before you can install OpenWRT, make sure the router is functioning normally.

Plug in

Start by plugging the router in, and connect a computer to it with an ethernet cable.

Log in

The default IP schema (discovered using ifconfig to see what IP address had been assigned to the ethernet port of the laptop connected to the router) was 192.168.1.1.

When I went to this page I logged in with the default username/password combo of admin/admin and saw the Linksys router management page:

LinksysRouterManagementPage.png

We won't be changing any of these settings, as we'll be re-flashing the router with a new operating system.

Install OpenWRT

Download image

Next you'll download the openwrt-wrt54g-squashfs.bin image from the OpenWRT page: https://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/

Direct link: https://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/openwrt-wrt54g-squashfs.bin

Load image onto router

On the router, navigate to the page http://192.168.1.1/Upgrade.asp

Now upload the OpenWRT binary:

LinksysRouterUploadBin.png

Log in to OpenWRT router

After 2 minutes the router will reboot itself automatically once the upgrade is complete.

You can now telenet to the router at 192.168.1.1 or you can use the Luci web interface at 192.168.1.1

Once you set a password, telnet will be disabled and ssh will be enabled.

LinksysRouterUpgrade1stLogin.png

Secure the router

First thing you do should be to set a password.

In the administration panel where you change the password, you'll also see configuration for a Dropbear SSH client, which will allow you to SSH to the router and remotely administer it. This can be set up to only listen on the local LAN, or only listen on the wifi interface, or listen on both.

Ensure tftp access

To ensure tftp is enabled, in case router gets bricked, type these commands out in telnet or ssh:

nvram set boot_wait=on
nvram set boot_time=10
nvram set wait_time=10 #important for some models
nvram commit && reboot

This will start tftp on boot. It is possible to flash the router via tftp, and is the recommended way to restore the router to a factory Linksys image.

Tftp flashing instructions: https://wiki.openwrt.org/doc/howto/generic.flashing.tftp


Connect router to internet

Before we can update existing software and download new software, we need an internet connection.

Fortunately, there is an ethernet port in the back of the Linksys labeled "internet", and plugging this into a router connected to the internet will allow the OpenWRT OS to automatically obtain an IP address on that router's network and successfully connect to the internet.

OpenWRT54GLPing.png

Update software

Now use opkg to update existing software on the router:

$ opkg update

Install new software

There is less than 2 MB of disk space available on the WRT54GL:

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 1.7M      1.7M         0 100% /rom
tmpfs                     7.0M      1.2M      5.8M  17% /tmp
/dev/mtdblock/4           1.5M      1.5M     16.0K  99% /overlay
mini_fo:/overlay          1.7M      1.7M         0 100% /
root@OpenWrt:~#

Make sure you start by installing stuff required to expand the storage of the OpenWRT with USB or MicroSD:

$ opkg install kmod-usb-ohci kmod-usb-storage kmod-usb-core

Here's what it looks like if you jump in headfirst and try and install a bunch of stuff:

root@OpenWrt:~# opkg install screen wget tcpdump
Installing screen (4.0.3-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/packages/screen_4.0.3-2_brcm-2.4.ipk.
Installing libncurses (5.7-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/packages/libncurses_5.7-2_brcm-2.4.ipk.
Installing wget (1.13.4-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/packages/wget_1.13.4-1_brcm-2.4.ipk.
Installing libopenssl (0.9.8r-1) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/packages/libopenssl_0.9.8r-1_brcm-2.4.ipk.
Installing zlib (1.2.3-5) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/brcm-2.4/packages/zlib_1.2.3-5_brcm-2.4.ipk.
Installing tcpdump (4.1.1-2) to root...
Configuring zlib.
Configuring libopenssl.
Configuring wget.
Configuring libncurses.
Configuring screen.
Collected errors:
 * verify_pkg_installable: Only have 20kb available on filesystem /overlay, pkg tcpdump needs 295
 * opkg_install_cmd: Cannot install package tcpdump.
root@OpenWrt:~#

Oops.

Hardware

Onboard

Once you're logged into Luci, you can see what kind of hardware is on-board. There's about 14 MB of memory, 2 MB of disk space, and a very low power chip on board:

root@OpenWrt:~# cat /proc/cpuinfo
system type    		: Broadcom BCM5352 chip rev 0
processor      		: 0
cpu model      		: BCM3302 V0.8
BogoMIPS       		: 199.47
wait instruction       	: no
microsecond timers     	: yes
tlb_entries    		: 32
extra interrupt vector 	: no
hardware watchpoint    	: no
VCED exceptions		: not available
VCEI exceptions		: not available

Bricking and De-Bricking

Oh, the joys of bricking a router.

Notes on debricking a router using JTAG cable: http://www.tiaowiki.com/w/Debrick_Routers_Using_JTAG_Cable

More notes on 54g: https://www.dd-wrt.com/wiki/index.php/Recover_from_a_Bad_Flash

wrt54g jtag pinouts: https://www.dd-wrt.com/wiki/index.php/JTAG_pinouts#Linksys_WRT54G_v2

openwrt wiki page for wrt54g: https://wiki.openwrt.org/toh/linksys/wrt54g#jtag

openwrt wiki jtag page: https://wiki.openwrt.org/doc/hardware/port.jtag


Links

BatBox: a distribution designed specifically for the WRT54GL: http://www.batbox.org/wrt54g-linux.html

Nice project: weather station served up by WRT54GL and network storage device:


Flags