Project

General

Profile

Raspberry Pi IoT Setup » History » Version 5

Spencer Sutterlin, 06/10/2014 02:18 AM

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
## If HDMI-CEC node, install libcec:
53
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.
54
55
    cd ~/ndn
56
    git clone https://github.com/Pulse-Eight/libcec
57
    sudo apt-get install autoconf libtool pkg-config
58
    sudo apt-get install liblockdev1-dev libudev-dev
59
60
    ./bootstrap
61
    ./configure --with-rpi-include-path="/opt/vc/include" --with-rpi-lib-path="/opt/vc/lib " --enable-rpi --enable-debug
62
    make
63
    sudo make install
64
    sudo ldconfig