Download wrt54g.3.01.3.tgz.
Untar wrt54g.3.01.3.tgz.
Check out the contents of the Subversion repository http://svn.cmeerw.net/src/wrt54g/trunk/, preferably into ~/src/wrt54g/
Before you can start you will have to download the packages referenced in ~/src/wrt54g/setup-source.sh and put them into a local download directory (see DL="${HOME}/download" at the beginning of the script).
The next step will setup the WRT54G source-tree with the updated source code:
cd ~/WRT54G_3_01_3_0922 ~/src/wrt54g/setup-source.sh
Now you should symlink /opt/brcm to your new WRT54G source tree and start the build of your WRT54G cross-compiling environment (gcc, binutils and uClibc):
ln -s ~/WRT54G_3_01_3_0922/tools/brcm /opt/brcm cd tools-src ./build_tools.sh
Finally, you have to add your WRT54G cross-compiler to your PATH:
PATH=$PATH:/opt/brcm/hndtools-mipsel-uclibc/bin

Missing PATH requirement
I was unable to get the build process to start until I included '/opt/brcm/hndtools-mipsel-uclibc-0.9.19/bin' in my PATH..
I think the PATH should be changed like this after building the tool chain:
PATH="$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc-0.9.19/bin"
Did any one else have to do this to perform a firmware build?
PATH typo
the PATH should be /opt/brcm/hndtools-mipsel-uclibc (I have just updated the description).
BTW, did you run setup-source.sh? (because that script should actually delete the existing tools sub-directory and build the toolchain from the sources).
Clearing up any confusion... (or maybe I'm missing something)
My first build failed using these instructions. I was trying to perform a firmware build using the lastest Linksys firmware source, WRT54G_3_03_6_0106_US . The actual make failed because the directions exclude the linked folder path for the uClibc, /opt/brcm/hndtools-mipsel-uclibc-0.9.19 .
I'm new to C programming, mostly do C# now, so I'm unsure if I missed something and this path is not needed to build OpenVPN. Christof?
Take a look at the ~/WRT54G_3_03_6_0106_US/release/src/router/README file for clarification:
#
# Broadcom Linux Router Configuration
#
# Copyright 2004, Broadcom Corporation
# All Rights Reserved.
#
# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
#
# $Id: README,v 1.1.1.6 2004/04/12 04:33:26 honor Exp $
#
* Introduction
To compile the Broadcom Linux Router package, you must have both
mipsel-linux and mipsel-uclibc toolchains in your PATH.
/opt/brcm/hndtools-mipsel-linux/bin
/opt/brcm/hndtools-mipsel-uclibc/bin
** Configuration
To configure the package, type "make menuconfig". The Linux kernel will
be configured as well.
** Compilation
To compile after configuring, type "make". The Linux kernel will be
built as well.
To compile only a particular module (e.g. rc), type "make rc".
** Installation
To package for direct installation, type "make install" or "make
package". Linux kernel modules will be installed as well.
If uClibc was selected, "make install" will create a linux.trx file in
"mipsel-uclibc/". If uClibc was not selected, a linux.trx file will be
created in "mipsel/".
** Cleaning
It is recommended that "make clean" be run after a configuration change
is made. By default, "make clean" will not clean the kernel. Uncomment
the last line of the "clean" target in the Makefile to enable kernel
cleaning.
* Customization
See config/Kconfig-language.txt for a description of the configuration
language used for user applications. Although its configuration program
appears similar, the Linux kernel uses a slightly different
language. See ../linux/linux/Documentation/kbuild/config-language.txt.
To add a new user application to the package, edit config/Config and
name the module rule under the "Configuration" section of the
Makefile. If the module can be built, cleaned, and installed with the
generic rules located at the end of the Makefile, no further changes are
necessary. Otherwise, add additional rules for the module under the
"Overrides" section of the Makefile. "make <module>" should descend into
the module directory and compile the sources. "make <module>-install"
should install the appropriate binaries as if "$(INSTALLDIR)/<module>"
were the root directory. "make <module>-clean" should clean generated
files from the module directory.
See the rules for "www" for a simple example.