LinuxBoard3.5

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 eth=$ethaddr 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]

Setup Password[edit | edit source]

echo root:rfid4ever_vr | chpasswd -m

Login Information[edit | edit source]

username: root
password: rfid4ever_vr

modify the packages file[edit | edit source]

vi /etc/opkg/base-feeds.conf

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

install/update applications[edit | edit source]

opkg update
opkg upgrade vr-setup-gpio
[IF M6E] opkg upgrade vrfrv2-linux

setup ntp[edit | edit source]

opkg install ntpdate
  • delete the ntp entry in crontab
crontab -e
  • ntpdate setup
ntpdate -u time1.google.com
  • verify offset
ntpdate -u time1.google.com	
hwclock -w
  • verify clock
hwclock -r
  • setup timezone
echo UTC > /etc/timezone
cp /usr/share/zoneinfo/UTC /etc/localtime

setup db delivery[edit | edit source]

  • 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
  • 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/

copy remote user key[edit | edit source]

scp venture@10.19.6.1:~/remote-prod.pub /home/root/.ssh/authorized_keys

disable printk messages from on console[edit | edit source]

vi /etc/rcS.d/S55bootmisc.sh

append at the end of file, before exit 0

# disable printk to console
echo "4 4 1 7" > /proc/sys/kernel/printk

load modules for the new kernel[edit | edit source]

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
sync

setup monit[edit | edit source]

vi /etc/monitrc
  • look up
## 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.
#
  • append the following
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[edit | edit source]

ssh venture@vm-linux-prod "sudo ./openvpn-genclientkey.sh hostname" 
wget http://ipk.ventureresearch.com/openvpn/`hostname`.tar.gz -O -| tar xzvC /etc/openvpn
update-rc.d openvpn defaults

setup sd card[edit | edit source]

vi /etc/fstab

append the following

/dev/mmcblk0p1       /media/mmcblk0p1          auto       defaults,sync  0  0

create directory

mkdir /media/mmcblk0p1

setup rfid port[edit | edit source]

vi /etc/init.d/rfid
  • [if M5E] change "-c 3" to "-c /dev/ttyO0"
  • [if M6E] change "-c 3" to ""

setup gps serial port[edit | edit source]

vi /etc/default/gpsd
GPSD_OPTIONS="-n -b"
[if using internal UART] GPS_DEVICES="/dev/ttyO1"
[if using USB-to-TTL] GPS_DEVICES="/dev/ttyGPS"
  • 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
  • copy the udev rule for GPS
[if using USB-to-TTL] scp venture@10.19.6.1:~/rehrigpacific/10-usb.rules /etc/udev/rules.d/

setup gsm USB760[edit | edit source]

  • 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

setup rfid service config file[edit | edit source]

telnet localhost 2020
  • if using M5E
set M6EENABLED DISABLED
set M5EENABLED ENABLED
  • if using M6E
set M5EENABLED DISABLED
set M6EENABLED ENABLED
set M6ECONN tmr:///dev/ttyO0
set TEMPFILE /sys/bus/i2c/devices/3-004c/temp1_input
set TEMP2FILE /sys/bus/i2c/devices/3-004c/temp2_input
set TEMP3FILE /sys/bus/i2c/devices/3-004c/temp3_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
  • if using M5E
set ANTENNA A
  • if using M6E
set ANTENNA TMMUXABCD-MANUAL
set MUX 1 2
set POWERBASE 24
set READMODE cont
set HEARTBEATTIMER 60
set HEARTBEAT enabled
set TIMESTAMP enabled
set TAGMETADATA rssi readcount antenna
set ALARMENABLED enabled
set TRIGGERTIMEOUT 1000
rfid TAGTABLE enabled
set FILTERTABLE enabled
set TAGPERSIST 10
set TAGRESEND 0
set APPSTATEENABLED enabled
  • for Rehrig Pacific
set ASYNCMETADATA rfid sys io hostname gps
set SERVERURL http://tags.rehrigpenn.com/upload.aspx
set dbdelivery enabled
set APPSTATEENABLED rehrig
set TAGPERSIST 300
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 [if needed][edit | edit source]

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

tar cz /etc /home /root /media /var | nc 10.19.6.1 1234

set the zonar parameters:[edit | edit source]

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