learn by doing

Build your OpenWRT image file

As I said in a previous post I will need an OpenWRT image set with the baud rate of 9600 bps for the console port in order to have my improvised USB-RS232-TTL adapters work. I will show the steps on how to build your image. Please note that I am using Ubuntu as OS but it should work with any other Linux distributions, you just have to install the dependencies.

  • Get a terminal window and type in:
$sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk bison 
gcc flex
$mkdir ~/backfire
$cd ~/backfire
$svn co svn:// .
$./scripts/feeds update -a
  • Prepare build
$make menuconfig

Here you may choose what chipset you are using, the kernel modules and the packages you would like to install. I will choose the ones specific for the router I have : Asus WL500G. Just to be sure I will also install stty - a tool which can be used to set the baud rate of the console port after boot.

Target System (Broadcom BCM947xx/953xx [2.4])
Target Profile (Generic, Broadcom WiFi (default))
Select all packages by default
Image configuration -->;
      Base system
           busybox (press enter to open hidden menu)
                      [*] stty

After choosing all the desired settings you have to save your config.

  • The next step is to add the 9600 baud rate console option to the kernel:
$vim ~/backfire/.config

and add the following line:

CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit 
noinitrd console=ttyS0,9600"
  • Start the build process and wait, it will take a while.
$make world V=99
  • When it’s finished you’ll find the image in ~/backfire/bin and you can upload it through TFTP: Power your router while holding the reset button Connect one of the LAN interfaces to your computer and set your computers IP address to 192.168.1.x
tftp>put openwrt-brcm-2.4-squashfs.trx