HOWTO: Build your own OpenWrt firmware with 3G support
Install prerequisites
The following programs need to be installed: build-essential binutils flex bison autoconf gettext texinfo sharutils libncurses5-dev ncurses-term zlib1g-dev gcc-3.4 subversion
Commands differ per distribution, this command for Ubuntu installs all the prerequisites (run in a terminal):
sudo aptitude install build-essential binutils flex bison autoconf gettext texinfo sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gcc-3.4
Set up the image builder
In a terminal, cd to the folder that you want the imagebuilder to be downloaded, such as your home folder. Then, run these following commands:
wget http://downloads.openwrt.org/whiterussian/0.9/OpenWrt-ImageBuilder-Linux-i686.tar.bz2 tar -jxvf ./OpenWrt-ImageBuilder-Linux-i686.tar.bz2 svn export --force http://tools.assembla.com/svn/openwrt-3g/trunk/imagebuilder/ ./OpenWrt-ImageBuilder-Linux-i686
If you are running a 64-bit computer can use the 64-bit image builder:
wget http://downloads.openwrt.org/whiterussian/0.9/OpenWrt-ImageBuilder-Linux-x86_64.tar.bz2 tar -jxvf ./OpenWrt-ImageBuilder-Linux-x86_64.tar.bz2 svn export --force http://tools.assembla.com/svn/openwrt-3g/trunk/imagebuilder/ ./OpenWrt-ImageBuilder-Linux-x86_64
Make your own modifications to the firmware
All of the files in the /files directory will be copied/replaced into the root folder on your router. The necessary files for 3G support are already there. The /lists/3g.brcm-2.4 file tells the image builder what packages will be included. You can delete the other lists which will speed up the make process.
Make the firmware images
In a terminal, cd to your image builder directory, and run make.
Example:
cd /home/user/OpenWrt-ImageBuilder-Linux-i686 make
When make finishes, the firmware images will be found in /bin/3g/, or whatever your lists file is named.
Change the firmware header
If OpenWrt is already running on your router then this doesn't need to be done, simply upgrade with the openwrt-brcm-2.4-squashfs.trx firmware.
If the standard Linksys firmware is on your router, you will need to edit the firmware header of one of the .bin firmwares before trying to upgrade. To do this, open up the openwrt-wrt54g3g-squashfs.bin file with a hex editor, and replace W54F at the beginning of the file with W3GS. Then you should rename the file to openwrt-wrt54g3g-st-squashfs.bin.
You're now ready to upgrade to your freshly compiled OpenWRT firmware :).