Mobile Multimedia Lab



P2PWNC: Peer-to-peer Wireless Network Confederation RI - Documentation




In order to build the router's firmware, one has to take the following steps:
  • Download linksys (official) firmware sources (~155mb) from the Linksys ftp site.

  • Unpack the downloaded archive (e.g. tar xvfz wrt54gs.2.07.1.tgz)

  • Export the appropriate PATH variable:

    export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:
    /usr/local/bin:/usr/local/sbin:/opt/brcm/hndtools-mipsel-linux/bin:
    /opt/brcm/hndtools-mipsel-uclibc/bin:/opt/brcm/hndtools-mipsel-uclibc:
    /opt/brcm/hndtools-mipsel-linux

  • Build uClibc, issuing the following commands:

    cd tools-src/uClibc
    make menuconfig
    make
    make install
    cp uClibc/libc/libc.a /opt/brcm/hndtools-mipsel-uclibc/lib/optinfo/
    cp uClibc/libc/misc/internals/interp.o /opt/brcm/hndtools-mipsel-uclibc/lib/optinfo

  • Build the GNU toolchain:

    cd ../release/src/router
    make menuconfig
    save defaults
    cd ../../../tools-src/
    ./buildtools.sh

    The above will actually build the toolchain. This takes roughly 25-30 minutess on a Linux mdk10 Sempron 2.6 box with 768mb RAM. The script's output is shown below:

    [root@localhost tools-src]# ./build_tools.sh
    BUILD_DIR=/home/pfrag/progs/WRT54GS/tools-src
    LINUX_DIR=/home/pfrag/progs/WRT54GS/tools-src/../release/src/linux/linux
    INSTALL_DIR=/opt/brcm/hndtools-mipsel-linux-3.0
    Building gnutools: Fri Nov 26 01:36:26 EET 2004
    Doing gnu-tools with no-libs: Fri Nov 26 01:36:26 EET 2004
    Configure of g-t-nl succeeded
    Make of g-t-nl succeeded
    Install g-t-nl succeeded
    Doing linux includes: Fri Nov 26 01:42:55 EET 2004
    ./build_tools.sh: line 131: [: too many arguments
    Linux include dir copy succeeded
    Doing glibc: Fri Nov 26 01:42:56 EET 2004
    Glibc Configure succeeded
    Glibc Make succeededFri Nov 26 01:52:18 EET 2004
    Glibc Install succeededFri Nov 26 01:53:13 EET 2004
    Glibc include Install succeeded
    Glibc lib Install succeeded
    Fixing up libc.so locations
    libc.so Fixup succeeded
    libc.so Replace succeeded
    Doing full gnu-tools: Fri Nov 26 01:53:20 EET 2004
    Configure for g-t-full succeeded
    Make for g-t-full succeeded
    Install for g-t-full succeeded
    build_tools done: Fri Nov 26 02:01:57 EET 2004

  • Set up the following symbolic links (most possibly already exist):

    cd /opt/brmc
    ln -s hndtools-mipsel-uclibc-0.9.19 hndtools-mipsel-uclibc
    ln -s hndtools-mipsel-linux-3.0 hndtools-mipsel-linux


    and add these two directories in your PATH environment variable.

  • Move to the ../release/src/linux/linux directory and "make dep"

    cd ../release/src/linux/linux; make dep

  • Finally, build the router's firmware:

    cd ../../; make

    This takes about 6 minutes on the machine described above.

The firmware image (code.bin) is in the release/image directory.

The above HOWTO is available in txt format here.