...

RIHLA - Building the router


Building a router suitable for RIHLA to use:


  • router is to be Asus WL520GU, with OpenWrt
  • router is to run as an AP (wanted to run as client also, but WPA2 doesn't seem to work, so gave up on that)
  • router is to be able to use UVC USB cameras
  • router is to have ser2net (maybe get python and pyserial on it?)

building custom firmware of OpenWrt with my specs:

current release is Backfire 10.03 final. got info from https://dev.openwrt.org/wiki/GetSource.
$ cd ~/projects/router/
$ svn co svn://svn.openwrt.org/openwrt/branches/backfire
   Checked out revision 31360.
$ sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk bison gcc flex
$ cd backfire
$ ./scripts/feeds update -a (this should upgrade to the latest
$ make menuconfig

(note the target system default was Target System (Broadcom BCM947xx/953xx)[2/4] which i think is the 2.4 kernel, and i wanted the 2.6 kernel)

  │ │     Target System (Broadcom BCM947xx/953xx)  --->    (default was
  │ │     Target Profile (Broadcom BCM43xx WiFi (default))  --->                                                           
  │ │ <*> busybox................................ Core utilities for embedded Linux  --->
                        coreutils <*>nohup, <*>stty, <*>who
  │ │     Network  --->
                        < > ppp
Kernel Modules
Filesystems  --->
  │ │ <*> kmod-fs-ext4..................................... EXT4 filesystem support
USB Support --->
  │ │ <*> kmod-usb-core............................................ Support for USB
  │ │ <*> kmod-usb-ohci............................... Support for OHCI controllers
  │ │ <*> kmod-usb-serial..................... Support for USB-to-Serial converters
  │ │ <*>   kmod-usb-serial-ftdi............................ Support for FTDI devices
  │ │ --- kmod-usb-storage..................................... USB Storage support
  │ │ <*> kmod-usb-storage-extras.................... Extra drivers for usb-storage
  │ │ < > kmod-usb-uhci............................... Support for UHCI controllers (NEW)
  │ │ <*> kmod-usb-video............................. Support for USB video devices
  │ │ <*> kmod-usb2................................... Support for USB2 controllers   
Video Support --->
  │ │ <*> kmod-video-core...................................... Video4Linux support
  │ │ < >   kmod-video-gspca-core................ GSPCA webcam core support framework (NEW)  --->
  │ │ <*>   kmod-video-uvc............................. USB Video Class (UVC) support
Save the configuration, then
$ make world V=99
This will take a WHILE... (about 1 hour)

flash the router with the custom firmware:

do 30/30/30 reset on router

  • while powered on, press the reset (NOT the ez setup button) for 30 secs
  • while still pressing the reset button, pull off the power, for 30 secs
  • while still pressing the reset button, power on for 30 secs
  • this sequence should leave the router in a reset mode.
  • set up the connecting computer to talk to the router
    laptop$ sudo ifconfig eth0 down
    laptop$ sudo ifconfig eth0 up 192.168.1.2
    
    connect laptop to router LAN1 using ethernet cable
    $ cd bin/brcm47xx
    $ tftp 192.168.1.1
    tftp> binary
    tftp> rexmt 1
    tftp> put openwrt-brcm47xx-squashfs.trx
    Sent nnnn bytes in 4.1 seconds
    tftp> quit
    

    set up access to the router:

    telnet into the router
    telnet 192.168.1.1
    $ passwd # set passwd, to disable telnet, and enable ssh
    
    now should be able to ssh in
    $ ssh root@192.168.1.111
    

    modify some configs:

    vi /etc/system
    config system
        option hostname RIHLA
        option timezone CST
    
    vi /etc/config/network
    #### VLAN configuration
    config switch eth0
        option enable   1
    config switch_vlan eth0_0
        option device   "eth0"
        option vlan     0
        option ports    "1 2 3 4 5"
    config switch_vlan eth0_1
        option device   "eth0"
        option vlan     1
        option ports    "0 5"
    #### Loopback configuration
    config interface loopback
        option ifname   "lo"
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0
    #### LAN configuration
    config interface lan
        option type     bridge
        option ifname   "eth0.0"
        option proto    static
        option ipaddr   192.168.1.111
        option netmask  255.255.255.0
    #### WAN configuration
    config interface    wan
        option ifname   "eth0.1"
        option proto    dhcp
    
    

    adding extra packages to the router:

    downloaded packages from http://backfire.openwrt.org/10.03/brcm47xx/packages/
    libjpeg_6b-1_brcm47xx.ipk
    libpthread_0.9.30.1-42_brcm47xx.ipk
    librt_0.9.30.1-42_brcm47xx.ipk
    mjpg-streamer_r84-2_brcm47xx.ipk
    ser2net_2.7-2_brcm47xx.ipk
    to install a package, scp the package to the router from the directory in the router that has the package

      $ opkg install libjpeg_6b-1_brcm47xx.ipk
    
    if there is a dependency, opkg will tell you so, then download and install the dependency package first


    to check the builtin support:

    the dmesg command gives a lot of nice info about the peripherals
    $ dmesg
    Linux version 2.6.32.27
    ...
    Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
    serial8250: ttyS0 at MMIO 0xb8000300 (irq = 3) is a 16550A
    serial8250: ttyS1 at MMIO 0xb8000400 (irq = 3) is a 16550A
    serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 3) is a 16550A
    serial8250.0: ttyS1 at MMIO 0xb8000400 (irq = 3) is a 16550A
    ...
    usbcore: registered new interface driver usbserial
    USB Serial support registered for generic
    usbcore: registered new interface driver usbserial_generic
    usbserial: USB Serial Driver core
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    ...
    Linux video capture interface: v2.00
    USB Serial support registered for FTDI USB Serial Device
    usbcore: registered new interface driver ftdi_sio
    ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver
    usbcore: registered new interface driver uvcvideo
    USB Video Class driver (v0.1.0)
    usb 2-1: new high speed USB device using ohci_hcd and address 2
    usb 2-1: configuration #1 chosen from 1 choice
    
    so we see that we have support for usb, ftdi serial, uvc video

    TODO:
    explain more about
    ls /etc/modules
    lsmod