RehrigPacific-3.2

From VentureResearchWiki
Jump to navigation Jump to search

BOARD SETUP[edit | edit source]

U-boot[edit | edit source]

substitute the u-boot-vrreader... file with the latest u-boot file substitute 1c0000 with the size of u-boot

bootp
mw.b 0x80000000 0xff 0x1c0000
tftp 0x80000000 u-boot-vrreader-am35.bin
nand erase 0x80000 1c0000
nand write 0x80000000 0x80000 1c0000
reset

kernel[edit | edit source]

setenv ethaddr [MAC in format 00:50:c2:7c:57:01, F8:DC:7A:00:A7:C8]
setenv get_kernel nand read.i 0x80000000 0x280000 0x300000
setenv bootargs_fs mem=256M console=ttyO2,115200n8 noinitrd root=/dev/mtdblock4 rw rootfstype=jffs2 eth=$ethaddr
setenv boot_fs run get_kernel\; setenv bootargs \$bootargs_fs\; bootm 0x80000000
setenv bootcmd run boot_fs
setenv bootdelay 1
save
bootp
mw.b 0x80000000 0xFF 0x500000
tftp 0x80000000 uImage-vrreader-am35.bin
nand erase 0x280000 0x500000
nand write 0x80000000 0x280000 0x300000
reset
bootp
tftp 0x80000000 uImage-vrreader-am35.bin
setenv bootargs console=ttyO2,115200n8 root=/dev/nfs rw ip=dhcp nfsroot=192.168.19.128:/srv/nfs/image ethaddr=00:50:c2:7c:5f:fc consoleblank=0 omapfb.mode=lcd:1024x768@60
bootm 0x80000000

filesystem[edit | edit source]

flash_erase -j /dev/mtd4 0 0
mknod /dev/mtdblock4 b 31 4
scp venture@embedded-prod:/home/yocto/poky/build/tmp/deploy/images/venture-image-rehrig-vrreader-am35.tar.bz2 /tmp/
mkdir /tmp/flash
mount -t jffs2 /dev/mtdblock4 /tmp/flash/
cd /tmp/flash
tar xjvf /tmp/venture-image-rehrig-vrreader-am35.tar.bz2
[ replace with MAC address ] echo vr-00xxxx > etc/hostname
echo 127.0.0.1 cat etc/hostname >> etc/hosts
sync
reboot

provisioning[edit | edit source]

first run[edit | edit source]

echo root:rfid4ever_vr | chpasswd -m
username: root
password: rfid4ever_vr
  • change the packages file
vi /etc/opkg/base-feeds.conf

change /ipk/vrreader-am35 to /ipk/vrreader_am35

  • install/update app
opkg update
opkg upgrade vr-setup-gpio
opkg install ntpdate
  • delete the ntp entry in crontab
crontab -e
  • append the following crotab entries to setup auto backup of the db
crontab -e
0 0 * * * /home/user/db-archive.sh
0 6 * * * /home/user/db-archive.sh
0 12 * * * /home/user/db-archive.sh
0 18 * * * /home/user/db-archive.sh
update-rc.d crond defaults
  • ntpdate setup
ntpdate -u time1.google.com

verify offset

ntpdate -u time1.google.com	
hwclock -w

verify clock

hwclock -r
  • db setup

copy files from vm-linux-prod to the local machine

mkdir /home/user
scp venture@10.19.6.1:~/rehrigpacific/reader.db /home/user/
scp venture@10.19.6.1:~/rehrigpacific/reader-default.db /home/user/
scp venture@10.19.6.1:~/rehrigpacific/db-archive.sh /home/user/
  • timezone

setup timezone

echo UTC > /etc/timezone
cp /usr/share/zoneinfo/UTC /etc/localtime
  • copy remote user key
scp venture@10.19.6.1:~/remote-prod.pub /home/root/.ssh/authorized_keys
  • disable printk messages from on console
vi /etc/rcS.d/S55bootmisc.sh

append at the end of file

   # disable printk to console
echo "4 4 1 7" > /proc/sys/kernel/printk
  • load modules for the new kernel
opkg remove kernel-modules
opkg list | grep kernel-module | cut -d ' ' -f 1 | xargs opkg remove --force-removal-of-dependent-packages
opkg update
opkg list | grep kernel-module | cut -d ' ' -f 1 | xargs opkg install
depmod
sync
reboot
  • setup monit
vi /etc/monitrc

append the following

## Check that a process is running, in this case Apache, and that it respond
## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
## and number of children. If the process is not running, Monit will restart
## it by default. In case the service is restarted very often and the
## problem remains, it is possible to disable monitoring using the TIMEOUT
## statement. This service depends on another service (apache_bin) which
## is defined above.
#
check process forkliftreader_linux with pidfile /var/run/forkliftreader_linux.pid
start program = "/etc/init.d/rfid start" with timeout 60 seconds
stop program = "/etc/init.d/rfid stop"
  • setup VPN
ssh venture@vm-linux-prod "sudo ./openvpn-genclientkey.sh hostname" 

on the host machine:

wget http://ipk.ventureresearch.com/openvpn/hostname.tar.gz -O -| tar xzvC /etc/openvpn
update-rc.d openvpn defaults
  • setup sd card
vi /etc/fstab

append the following

/dev/mmcblk0p1       /media/mmcblk0p1          auto       defaults,sync  0  0
mkdir /media/mmcblk0p1		//may not be needed?
  • setup rfid port
vi /etc/init.d/rfid

change "-c 3" to "-c /dev/ttyO0" for M5e

change "-c 3" to "" for M6e

  • setup gps serial port
vi /etc/default/gpsd
GPSD_OPTIONS="-n -b"
GPS_DEVICES="/dev/ttyO1"
  • edit vr-setup-gpio to modify ext_g [ONLY ON rev3.5 boards]

modify "setupgpio ext_g 79 out 0" to "setupgpio ext_g 96 out 0"

  • setup rfid service config file
telnet localhost 2020
  • for M5e
set M6EENABLED DISABLED
set M5EENABLED ENABLED
  • for M6e
set M5EENABLED DISABLED
set M6EENABLED ENABLED
  • for r3.2 board
set TEMPFILE /sys/bus/i2c/devices/3-002a/temp1_input
  • for r3.5 board
set TEMPFILE /sys/bus/i2c/devices/3-004c/temp1_input
set RFCNTRLFILE /var/run/vrgpio/ctl_rf
set INTRFILE /var/run/vrgpio/io_led_r
set INTAFILE /var/run/vrgpio/io_led_a
set INTGFILE /var/run/vrgpio/io_led_g
set EXTRFILE /var/run/vrgpio/ext_r
set EXTAFILE /var/run/vrgpio/ext_a
set EXTGFILE /var/run/vrgpio/ext_g
set EXTBUZ1FILE /var/run/vrgpio/ext_b1
set EXTBUZ2FILE /var/run/vrgpio/ext_b2
set EXTAUX1FILE /var/run/vrgpio/ext_aux1
set EXTAUX2FILE /var/run/vrgpio/ext_aux2
set EXTAUX3FILE /var/run/vrgpio/ext_aux3
set TRIG1FILE /var/run/vrgpio/tr1
set TRIG2FILE /var/run/vrgpio/tr2
set TRIG3FILE /var/run/vrgpio/tr3
set TRIG4FILE /var/run/vrgpio/tr4
set TRIGGERLEVEL 1 1 1 1 0 0 0 0
set ANTENNA A
set POWERBASE 24
set READMODE cont
set HEARTBEATTIMER 60
set HEARTBEAT enabled
set TIMESTAMP enabled
set TAGMETADATA rssi readcount antenna
set ASYNCMETADATA rfid sys io hostname gps
set SERVERURL http://tags.rehrigpenn.com/upload.aspx
set ALARMENABLED enabled
set TRIGGERTIMEOUT 1000
rfid TAGTABLE enabled
set FILTERTABLE enabled
set TAGPERSIST 300
set APPSTATEENABLED rehrig

setup the reader db first!!!!!

set dbdelivery enabled
commit

set antenna to ab only if its the dual antenna enclosure

SET ANTENNA AB

now save a copy of the vrfrv2-linux.json file as vrfrv2-linux-default.json

  • backup important directories

(on vm-linux-prod: nc -l -p 1234 > backup.tar.gz)

tar cz /etc /home /root /media /var | nc 10.19.6.1 1234
  • gps script
scp venture@10.19.6.1:~/rehrigpacific/watch-gps.sh /home/user/
chmod +x /home/user/watch-gps.sh
crontab -e
* * * * * /home/user/watch-gps.sh
  • Do this part ONLY if there is a TTL-USB conv for GPS and an extra serial port for Zonar

get the id of the gsm modem

ls /dev/serial/by-id/

example:

usb-Novatel_Wireless_Inc._Novatel_Wireless_CDMA_091163117961000-if00-port0

copy over the new vr-wan file

scp venture@10.19.6.1:~/rehrigpacific/vr-wan /usr/sbin/

edit the new vr-wan file and change the GSM id to match the device's unique id

modify the modem in the verizon ppp file

vi /etc/ppp/peers/verizon

change ttyUSB0 to "serial/by-id/usb-Novatel_Wireless_Inc._Novatel_Wireless_CDMA_091155881991000-if00-port0" where the gsm id should be the device's unique id

change the GPS connection from /dev/ttyO1 to /dev/ttyGPS

copy the udev rule for gps

scp venture@10.19.6.1:~/rehrigpacific/10-usb.rules /etc/udev/rules.d/

set the zonar parameters:

SET ZONARENABLED ENABLED
SET ZONARCONN /dev/ttyO1

finished!!

TESTING[edit | edit source]

  • DB-TESTING
sqlite3 reader.db
select * from event order by id desc limit 5;
select count(*) from event where isDelivered="false";
  • resend tags

log on to vm-linux-prod and go to the appropriate backup directory

cd ~/logs-vr-00a7d1/2012-08

modify permissions

chmod 777 .

unzip the backup file

gzip -dc reader-backup_20120831T180001.db.gz > reader-backup_20120831T180001.db

send the backup db file to lab-ubuntu for delivery

scp reader-backup_20120831T180001.db venture@lab-ubuntu:/home/user

open the db

sqlite3 reader.db

reset the delivery flag

update event set isdelivered="false";

rename the delivery file to reader.db

start the forkliftreader_linux

verify the Success message