Raspberry Pi IoT Setup¶
Cross-compile:¶
Cross-compiling NDN projects for Raspberry Pi
- ndn-cxx
- NFD
On the Pi:¶
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.
nano /etc/network/interfaces # Tweak networking as desired
sudo vim /etc/modules # Add “ipv6”
sudo reboot
Install the essentials
sudo apt-get update
sudo apt-get install git vim
sudo apt-get install build-essential
Install libraries required by ndn-cxx, NFD, PyNDN2
sudo apt-get install openssl expat libpcap-dev
sudo apt-get install libssl-dev libsqlite3-dev libcrypto++-dev libboost-all-dev
Go git PyNDN2 and ndn-pi
mkdir ~/ndn
cd ~/ndn
git clone https://github.com/named-data/PyNDN2.git
git clone https://github.com/remap/ndn-pi.git
echo "export PYTHONPATH=$PYTHONPATH:$HOME/ndn/PyNDN2/python:$HOME/ndn/ndn-pi" >> ~/.bashrc
Also since GPIO sensors must be run as root, environment variables are cleared. Specify to keep PYTHONPATH for sudo
sudo visudo # Add “Defaults env_keep += “PYTHONPATH”
Copy/install cross-compiled ndn-cxx and NFD files (bin, etc, include, lib) from host to /usr/local on target (Pi).
Install required pip and python packages
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
rm get-pip.py
sudo pip install pycrypto
sudo pip install trollius
If HDMI-CEC node¶
Install libcec:¶
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.
cd ~/ndn
git clone https://github.com/Pulse-Eight/libcec
sudo apt-get install autoconf libtool pkg-config
sudo apt-get install liblockdev1-dev libudev-dev
./bootstrap
./configure --with-rpi-include-path="/opt/vc/include" --with-rpi-lib-path="/opt/vc/lib " --enable-rpi --enable-debug
make
sudo make install
sudo ldconfig
Install protobuf¶
Since just a 1 time thing, I just did it on the pi, but it took a bit.
sudo apt-get install python-protobuf
Create protobuf header¶
cd ~/ndn/ndn-pi
protoc --python_out=. cec_messages.proto
Updated by Spencer Sutterlin over 10 years ago · 7 revisions