From charlesreid1

Line 189: Line 189:
* Guide to USB port additions: https://wiki.openwrt.org/toh/linksys/wrt54g#adding_usb_ports
* Guide to USB port additions: https://wiki.openwrt.org/toh/linksys/wrt54g#adding_usb_ports
* USB solders directly onto PCB of router, RH21/RH22/RH25/RH26
* USB solders directly onto PCB of router, RH21/RH22/RH25/RH26
* Note that this guide for the 54GS lists different resistors: https://forum.openwrt.org/viewtopic.php?id=23308 (check resistor numbers and hardware version numbers!)
* Excellent guide to building this out on a breadboard: http://voidmain.is-a-geek.net/wrt/wrt_usb_mod.html
* Excellent guide to building this out on a breadboard: http://voidmain.is-a-geek.net/wrt/wrt_usb_mod.html
Image of the resistors on the PCB that you are soldering the USB directly to:
[[Image:PCB_USB_Headers_WRT54GL.png|500px]]


====Power supply====
====Power supply====
Line 200: Line 205:


The 7805 provides a current of 150 mA at 5 V, using the capacitors described in the page above. To increase the current, use a higher rated transistor, or add a heat sink to the 7805 (if you can deal with the losses). Will also need to ensure capacitors are rated to withstand the new, higher current at the given voltage.
The 7805 provides a current of 150 mA at 5 V, using the capacitors described in the page above. To increase the current, use a higher rated transistor, or add a heat sink to the 7805 (if you can deal with the losses). Will also need to ensure capacitors are rated to withstand the new, higher current at the given voltage.
=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:
* http://www.batbox.org/wrt54g-linux.html
* http://www.batbox.org/nslu2-linux.html

Revision as of 08:14, 29 August 2016

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

Modifications

In order to make this OpenWRT useful beyond the role of a "dumb" router box, it is necessary to add additional space.

MicroSD addition

Summary: implementing microsd addition using this guide: http://bjdouma.home.xs4all.nl/SD-mod/

Micro SD addition:

USB addition

Summary: (later) implement USB addition using this guide: http://voidmain.is-a-geek.net/wrt/wrt_usb_mod.html

USB addition:

Image of the resistors on the PCB that you are soldering the USB directly to:

File:PCB USB Headers WRT54GL.png

Power supply

The USB addition requires a power source of 5 V to power the USB device and interact with it. However, the router's power supply is 12 V. This means that a voltage regulator that will transform 12 V to 5 V is required.

A 5V power regulator transformer (like the 7805 transistor) from an electronics store is cheap, but have poor regulation of voltage. To fix this, you can build the 5V regulator into a network of capacitors to improve its regulation.

This circuit is described here: http://www.epanorama.net/circuits/psu_5v.html

The 7805 provides a current of 150 mA at 5 V, using the capacitors described in the page above. To increase the current, use a higher rated transistor, or add a heat sink to the 7805 (if you can deal with the losses). Will also need to ensure capacitors are rated to withstand the new, higher current at the given voltage.

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: