Four steps to easily recompile 1.9.2.7-x firmware

For Oleg's 1.9.y.z-x custom firmware you need the 1.9.y.z GPL firmware!

1 - Make sure you have the following software installed:

2 - Download Asus GPL, patched toolchain and firmware source

Download these three archives :

For the example we will use the 1.9.2.7-4 version!

3 - Prepare the kernel tree, toolchain and environment

Unpack ASUS GPL_1927.tar.gz:

   # tar -C /whatever/you/want -xzf /path/to/GPL_1927.tar.gz

This will create a /whatever/you/want/broadcom/... tree

Move entire /whatever/you/want/broadcom/opt to /opt:

   # cd /whatever/you/want/broadcom/ && mv opt /

Unpack and install patched uClibc 0.9.19:

   # tar -C / -xjf /path/to/hndtools-mipsel-uclibc-3.2.3-full.tar.bz2
   # rm -f /opt/brcm/hndtools-mipsel-uclibc
   # cd /opt/brcm && ln -s hndtools-mipsel-uclibc-3.2.3-full /opt/brcm/hndtools-mipsel-uclibc

Unpack and install 1.9.2.7-4 firmware source in broadcom/src subtree:

   # tar -C /whatever/you/want/broadcom/src -xjf /path/to/wl500g-1.9.2.7-4.tar.bz2

Add toolchain to your path:

   # export PATH=$PATH:/opt/brcm/hndtools-mipsel-uclibc/bin:/opt/brcm/hndtools-mipsel-linux/bin

4 - Compiling the firmware

   # cd /whatever/you/want/broadcom/src/wl500g-1.9.2.7-4
   # make kernel

This should produce number of strings saying "patching file bla-bla-bla" and no error messages.

   # make

This should end with a "Sources prepared for compilation". You may then have a /whatever/you/want/broadcom/src/gateway tree where sources are ready to be compiled

   # cd /whatever/you/want/broadcom/src/gateway
   # make
   # make install

NOTE: "make image-WL500g" may have issues for some/all users. "make install" works better. This will give you a /whatever/you/want/broadcom/src/gateway/mipsel-uclibc/WL500g-1.9.2.7-4.trx firmware ready to be uploaded

Tips

Instead of running

   # make image-WL500g

you can also use :

   # make image-WLHDD
   # make image-WL500gx
   # make image-WL500b
   # make image-WL300g

for your different piece of hardware


Recompiling 1.7.5.9-3 firmware

To recompile firmware you need to download GPL source code available at ASUS site for firmware version 1.7.5.6 (GPL_1756.zip). You will when need to unzip this & and untar the sources and then install toolchain according to README files. Also you will need to download firmware sources from this page and untar them somethere.

Compiling the kernel

You will need to prepare kernel sources for this. Download 2 patches: et module patch adds "missing" et module source code (ask ASUS guys about that) and the second adds bunch of stuff from custom firmware - squashfs, updated pwc an ov511 modules, fixes for usb printing and something I can't even remember. To patch sources execute these lines:

cd /path/to/WL500gb_1.7.5.6_GPL
gunzip -c path/to/wl500g-et-1.7.5.6.patch.gz \
    path/to/wl500g-kernel-1.7.5.9-3.patch.gz | patch -p 1

This should produce number of strings saying "patching file bla-bla-bla" and no error messages. If you got errors then check your kernel source tree. Once this was done you need to copy kernel config file, which is named .config and located in the root folder of the custom firmware sources and than rebuild kernel. E.g.

cd /path/to/WL500gb_1.7.5.6_GPL/release/src/linux/linux/
make mrproper
cp /path/to/wl500g-1.7.5.9-3/.config .
make oldconfig
make dep zImage modules

If you want to customize your kernel use menuconfig instead of oldconfig. Again everything should be done with no errors. At this point your kernel is compiled.

Compiling firmware

Install ASUS toolchain, untar curstom firmware sources, e.g.

tar xjf wl500g-1.7.5.9-3.tar.bz2

This will create directory named wl500g-1.7.5.9-3. Go to this dir. If you've recompiled kernel, when you need to copy fresh kernel image and install modules using commands like this

cd wl500g-1.7.5.9-3
rm -rf extra/lib/modules/2.4.20
cp /path/to/WL500gb_1.7.5.6_GPL/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz piggy.gz
make -C /path/to/WL500gb_1.7.5.6_GPL/release/src/linux/linux modules_install \
    DEPMOD=/bin/true INSTALL_MOD_PATH=/path/to/wl500g-1.7.5.9-3/extra/

Once done just type make. This should start compiling. If everything is went well it should produce file named linux.trx which is your new firmware.

One step compiling 1.9.2.7-7b firmware

After downloading wl500g-1.9.2.7-7b.tar.bz2 and Asus GLP source GPL_1927.zip in directory of your choice run the following script which is run as sh ./oleg.sh or . ./oleg.sh as regular user. Please note that /opt directory needs write permission!

#!/bin/sh
OLEG=wl500g-1.9.2.7-7b
if [ -d broadcom ]; then
   echo "Removing old broadcom tree..."
   rm -rf broadcom
fi
echo "Unpacking Asus GPL source..."
tar xzf GPL_1927.zip

echo "Unpacking OLEG source..."
tar -C broadcom/src/ -xjf ${OLEG}.tar.bz2

if [ ! -G /opt ]; then
        echo "You should create /opt as root:"
        echo "mkdir /opt && chgrp users /opt && chmod g+w /opt"
        echo "Then continue as regular user!"
        exit 1
fi

if [ -d /opt/brcm ]; then
        echo "Removing old toolchain..."
        rm -rf /opt/brcm
fi

echo "Installing broadcom toolchain..."
mv broadcom/opt/brcm /opt

BRCM="/opt/brcm/hndtools-mipsel"
PATH=${BRCM}-linux/bin:${BRCM}-uclibc/bin:${PATH}
export PATH


cd broadcom/src/${OLEG}
echo "Creating uClibc..."
make uClibc

echo "Creating kernel..."
make kernel

echo "Creating gateway..."
make

echo "Compiling gateway..."
cd ../gateway
make

echo "Creating firmware..."
make install

Please note that this script is ment to describe things without much typing. One can easily cut & paste or source the file.

Warning: this firmware doesn't build on a 64bit operating system. You must install a 32 bit operating system in your AMD64. Also gcc-4.0 is known not to produce gateway sources as it is too pedantic when creating config. Use gcc-3.x! Using make 3.81 when may cause troubles due to posix compilance backslash treatment in some Makefiles. Use make 3.80 instead!