Building from source ==================== First, setup the build environment: * You need to get the mipsel-uclibc-gcc toolchain from a wrt54g/gs distribution Note: Linksys has upgraded the compiler toolchain. The toolchain from either a G or GS build will work for building both images. When building from source or CVS, make sure to update your toolchain distribution to at least v3.01.3 from the Linksys GPL Code Center at: http://www.linksys.com/support/gpl.asp or: ftp://ftp.linksys.com/opensourcecode/wrt54g or: ftp://ftp.linksys.com/opensourcecode/wrt54gs/ * Once you've untarred the tarball, copy or move the WRT54G/tools/brcm directory to /opt/brcm on your filesystem. Now you can safely get rid of the WRT54G tree. * Make sure the path to the iptables utility is in your PATH environment variable. * Execute the command: `export PATH=/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin:$PATH` Build it: just type `make ` or just `make` for a WRT54G model. Available models are: g (default) gv1 gv4 gs gsv4 gl If everything builds successfully, you should have a file in the image/ directory called "code-.bin" which is a usable installation image. (e.g. if you are using a WRT54GS less than v4, the image you want will be image/code-gs.bin.) To build an image with localized language support for your region, see the FAQ for more info. If you've made modifications to the configuration, it may best but it is not necessary to reset the box's nvram to the factory configuration, by holding the reset button down for 3 seconds with the device plugged in. Upload the image to the device via the web interface or tftp. See the INSTALL-http or INSTALL-tftp files for more info. To reconfigure the build: ========================= Run: `make config MODEL=` or `make menuconfig MODEL=` Notes: * src/config/* files are generated from the src/config/default/ base file by patching with a model-dependent patch found in src/config/ * Additional patches for alternate systems may be put in src/config/ Use: `make config MODEL= EXTRA=` to enable them They will be unapplied after the build. (EXPERIMENTAL) * src/linux/linux/.config - gets linked to src/config/defconfig-bcm947xx , which controls the kernel config * router/.config - gets linked to src/config/defconfig, controls the 3rd-party router software on the rootfs * src/router/busybox/.config - gets linked to src/config/bb.config, which reconfigures busybox userland utils * src/router/config/Config - controls the available config options for the router, more will be added in the future The build process in a nutshell =============================== The distribution consists of two main parts, a Linux kernel and a userland. The Linux kernel is built from the src/linux/linux directory in three parts, first "make dep" which builds dependencies, then "make zImage" which builds the kernel and finally "make modules" which builds any kernel modules. The userland is built from the src/router directory. Each component (eg. busybox, dropbear, etc) is built from its respective directory and then installed into the src/router/mipsel-uclibc/install directory. Inclusion of components is controlled by the src/router/.config file. Once the src/router/mipsel-uclibc/install directory is populated, the src/router/mipsel-uclibc/target directory is populated as it would be on the final filesystem. The target directory is used to create the squashfs filesystem. The then trx utility is used to combine the squashfs filesystem and linux kernel into a single image and then the addpattern utility is used to add the special linksys pattern to the beginning of the image. The build process, roughly: 1. "make dep" in src/linux/linux 2. "make" -C src/router a. make -C nvram b. make -C shared c. make -C openssl d. make -C httpd e. make -C iptables f. make -C netconf g. make -C rc h. make -C www/cisco_wrt54g_en i. make -C lib j. make -C wlconf k. make -C bridge l. make -C busybox m. make -C dnsmasq n. make -C ntpclient o. make -C ppp/pppoecd p. make -C udhcpd q. make -C upnp r. make -C utils s. make -C vlan t. make -C dropbear u. make -C iproute v. make -C cron w. make -C pptp-client x. make -C pppd y. make -C ipupdate z. make -C others aa. make -C bpalogin 3. "make zImage" in src/linux/linux 4. "make modules" in src/linux/linux 5. "make install" in src/router (same modules as in step 2, just a different order) 6. addpattern to the trx image 7. copy and convert header for an image which will run on the WRT54GS