Gateway installation

From OpenMotics
Revision as of 20:23, 19 May 2014 by Fryckbos (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installing using a OpenMotics writer SD card

What's included ?

The OpenMotics software will be installed on the eMMC on-board flash storage of the BeagleBone Black.

The image is based on Angström Linux 2012.12 and contains extra packages:

  • supervisord
  • openvpn
  • ntpdate

The linux kernel is patched with 2 patches:

  • one patch that implements the RS485 driver in omap-serial
  • one patch that enables the watchdog timer on startup.

Small patches have been applied to the u-boot bootloader:

  • boot is set to the eMMC on-board flash storage
  • the boot delay is set to 0 seconds
  • the watchdog timer is enabled in u-boot

How to install ?

Download the OpenMotics writer image at TODO. Use a Linux PC to extract the OpenMotics image to the SD card.

Put the SD card into the PC and check dmesg for the drive number. Normally this line is shown on dmesg:

TODO

Here sdc is the SD card, the example writes the image to sdc. Please change the script below accordingly. Make sure to use the drive number of the SD card, otherwise you might overwrite your hard disk !

zcat openmotics.img.gz | dd of=/dev/sdc bs=10M

Boot from the SD card by putting it in the BeagleBone Black and pressing the USR1 button while booting. Login using root and no password, this can be done using SSH or the serial interface.

Install the OpenMotics base image (on the BeagleBone Black):

cd /opt/openmotics/writer
./writeEMMC.sh
sync

Remove the sd card and reboot the system. Now install the OpenMotics gateway software. Clone the OpenMotics Gateway repo, and run the install scripts:

./installGateway.sh


Building from scratch

Building the Angström image

For the diehards, you can compile the kernel, bootloader and Angström image from sources as described below. This is not required, you can more easily use the writer image described above.

Checkout the Angstrom setup scripts. Our image was built using commit 68f072cee57a008b15f6dfef87ad7b2a1ee7b02e:

git clone https://github.com/Angstrom-distribution/setup-scripts.git
cd setup-scripts
git checkout 68f072cee57a008b15f6dfef87ad7b2a1ee7b02e .
MACHINE=beagleboard ./oebb.sh config beaglebone
MACHINE=beagleboard ./oebb.sh update beaglebone
source ~/.oe/environment-angstromv2012.12

Build the kernel. You can find wdt.patch and omap-serial.c on the OpenMotics gateway repo.

MACHINE=beaglebone bitbake virtual/kernel -c configure
 
cd build/tmp-angstrom_v2012_12-eglibc/work/beaglebone-angstrom-linux-gnueabi/linux-mainline-3.8.13-r23a/git
git apply --ignore-space-change --ignore-whitespace wdt.patch
mv omap-serial.c drivers/tty/serial/omap-serial.c
cd -
 
MACHINE=beaglebone bitbake virtual/kernel -c compile
MACHINE=beaglebone bitbake virtual/kernel -c deploy


Build u-boot. You can find the patch on the OpenMotics gateway repo.

MACHINE=beaglebone bitbake u-boot-denx -c configure
 
cd build/tmp-angstrom_v2012_12-eglibc/work/beaglebone-angstrom-linux-gnueabi/u-boot-denx-2013.04-r0/git/
git apply 0001-Make-sure-watchdog-is-reenabled-upon-Linux-boot.patch
sed -i 's/#define CONFIG_BOOTDELAY.*1/#define CONFIG_BOOTDELAY                0/' include/configs/am335x_evm.h
cd -
 
MACHINE=beaglebone bitbake u-boot-denx -c compile
MACHINE=beaglebone bitbake u-boot-denx -c deploy


Create the openmotics bitbake configuration and build it:

cat << EOF > sources/meta-angstrom/recipes-images/angstrom/openmotics-image.bb
#Image for OpenMotics
 
include systemd-image.bb
 
ROOTFSTYPE_beaglebone = "ext4"
 
IMAGE_INSTALL += " \
    kernel-modules \
    python-audio python-codecs python-compile \
    python-compression python-core python-crypt python-ctypes \
    python-datetime python-dbus python-dev python-distutils \
    python-elementtree python-email python-fcntl python-html \
    python-image python-io python-lang python-logging \
    python-math python-mime python-misc python-multiprocessing \
    python-netclient python-netserver python-numbers python-numpy \
    python-numpy-dev python-pickle python-pkgutil python-pprint \
    python-profile python-pycairo python-pyopenssl python-pyserial \
    python-re python-readline python-resource python-setuptools \
    python-shell python-simplejson python-stringold python-subprocess \
    python-syslog python-terminal python-textutils python-threading \
    python-tornado python-unixadmin python-xml python-xmlrpc python-zlib \
    python-sqlite3 python-pygobject python-mmap \
    eglibc-gconv eglibc-gconv-unicode eglibc-gconv-utf-16 \
    i2c-tools procps iproute2 connman-tests systemd-analyze \
    tar task-sdk-target vim ntp screen ntpdate ntpdate-systemd"
 
export IMAGE_BASENAME = "OpenMotics"
 
EOF
 
MACHINE=beaglebone bitbake openmotics-image

You can find the kernel, u-boot and image in build/tmp-angstrom_v2012_12-eglibc/deploy/images/beaglebone/


Install the OpenMotics software

Clone the OpenMotics Gateway repo, and run the install scripts:

./installBase.sh
./installGateway.sh