User Tools

Site Tools


content:meshextender:prototyping_on_mp2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
content:meshextender:prototyping_on_mp2 [07/02/2013 17:43]
Paul Gardner-Stephen [Enabling External USB Storage]
content:meshextender:prototyping_on_mp2 [14/07/2015 00:38]
Nathan Fowler
Line 12: Line 12:
  
 The TL-WR703N is well supported by OpenWRT: http://wiki.openwrt.org/toh/tp-link/tl-wr703n The TL-WR703N is well supported by OpenWRT: http://wiki.openwrt.org/toh/tp-link/tl-wr703n
 +
 +=====Installing Serval on the WR703N=====
 + - Make sure you have git, csh and expect installed
 +Depending on your Linux distribution, something like the following should suffice:
 +<code>
 +$ sudo yum install csh expect git
 +</code>
 +Alternatively you may need to use
 +<code>
 +$ sudo apt-get install csh expect git
 +</code>
 +  - Download the Mesh Extender Builder software.
 +<code>
 +$ git clone --quiet https://github.com/servalproject/mesh-extender-builder.git 703n-builder
 +</code>
 +  - Allow Edits to the files in the folder
 +<code>
 +$ chmod 777 703n-builder
 +$ cd 703n-builder
 +</code>
 +  - Edit the files that get the openwrt images to get the right images.(make_image, gather-image-files, and flash-virgin-mr3020)
 +make_image
 +<code>
 +# Download and unpack OpenWRT 12.09 image builder (if required).
 +if [ ! -e OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486 ]; then
 +   if [ ! -e OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2 ]; then
 +      wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2
 +   fi;
 +   tar jxvf OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486.tar.bz2
 +fi;
 +
 +# Build image with all the right packages, and the extra configuration files we need.
 +cd OpenWrt-ImageBuilder-ar71xx_generic-for-linux-i486
 +make image PROFILE=TLWR703 "PACKAGES=kmod-lib-crc16 kmod-scsi-core kmod-usb-storage-extras kmod-usb-storage libuuid libblkid libcom_err libpthread libext2fs e2fsprogs kmod-nls-cp437 fdisk kmod-fs-ext4 kmod-fs-vfat kmod-nls-iso8859-1 librt terminfo dosfsck uhttpd lua" FILES=../image-files
 +
 +# Copy build image to here, and show the user
 +cp bin/ar71xx/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin ..
 +cd ..
 +
 +echo "Mesh Extender firmware image built:"
 +ls -l openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
 +</code>
 +gather-image-files
 +  - change line 71 as follows
 +<code>
 +cp ../openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin .
 +</code>
 +flash-virgin-mr3020
 +  - Change line 12 as follows
 +<code>
 +firmware=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
 +</code> 
 +- Build the OpenWRT image (this will download a lot of stuff the first time you run it, but you can re-run it quickly there after if you change something).
 +<code>
 +$ ./make_image
 +</code>
 +  - Build the serval.up file
 +<code>
 +$ ./gather-image-files
 +</code>
 +  - Insert the USB memory stick into the installation computer, noting its device name(can be found by typing "df" into the console), then unmount all the device partitions, then partition it using the following script, replacing deviceid with the Linux disk device, e.g., sdf.  MAKE SURE YOU GIVE IT THE RIGHT DEVICE OR IT MIGHT TRY TO REPARTITION YOUR HARD DRIVE!
 +<code>
 +$ umount /dev/deviceid
 +$ ./partition-memory-stick.sh deviceid
 +</code>
 +  - Remove and reinsert the USB memory stick so that the kernel notices the new partition table.
 +  - Unmount the USB partitons again
 +  - Populate the USB memory stick, again replacing deviceid with the right device, e.g., sdf. MAKE SURE YOU GIVE IT THE RIGHT DEVICE OR IT MIGHT ERASE THE PARTITIONS ON YOUR HARD DRIVE!
 +<code>
 +$ ./populate-memory-stick deviceid
 +</code>
 +  - Unplug the USB memory stick and insert it into the MR3020 that is to become a mesh extender.
 +  - Power up the MR3020, and connect it via ethernet to the installation machine, and wait a couple of minutes for it to boot up.
 +  - If the MR3020 is still running the stock firmware, flash it this way:
 +<code>
 +$ ./flash-virgin-mr3020
 +</code>
 +You may need to specify the IP address on the command line if the script doesn't auto-detect the IP address. The most likely address is 192.168.0.254
 +  - If the MR3020 already has OpenWRT, flash it this way.  (You might need to boot the Mesh Extender into fail-safe mode first.)
 +<code>
 +$ ./reflash-mesh-extender
 +</code>
 +You may need to specify the IP address on the command line if the script doesn't auto-detect the IP address. The most likely address is 192.168.1.1 or 192.168.2.1, e.g.:
 +<code>
 +$ ./reflash-mesh-extender 192.168.2.1
 +</code>
 +
 +The WR703N should reboot as a fully functional Mesh Extender.
  
 ===== Installing base OpenWRT on the WR703N ===== ===== Installing base OpenWRT on the WR703N =====
Line 25: Line 113:
   - Download http://downloads.openwrt.org/attitude_adjustment/12.09-beta2/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin   - Download http://downloads.openwrt.org/attitude_adjustment/12.09-beta2/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
   - Plug in and boot WR703N   - Plug in and boot WR703N
-  - Connect to it as a WiFi client+  - Connect to it using an ethernet cable (it will offer you an IP address by DHCP)
   - Browse to http://192.168.1.1. If Prompted, login as admin/admin   - Browse to http://192.168.1.1. If Prompted, login as admin/admin
   - Choose last menu item on the left.   - Choose last menu item on the left.
Line 32: Line 120:
  
 You should now have OpenWRT on your WR703N. You should now have OpenWRT on your WR703N.
 +
 +Then login with ''telnet 192.168.1.1'' and use ''passwd root'' to set a root password (just use ''root'' as the password to keep things easy while experimenting).  Once you have set a root password, ''telnet'' will be disabled, and ''ssh'' will be enabled.  Log in using ''ssh root@192.168.1.1'' after that.
  
 ===== Enabling External USB Storage ===== ===== Enabling External USB Storage =====
Line 88: Line 178:
 You should now be able to mount your 1GB partition that we will use for /overlay: You should now be able to mount your 1GB partition that we will use for /overlay:
  
-''mount /dev/sda1 /mnt'+''mount /dev/sda1 /mnt''
  
 Now run the following commands on the router (taken from http://blog.night-shade.org.uk/2013/01/more-storage-on-openwrt/): Now run the following commands on the router (taken from http://blog.night-shade.org.uk/2013/01/more-storage-on-openwrt/):
Line 126: Line 216:
 </code> </code>
  
-Reboot and you should have 1GB in /overlay, mounted from USB+Reboot and you should have 1GB in /overlay, mounted from USB, as well as large /home and /serval partitions. 
 + 
 +===== Installing and setting up servald ===== 
 + 
 +In the short preparation time we have for KiwiEx, we have not had time to configure a single OpenWRT package that includes all setup, so the following recipe is required: 
 + 
 +  - Build yourself a serval ipk from our OpenWRT repository at https://github.com/servalproject/commotion-openwrt  (more detailed instructions on doing this will be forthcoming -- but the short story is use ''menuconfig'' to enable building of Serval as a module and then build it). 
 +  - Install ''librt_0.9.33.2-1_ar71xx.ipk'' 
 +  - Install the ''serval-*.ipk'' you built in step 1 
 +  - Install the following files in the described locations, and then reboot: 
 + 
 +==== /etc/config/network ==== 
 + 
 +Change the IP address in this file from 29.167.164.237 to something random between 28.0.0.0 and 29.255.255.255 
 +Change the IP address from 192.168.2.1 to 192.168.2.x if you want to be able to ssh in without ssh complaining about conflicting keys all the time. 
 + 
 +<file> 
 +config interface 'loopback' 
 + option ifname 'lo' 
 + option proto 'static' 
 + option ipaddr '127.0.0.1' 
 + option netmask '255.0.0.0' 
 + 
 +config interface 'lan' 
 + option ifname 'eth0' 
 +# option type 'bridge' 
 + option proto 'static' 
 + option ipaddr '192.168.2.1' 
 + option netmask '255.255.255.0' 
 + 
 +config interface public 
 + option proto static 
 + option ipaddr 192.168.100.1 
 + option netmask 255.255.255.0 
 + 
 +config interface mesh 
 +    option ifname wlan0-1 
 +    option proto    static 
 +      option ipaddr 29.167.164.237 
 +    option netmask 254.0.0.0 
 +</file> 
 + 
 +==== /etc/config/wireless ==== 
 + 
 +Change the mac address 5c:63:bf:bb:41:90 to the mac address written on the back of the WR703N case. 
 + 
 +<file> 
 +config wifi-device radio0 
 +        option type       mac80211 
 +        option channel    6                            
 +        option hwmode     11ng 
 +        option macaddr 5c:63:bf:bb:41:90 
 + option htmode HT20 
 + list ht_capab SHORT-GI-20 
 + list ht_capab SHORT-GI-40 
 + list ht_capab RX-STBC1 
 + list ht_capab DSSS_CCK-40 
 +                                                       
 +config wifi-iface mesh                                 
 +        option device   radio0 
 +        option ssid     mesh.servalproject.org         
 +        option network  mesh                           
 +        option mode     adhoc 
 +        option bssid    02:ca:ff:dd:ca:ce              
 +        option bgscan                                
 +                                                       
 +config wifi-iface public                       
 +        option device     radio0 
 +        option network    public               
 +        option mode       ap                   
 +        option isolate    0                    
 +        option ssid       public.servalproject.org 
 +        option hidden                            
 +        option encryption none 
 +</file> 
 + 
 +==== /etc/rc.d/S94servald ==== 
 + 
 +Don't forget to chmod 755 this file once you have installed it 
 + 
 +<file> 
 +#!/bin/sh /etc/rc.common 
 +# Copyright (C) 2006 OpenWrt.org 
 + 
 +START=41 
 + 
 +start() { 
 +  # Start servald 
 +  export SERVALINSTANCE_PATH=/etc/serval 
 +  mkdir -p $SERVALINSTANCE_PATH 
 +  /serval/runservald & 
 +
 + 
 +stop() { 
 +  export SERVALINSTANCE_PATH=/etc/serval 
 +  servald stop 
 +
 +</file> 
 + 
 +==== /serval/runservald ==== 
 + 
 +Don't forget to chmod 755 this and the other scripts. 
 + 
 +<file> 
 +#!/bin/sh 
 +while [ 1 ] 
 +do 
 +/serval/servald start foreground 
 +done 
 +</file> 
 +==== /etc/serval/servald.conf ==== 
 + 
 +The small MDP block size is necessary due to the high bit error rate on the radios, and the suboptimal scheduling of rhizome mdp packets (including the lack of supression of duplicate requests). 
 + 
 +The small max_internal_blob_size is to get around the VERY slow performance of sqlite on the USB memory on the WR703N, which could take several minutes to prepare an empty blob, before even beginning to put any data into it. 
 + 
 +The long timeout (30seconds) is so that we don't easily drop transfers, especially while the previously mentioned problems persist. 
 + 
 +<file> 
 +interfaces.1.encapsulation=single 
 +interfaces.1.file=/dev/ttyUSB0    
 +interfaces.1.socket_type=stream 
 +interfaces.1.type=catear        
 +interfaces.2.match=eth0  
 +interfaces.2.type=ethernet 
 +interfaces.3.match=wlan0   
 +interfaces.3.type=wifi   
 +interfaces.4.match=wlan0-1 
 +interfaces.4.type=wifi     
 +rhizome.datastore_path=/serval 
 +rhizome.idle_timeout=30000     
 +rhizome.rhizome_mdp_block_size=100 
 +rhizome.max_internal_blob_size=16384 
 +</file> 
 +==== /etc/config/dhcp ==== 
 + 
 +<file> 
 +config dnsmasq 
 + option domainneeded 1 
 + option boguspriv 1 
 + option filterwin2k 0  # enable for dial on demand 
 + option localise_queries 1 
 + option rebind_protection 1  # disable if upstream must serve RFC1918 addresses 
 + option rebind_localhost 1  # enable for RBL checking and similar services 
 + #list rebind_domain example.lan  # whitelist RFC1918 responses for domains 
 + option local '/lan/' 
 + option domain 'lan' 
 + option expandhosts 1 
 + option nonegcache 0 
 + option authoritative 1 
 + option readethers 1 
 + option leasefile '/tmp/dhcp.leases' 
 + option resolvfile '/tmp/resolv.conf.auto' 
 + #list server '/mycompany.local/1.2.3.4' 
 + #option nonwildcard 1 
 + #list interface br-lan 
 + #list notinterface lo 
 + #list bogusnxdomain     '64.94.110.11' 
 +        list 'dhcp_option' '3'             
 +        list 'dhcp_option' '6' 
 + 
 + 
 +config dhcp lan 
 + option interface lan 
 + option start 100 
 + option limit 150 
 + option leasetime 12h 
 + 
 +config dhcp public 
 +        option interface public 
 + option start 50 
 + option limit 250 
 + option leasetime 12h 
 +</file>
 ====== USB Serial Port Drivers on OpenWRT ====== ====== USB Serial Port Drivers on OpenWRT ======
  
Line 203: Line 466:
 For servald, it will be fairly easy to patch the dummynet driver that already reads and writes to an ordinary file.  We will just need to implement flow control/throttling, and packet encapsulation in case of communications errors. For servald, it will be fairly easy to patch the dummynet driver that already reads and writes to an ordinary file.  We will just need to implement flow control/throttling, and packet encapsulation in case of communications errors.
  
 +====== Configuring RFD900 Radios for use ======
 +
 +Connect as described above and set air speed to 128kbit, and serial speed to 57600, and TX power to +24dBm with a command sequence like:
 +
 +<file>
 +ATS1=57
 +ATS2=128
 +ATS4=24
 +ATI5
 +AT&W
 +</file>
 +
 +We could use 115200 for the serial speed, but that would require a recompile of servald, which currently assumes radios at 57600, and the gain would be small, because 128k/2=64kbit total bandwidth, shared among both ends gives 32000 for each end, and so it is unlikely that the bandwidth will be depleted.
 +
 +128kbit is the fastest effective radio speed until we get some better forward error correction.  250kbit should work, but proved to be quite unreliable, with desynchronisation and high levels of packet loss.
content/meshextender/prototyping_on_mp2.txt · Last modified: 14/07/2015 01:01 by Nathan Fowler