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