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
content:meshextender:prototyping_on_mp2 [16/02/2013 22:57]
Paul Gardner-Stephen [/etc/serval/servald.conf]
content:meshextender:prototyping_on_mp2 [14/07/2015 01:01] (current)
Nathan Fowler Added New firmware update Instructions
Line 13: Line 13:
 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 base OpenWRT on the WR703N =====+======Installing Serval on the WR703N (New way)====== 
 +Perform the following steps on a Linux box, but first ... 
 + 
 +===== SYSADMIN GENERAL'S WARNING ===== 
 + 
 +Because of the inherent risk of human error when instructing the scripts to format and repartition memory sticks, we recommend that you use an old laptop or similar, and dedicate it to this process, so that you do not endanger your data. 
 + 
 +===== WR703N Instructions ===== 
 + - 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. 
 +===== Configuration===== 
 +==== SSH access ==== 
 +First thing to make sure of is that the noroot  file has been deleted on the USB stick. Once this has been done use 
 +<code> 
 +$ ssh root@192.168.2.1 
 +</code> 
 + If this works you should be greeted by a splash screen showing serval version and some other details.\ 
 + 
 +From this you can check if the serval node is functioning properly by using 
 +<code> 
 +root@192.168.2.1 $ servald status 
 +</code> 
 +this will return either a few lines saying the status and should contain a line saying whether it is running or it will return a message saying servald is not found. If the latter is what is displayed delete noroot and reboot the mesh node with 
 +<code> 
 +$ rm /dos/noroot 
 +$ reboot 
 +</code> 
 +The serval node should reboot and work once it has rebooted. 
 + 
 +====Changing name of the device==== 
 +This is useful as it allows you to identify specific nodes if a few different ones are within range of each other rather than using sid or the phone number. 
 +<code> 
 +servald keyring set did `servald id self | tail -1` "Phone number" "Name" 
 +</code> 
 +This line allows the user to set the phone number and the name of the device for easy identification. 
 + 
 +====Disabling noroot lockout==== 
 +WARNING! THIS CAN ALLOW ANYONE ROOT ACCESS IF NECESSARY PRECAUTIONS AREN'T TAKEN WHICH MIGHT INCLUDE CHANGING THE ROOT PASSWORD. 
 + 
 +ssh into the node using the above method. Once you have access use the following to navigate to the folder which contains the script that produces the noroot file.Then open the script in Vi 
 +<code>  
 +$ cd /etc/init.d 
 +$vi dropbear 
 +</code> 
 + 
 +Find the two lines in this script that are as follows 
 +<code> 
 +passwd -l root # lock 
 +[ -e /dos/noroot ] && return 1 
 +</code> 
 +and comment them out by adding a # to the front as follows 
 +<code> 
 +# passwd -l root # lock 
 +# [ -e /dos/noroot ] && return 1 
 +</code> 
 + 
 +Once this has been done you will have root access at all times without having to delete noroot However it is a good idea to change the root password after doing this to discourage unauthorized access. this is achieved by using 
 +<code> 
 +$ passwd 
 +</code> 
 +===== Enabling SSH on a Mesh Extender ===== 
 + 
 +Remember if you wish to ssh to the Mesh Extender to power it down, remove the USB memory stick and insert it into any computer, and delete the NOROOT file from the FAT file system partition, and reinsert it into the Mesh Extender.  ssh as root with password root will now be available until next reboot. 
 + 
 +=====Troubleshooting==== 
 +====Sysupgrade not found==== 
 +This means that the openwrt currently on the router cannot find the sysupgrade file 
 +  - Download the sysupgrade image for the router you are flashing from this list [[http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/]] 
 +  - navigate to the folder where the image is located 
 +  - use the following to get the image onto the routers RAM 
 +<code> 
 +$ scp openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin root@192.168.1.1:/tmp 
 +</code 
 +  - ssh into the router then use the following command to flash the sysupgrade image 
 +<code> 
 +# sysupgrade -v /tmp/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs- 
 +sysupgrade.bin  
 +</code> 
 +  - Follow the serval instructions for your device to reflash serval to the device 
 + 
 +====Cannot ssh into the device==== 
 +There can be a few diffferent causes for this issue. 
 +===Telnet=== 
 +This occurs when a root password hasn't been set on the device 
 +  - Telnet into the device 
 +  - set the root password 
 +<code> 
 +$ telnet 192.168.1.1 
 +# passwd 
 +</code> 
 +  - after this reboot the device and check if the ssh is working if not try the failsafe route 
 + 
 +===Failsafe=== 
 +  - change your computer from DHCP to static ip with an address of 192.168.1.2 and subnet 255.255.255.0 
 +  - boot your router into failsafe mode e.g. TP-Link models can be booted into failsafe by holding the reset button once the light starts blinking on boot 
 +  - telnet into the router 
 +<code> 
 +$ telnet 192.168.1.1 
 +</code> 
 +  - mount the JFSS2 partition to allow you to edit the password or other files that could be causing the issues with 
 +<code> 
 +# mount_root 
 +</code> 
 +  - set the passwd if you forgot your password  
 +<code> 
 +# passwd 
 +</code> 
 +  - Reset the router to stock openwrt if issue is not password related by using 
 +<code> 
 +# firstboot 
 +</code> 
 +  - Once this is done reboot the router into normal mode using 
 +<code> 
 +# reboot -f 
 +</code> 
 + 
 +After this you will need to change your network settings back to dhcp to connect to the router through telnet/ssh 
 + 
 +====== Installing base OpenWRT on the WR703N ======
  
 WARNING: The following can brick newer WR703Ns (Firmware 1.7, Ver:1.6 or Ver:1.7 etc on the bottom of the unit. Ver:1.2 is known to be safe).  This is an issue with the OpenWRT firmware listed below.  You can safely use these instruction with your own built OpenWRT distro, provided it is new enough. We will do that later. WARNING: The following can brick newer WR703Ns (Firmware 1.7, Ver:1.6 or Ver:1.7 etc on the bottom of the unit. Ver:1.2 is known to be safe).  This is an issue with the OpenWRT firmware listed below.  You can safely use these instruction with your own built OpenWRT distro, provided it is new enough. We will do that later.
Line 204: Line 406:
 </file> </file>
  
-==== /etc/rc.d/S41servald ====+==== /etc/rc.d/S94servald ====
  
 Don't forget to chmod 755 this file once you have installed it Don't forget to chmod 755 this file once you have installed it
Line 218: Line 420:
   export SERVALINSTANCE_PATH=/etc/serval   export SERVALINSTANCE_PATH=/etc/serval
   mkdir -p $SERVALINSTANCE_PATH   mkdir -p $SERVALINSTANCE_PATH
-  servald start+  /serval/runservald &
 } }
  
Line 227: Line 429:
 </file> </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 ==== ==== /etc/serval/servald.conf ====
  
Line 232: Line 445:
  
 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 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> <file>
-rhizome.datastore_path=/serval 
-rhizome.max_internal_blob_size=16384 
-rhizome.rhizome_mdp_block_size=100 
-interfaces.1.type=catear 
-interfaces.1.file=/dev/ttyUSB0 
 interfaces.1.encapsulation=single interfaces.1.encapsulation=single
 +interfaces.1.file=/dev/ttyUSB0   
 interfaces.1.socket_type=stream interfaces.1.socket_type=stream
-interfaces.2.match=eth0+interfaces.1.type=catear        
 +interfaces.2.match=eth0 
 interfaces.2.type=ethernet interfaces.2.type=ethernet
-interfaces.3.type=wifi +interfaces.3.match=wlan0   
-interfaces.3.match=wlan0 +interfaces.3.type=wifi  
-interfaces.4.type=wifi+
 interfaces.4.match=wlan0-1 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> </file>
 ==== /etc/config/dhcp ==== ==== /etc/config/dhcp ====
Line 366: Line 582:
 ====== Configuring RFD900 Radios for use ====== ====== Configuring RFD900 Radios for use ======
  
-Connect as described above and set air speed to 250kbit, and serial speed to 57600, and TX power to +24dBm with a command sequence like:+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> <file>
 ATS1=57 ATS1=57
-ATS2=250+ATS2=128
 ATS4=24 ATS4=24
 ATI5 ATI5
Line 376: Line 592:
 </file> </file>
  
-(We could use 115200, but that would require a recompile of servald, which currently assumes radios at 57600, and the gain would be small, because 250k/2=115kbit total bandwidth, shared among both ends gives 57600 for each end.)+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.1361084266.txt.gz · Last modified: 16/02/2013 22:57 by Paul Gardner-Stephen