sveasoftlogo.jpg

WRT54G Firmware Documentation

Building a Firmware Image from Source

Download and extract the necessary source packages

You will typically need the Linksys source code itself, which contains the toolchain and some other utilities, plus the latest Sveasoft source distrubution and patches. , which are intended to overwrite the release/src/ directory of the linksys distribution.

Note that sveasoft firmware is currently based on specific Linksys distributions, so make sure you're getting the correct firmware distribution.

Here's a brief walkthrough of unpacking the source for Samadhi_v2_2.00.8.6sv:

/usr/local/src% tar xzf  ~/wrt54gv2_2.00.8.tgz
/usr/local/src% ls -F
WRT54G/
/usr/local/src% cd WRT54G/release
/usr/local/src/WRT54G/release% unzip -oq ~/Samadhi_v2_2.00.8.5sv_src.zip
/usr/local/src/WRT54G/release% unzip -oq ~/patch_5sv_6sv.zip
/usr/local/src/WRT54G/release% ls -F
image/  patch_5sv_6sv  src/  tools/
/usr/local/src/WRT54G/release% patch -p1 < patch_5sv_6sv
patching file src/router/shared/broadcom.c
patching file src/router/shared/broadcom.h
patching file src/router/shared/defaults.c
patching file src/router/shared/lib.c
[...]
/usr/local/src/WRT54G/release%

Get the toolchain working

The toolchain constists of a cross-compiler and a cross-compiled C library for gcc. Rather than glibc, the WRT54G uses uClibc. The Linksys source distribution helpfully includes a pre-compiled (for x86) toolchain in WRT54G/tools/, so the easiest way to set up the toolchain is to link or copy the WRT54G/tools/brcm/ directory to somewhere (Linksys suggests /opt/brcm) and then add the two relevant directories to your PATH - see WRT54G/tools/README.TXT for details.

Once these are copied and added, you'll have a series of mipsel linux commands to use:

/usr/local/src/WRT54G% mipsel-linux-gcc -v
Reading specs from /opt/brcm/hndtools-mipsel-linux/bin/../lib/gcc-lib/mipsel-linux/3.0/specs
Configured with:
gcc version 3.0 20010422 (prerelease) with bcm4710a0 modifications
/usr/local/src/WRT54G%

If you'd prefer, you can install the toolchain from source, which is provided in the WRT54G/tools-src directory. You'll find a README.TXT therein which explains the process (as of this writing, however, this author hasn't been able to get it working).

Configure the build process and kernel

To prepare the build, cd to WRT54G/release/src/router and run "make menuconfig". This will provide you with a menu for enabling or disabling build options (including such things as enabling ethernet bridging and setting the C library). Once you are done with the first menu, make menuconfig will run the same command in the linux kernel directory, enabling you to configure the kernel.

make

Now cd to the WRT54G/release/src directory and run make. With any luck, this will result in a code.bin file in the WRT54G/release/image directory.

Note: the current distribution of Samadhi_v2_2.00.8.6sv has some problems compiling dropbear (the sshd daemon). See this post for help.

Install the boot image

Now that you have your code.bin image, you may install it in the router as described in the upgrading firmware page.


One page links to SV-BuildingFromSource: