Skip to content

Instantly share code, notes, and snippets.

@ashiqopu
Last active October 30, 2020 21:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ashiqopu/547f357345db396fdf3e36e6ed462cbe to your computer and use it in GitHub Desktop.
Save ashiqopu/547f357345db396fdf3e36e6ed462cbe to your computer and use it in GitHub Desktop.
Installing NFD on Raspberry Pi from Source

Introduction

The NFD and it's related tools and software packages can be installed on platforms mentioned in the official NFD documentation. However, a successful installation on constrained hardware like the Raspberry Pi with the official Raspbian OS is tricky and sometimes suggested to perform a cross-compilation and install the generated binaries. Although it's possible to install Ubuntu MATE and install the relevant pre-compiled binaries directly, one might need to go through the painstaking process of the MATE environment setup, and not be able to modify code to test/experiment self-written features.

In this documentation, I will talk about how to perform a step-by-step (as noob as possible) installation of NFD and related software from source on the Raspberry Pi running official Raspbian OS. The trick is two-folds-

  • Install Raspbian Lite instead of full Raspbian Stretch with Pixel desktop to save a lot of memory.
  • Use clang++ instead of GCC as default compiler to speedup compilation.

The process discussed here has been successfully tested with both Raspberry Pi model 2 and 3b with wireless interface networking.

Prepare the Pi

  • Follow official Raspbian installation guide to install Raspbian Lite on the SD card.
  • Connect Raspberry Pi with HDMI to an external display, attach power cord and a keyboard.
  • Boot into your Pi device.
  • Login:
    • default user : pi
    • default password : raspberry
  • Prerequisites for Model 2 only
sudo reboot
  • Connect to wifi by using (do a little google for details or follow this)
sudo raspi-config

Installing clang++ compiler

Using clang++ helps speedup the compilation and also helps to avoid memory hogging by gcc and therefore does not require increasing swap memory.

Installing NFD and related NDN software

sudo apt-get update
sudo apt-get upgrade

Prerequisites

Note: minimum boost library requirement is 1.58.

sudo apt-get install git build-essential pkg-config libboost1.62-all-dev \
                     libsqlite3-dev libssl-dev libpcap-dev

Manpage and API docs

Note: I skipped them. Details on how to install are available on NFD installation guide.

sudo apt-get install doxygen graphviz python-sphinx

Download and install ndn-cxx

git clone --recursive https://github.com/named-data/ndn-cxx.git
cd ndn-cxx
CXX=clang++ ./waf configure
./waf
sudo ./waf install
sudo ldconfig

Download and install NFD

git clone --recursive https://github.com/named-data/NFD.git
cd NFD
CXX=clang++ ./waf configure
./waf
sudo ./waf install

After installing NFD from source, you need to create a proper config file. If default location for ./waf configure was used, this can be accomplished by simply copying the sample configuration file:

sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf

To make NFD properly work, you also need to either disable IPv6 on NFD config file or enable IPv6 probing on Raspberry Pi. I disabled IPv6 in NFD config for now by setting enable_v6 no to all relevant entries.

Install ndn-tools (optional)

git clone --recursive https://github.com/named-data/ndn-tools.git
cd ndn-tools
CXX=clang++ ./waf configure
./waf
sudo ./waf install

Install NDN-routing infoedit tool (optional)

git clone --recursive https://github.com/NDN-Routing/infoedit.git
cd infoedit
make
sudo make install

Note: Edit the Makefile as following:

all: infoedit

infoedit: infoedit.hpp infoedit.cpp
	clang++ -o infoedit -std=c++14 infoedit.cpp -lboost_program_options

install: infoedit
	cp infoedit /usr/local/bin/infoedit

uninstall:
	rm /usr/local/bin/infoedit

Full set of documentation (tutorials + API) in build/docs

./waf docs

Only tutorials in build/docs

./waf sphinx

Only API docs in build/docs/doxygen

./waf doxgyen

General

All other documentations can be found at the official NFD install page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment