The University of Adelaide                                                                                                                                                                                                                                                                                             Home | School EEE






Project Background

WLAN Background

Linux and WLAN

Network Optimisations

Current Development

Further Development

Project Management


Useful Links


Related Link

School EEE















































































































































































Linksys WAP54G Firmware Development

The firmware for the Linksys WAP54G is available for download from the Internet [35]. Also provided is the Linksys source code; however this is not a complete source for the firmware. The aim is to add kernel modules to the Linksys and for this the full cross compiler tools, the full source code and image builder would need to be available.

Broadcom provides such sources specifically for the Broadcom BCM4712KPB chip [25], however this would still require a full kernel to be built and then modules added before testing would begin. Needed was a firmware that provided the basic tools for a kernel compilation and firmware image development, this was found in OpenWRT [21].


A firmware, designed specifically for the Linksys router WRT54G, OpenWRT [21] provides a developmental base for one to build custom firmware for this router. OpenWRT has increased capabilities in allowing firmware to be built for many more APs and routers, including the Linksys WAP54G. The source code for this is available from the OpenWRT web site [36] and with developmental SDK and Buildroot, which include cross compiler toolchains, along with wide support [37], this made OpenWRT an appealing choice of firmware for the Linksys. The current stable firmware is the WhiterussianRC5 [38], this provides a Linux 2.4.30 kernel that contains the minimum requirements for an AP. Once installed the AP acts as a Linux box whereby one can use SSH to connect into AP and change NVRAM variables, thus customizing to suit the current network [21].

Flashing Firmware

Flashing the firmware to the Linksys using OpenWRT can be done through the use of the Ethernet cable supplied with the AP, JTAG is also an option if this fails to work. The web interface provides a mean to download firmware across the Ethernet and onto the AP (see appendix D), this may be a more simple method, however it is suggested here that the use of TFTP is better choice in case of firmware error [21], this way original firmware can be easily reinstalled. In order to use TFTP the boot wait variable must be set to on.

- Boot wait

Boot wait is a NVRAM variable that allows a new firmware to be downloaded to the AP by delaying the bootup process by a few seconds [26]. With boot wait set to on, this allows one to TFTP to the AP and install binary images onto it. In order to set boot wait on the WAP54G, an older version of the Linksys firmware was downloaded from the Freifunk web site [39]. This was installed via the web interface so a ’restore’ could be followed out with a file that changes this boot wait variable to on [26]. Note here that in order to downgrade the Downgrade header at address must be disabled [40].

Although this was not needed, boot wait can also be set using a serial connection such as JTAG (see Section 2.3), once connected the following commands set the variable [41].

nvram setboot wait = on

nvram getboot wait (justtoconfirm, shouldrespondwith00on00)

nvram commit (takesafewsecondstocomplete)


With boot wait now set it was possible to TFTP to the AP [42] and flash new firmware. At this point in the project this was tested, using the following commands the current stable development of OpenWRT was installed. In this case the Whiterussian RC4 (downloaded from [38]) firmware was the current stable firmware made for the WAP54G, so the put command below becomes put openwrt− wap54g− squashfs.trx. Notice here that before the last command is entered it is necessary to reboot the AP by switching the power on and 27 off, one must wait for the ’link’ LED to come on and then press enter. There is only a five second window in which the CPU waits for new firmware to be flashed.

tftp 192.168.245

tftp > binary

tftp > rexmt1

tftp > timeout60

tftp > trace

tftp > put openwrt− xxx − x.x − xxx.trx

The process may take some time, it was found just to take under a minute however when flashing to theWAP54G. If any timeout errors occur check the network setup and connections (see Appendix B) and ensure the filename is correct.

OpenWRT Software Development Kit (SDK)

To modify the OpenWRT firmware, by adding your own programs the code must be cross compiled and packaged so that an image can be created including these programs. The SDK is a simplified version of the OpenWRT buildroot, already containing precompiled

versions of the toolchain, libraries and packages needed to create the firmware [44]. The kit, Open − Wrt − SDK − Linux − i686− 1.tar.bz2, can be downloaded from the OpenWRT subversion repository [45].

The SDK was required to install the arithmetic package bc for which was used in the channel switching shell script. To do so the SDK requires a Makefile which downloads the source, the and .control files all of which were downloaded from [46]. These files are placed in the /package directory of the SDK and the make command from the top directory builds the package in ipkg format. This package is placed in the /bin file and can be incorporated in the image (see Section 5.5).

Now although the SDK can be used to package programs, this project also requires a kernel module to be built and the SDK does not support this. To compile kernel modules the full OpenWRT Buildroot was required.

OpenWRT Buildroot

The OpenWRT Buildroot is a set of Makefiles that download and compile the toolchains necessary to build the OpenWRT firmware as well as all the packages and software required. It can be downloaded from the OpenWRT subversion repository [47], the version that was current during the time this project was run was the whiterussianRC5 whiterussian rc5, which was the latest stable version. Note here that one should download and compile the most recent version to use as a development tool.


Once downloaded the file needs to be unzipped. The directory that the files are unzipped in should not be the root directory and once unzipped and compiled can not be moved elsewhere without complication.

bzcat whiterussian rc5.tar.bz2

The command make dirclean && make in the top level /whiterussian rc5/openwrt/ directory will download and create all the necessary files and tools for compilation and creation of the AP firmware. The downloads are done using the Linux WGET command and this needs to be setup properly (see Appendix B.1). The download and compilation can take a considerable amount of time, in this case it took approximately two hours, but this depends highly on the speed of download.

After this process is complete there are three main directories which are of use, a full description can be found in [47] and is summarised here. The package directory contains all the Makefiles and tools that are added to the file system, such as SSH Dropbear, the toolchain directory contains all the relevant cross compilers and the target directory contains the Makefiles and software which are needed to create the root file system and Linux kernel. To compile a kernel module the target/ directory is of interest.

Compiling a Kernel Module

There are some files that need to be created for every module to be compiled [47]. Firstly a new directory should be made for the module in the /target/Linux/package/ directory so if one wishes to create an module called example:

cd /openwrt/target/Linux/package/

mkdir example

Once created the source code and Makefile for the module would go into this directory as well as a file and an ipkg directory with a .control file. The Makefile needs to be in a specific format to allow for cross compilations, which the .control and files ensure the buildroot knows the kernel module exists and knows to include it in the build.

These files and a brief description of each can be found in Appendix H.1.By entering make menuconfig in the top directory openwrt it is possible to select the module for compilation, but before this some changes need to be made to the buildroot source.

To be able to compile a kernel module the Buildroot needed to be fully analysed to find which Makefiles needed to be changed in order for the new module to be found and compiled. This was a time consuming procedure but it was found that all modifications needed to be made within the target directory. To add the kernel module example the following changes need to be made to the buildroot.

1. In the Makefile /target/Linux/package/Makefile the following lines need to be added;

package −$(BR2 Package KMOD EXAMPLE)+ = example

example− compile : openwrt− compile

These lines are used to tell the builroot to compile the example module.

2. The file /target/Linux/package/ requires the following line to be added;

source 00target/Linux/package/example/Config.in00

This gives the menuconfig program the ability to find the module so that it can be selected for compilation.

One can now type make menuconfig in the top level directory and select the kmod example module to be compiled, save the new configuration and then type make to build the firmware. Once compiled the image builder within the buildroot uses the information from the build mipsel directory to create its image.

Image Creation

The binary images produced by the Buildroot found in the /bin file may be transferred to the AP however, these were found not to work on the WAP54G because the current whiterussian rc5 does not create an image for this AP. This indicated that another means needed to be used for the WAP54G.

The example kernel module would have been compiled and packaged by the Buildroot, found in /bin/packages and an earlier version of the Image Builder used this binary to build an executable image for.

Image Builder

The OpenWRT image builder allows one to build images to suit the needs of the wireless network; this includes building an image specifically for theWAP54G. Packages, once packed by the SDK or compiled using the full Buildroot, can be added and those packages already present can be deleted making room for others. It also allows modifications to files within the kernel file system if necessary. The image builder Open-Wrt-ImageBuilder-Linux-i686-1.tar.bz2 can be downloaded from [48], OpenWrt provides a how-to documentation to use this builder this can be found at [49]. A summary is provided here.

The binary file for the fragmentation kernel module which was built using the full buildroot can now be copied into the /OpenWRT− Image− Builder/packages directory. To create an image one needs to provide a list of all the packages to be included, this is put in the /OpenWRT− Image− Builder/lists directory. All that is needed is to copy the existing default list, rename it, add the line kmod− example to the end of the list and save. Now return to the top directory /OpenWRT− Image − Builder/ and type make clean && make. The final image, including the new kernel module is found in the /OpenWRT− Image− Builder /bin directory, ready to be flashed to the AP. The image builder creates two different types of images, using different file systems, JFFS2 and SquashFS. At this point the SquashFS image is used as it uses less space.


























































































































































Copyright © The University of Adelaide 2006

Copyright | Disclaimer | Privacy