Project

General

Profile

Raspberry Pi IoT Setup » History » Version 6

Spencer Sutterlin, 06/10/2014 02:37 PM

1 1 Spencer Sutterlin
Raspberry Pi IoT Setup
2
======================
3 3 Spencer Sutterlin
4 5 Spencer Sutterlin
## Cross-compile:
5 1 Spencer Sutterlin
6 5 Spencer Sutterlin
[[Cross-compiling NDN projects for Raspberry Pi]]
7
8 3 Spencer Sutterlin
* ndn-cxx
9 1 Spencer Sutterlin
* NFD
10
11 5 Spencer Sutterlin
## On the Pi:
12
Set up networking. Also, NFD uses ipv6 (as well as ipv4) so we need to enable that in the raspberry pi kernel because it's disabled by default.
13 1 Spencer Sutterlin
14 5 Spencer Sutterlin
    nano /etc/network/interfaces # Tweak networking as desired
15
    sudo vim /etc/modules # Add “ipv6”
16
    sudo reboot
17 1 Spencer Sutterlin
18 5 Spencer Sutterlin
Install the essentials
19 1 Spencer Sutterlin
20 5 Spencer Sutterlin
    sudo apt-get update
21
    sudo apt-get install git vim
22
    sudo apt-get install build-essential
23 1 Spencer Sutterlin
24 5 Spencer Sutterlin
Install libraries required by ndn-cxx, NFD, PyNDN2
25
26
    sudo apt-get install openssl expat libpcap-dev
27
    sudo apt-get install libssl-dev libsqlite3-dev libcrypto++-dev libboost-all-dev
28
29
Go git PyNDN2 and ndn-pi
30
31
    mkdir ~/ndn
32
    cd ~/ndn
33
    git clone https://github.com/named-data/PyNDN2.git
34
    git clone https://github.com/remap/ndn-pi.git
35
    echo "export PYTHONPATH=$PYTHONPATH:$HOME/ndn/PyNDN2/python:$HOME/ndn/ndn-pi" >> ~/.bashrc
36
37
Also since GPIO sensors must be run as root, environment variables are cleared. Specify to keep PYTHONPATH for sudo
38
39
    sudo visudo # Add “Defaults	env_keep += “PYTHONPATH”
40
41
Copy/install cross-compiled ndn-cxx and NFD files (bin, etc, include, lib) from host to /usr/local on target (Pi).
42
43
Install required pip and python packages
44
45
    wget https://bootstrap.pypa.io/get-pip.py
46
    sudo python get-pip.py
47
    rm get-pip.py
48
    sudo pip install pycrypto
49
    sudo pip install trollius
50
51
52 6 Spencer Sutterlin
## If HDMI-CEC node
53
### Install libcec:
54 5 Spencer Sutterlin
Can either be cross-compiled or compiled locally on the pi. Since it only needs to be done once, I just did it on the pi, but it took a bit. They do have a script for cross-compiling for the Raspberry Pi though.
55
56
    cd ~/ndn
57
    git clone https://github.com/Pulse-Eight/libcec
58
    sudo apt-get install autoconf libtool pkg-config
59
    sudo apt-get install liblockdev1-dev libudev-dev
60
61
    ./bootstrap
62
    ./configure --with-rpi-include-path="/opt/vc/include" --with-rpi-lib-path="/opt/vc/lib " --enable-rpi --enable-debug
63
    make
64
    sudo make install
65 1 Spencer Sutterlin
    sudo ldconfig
66 6 Spencer Sutterlin
67
### Install protobuf
68
Since just a 1 time thing, I just did it on the pi, but it took a bit.
69
70
    wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
71
    tar -zxf protobuf-2.5.0.tar.gz
72
    cd protobuf-2.5.0
73
    ./configure
74
    make
75
    make install