compute module 3 photo

Nard SDK

Not Another Raspberry Distribution

Introduction

Nard GNU/Linux is a software development kit (SDK) for Raspberry Pi. Unlike "ordinary" Linux distributions Nard is intended entirely for the development of MOTS embedded systems running day and night for years in remote locations. And you are more or less expected to add your unique custom application on top of the Nard platform.

Nard operates in a Raspberry Pi like a Live USB in a PC. During boot everything is uploaded to RAM and executed from there. You may even remove/hot swap the SD-card from a running system at any time and it will continue to operate just fine! The SD-card is only accessed upon request by your custom application.

Main features:

raspberry pi 1B photo
raspberry pi 2B photo

Quick Start Guide

icon play

Easy building

For the impatient here is a pre-built demo image for all Pi models up to 3B+. However, if you have ever done C/C++ compiling before; read on. You can easily create your own image. After unpacking the tarball you get this tree:
$ tar -xzf nard.tar.gz
nard
├─ apps           # Applications (incl Linux kernel)
├─ images         # The final output goes here
├─ Makefile
├─ platform       # Dir for each product and RPi model here
├─ Rules.mk       # Common make "library"
└─ util           # Toolchain (compiler)
There are only a few directorys to keep things simple. Hold on with delving into the tree – we will do it later on. Instead you should now start building a product example:
$ cd nard
$ make skeleton
$ ls -l images/   # Finished outputs

The first run require an hour or so to finish on a quad core machine. Typical pre-requisites includes gcc, bison, flex, makedepend, automake etc. i.e the "usual" tools for compiling software packages. They are available in all major Linux distributions (Ubuntu, Fedora, Suse) should you need to install them. Detailed help can be found in the Trouble Shooting section.

icon project

Product inheritance

Every product Nard can build has a recipe for what it's composed of. Product and board recipes stack on top of each other. The generic board recipes act as templates for the specifics. In the figure below everything originates from default. raspi_x_revx is an abbreviation for Raspberry Pi all models all revisions. It extends the previous recipe but may as well override it, should it need to. raspi_b_rev2 is short for model B revision 2. Products in the need of dual I2C channels may for instance use this recipe (revision 1 had only one channel). If you know object oriented programing you will have no problem grasping these dependencies.

inheritance figure

A recipe is a simple Makefile. It's self explanory so here is a small example:
# The HW we will run on
export BOARD ?= raspi_b_revx

# List of applications this product needs. Packages
# will be built in the listed order (unless you
# explicitly define the dependencies).
PKGS_APPS += linux-kernel/linux-rpi-3.10.y
PKGS_APPS += bftpd/bftpd-4.2

The variable PKGS_APPS defines what should be installed in the target. The example above adds Linux kernel 3.10.xx and a FTP server. Each layered recipe can add additional applications and in fact you will by default (from raspi_x_revx) also get a SSH server, BusyBox and some other tools one likely needs in an embedded system. All applications added to PKGS_APPS must reside in the apps directory.

icon sd card

SD-card install

Once the example product has finished building it's time to write your custom image to a SD-card. Any SD-card of at least 2 GB size will suffice (only 35 MB will become occupied). Warning, it will be fully erased in the process! Insert the card in your PC and run:
$ sudo -s                                   # Become root
$ zcat images/sdcard.img.gz >/dev/mmcblk0   # Your SD-card path
$ sync                                      # Flush

This image write is done only once. Next rebuild can be upgraded via the network.

icon power

Power-on

  1. Attach the Raspberry board to the same Ethernet network as your PC.
  2. Put the SD-card (from step above) in the Raspberry Pi card slot.
  3. Connect power to start the Pi up.
  4. The board LEDs will come to life as it boots up.
  5. When the green ACT led flashes on and off slowly it has finished booting. (About 20 seconds from power-on.)

screenshot thumb
Screenshot of first boot from fresh new SD-card.

icon shell

Logging in

Easily log in to your board with a pre-setup custom SSH command. From the build environment run:
$ make ssh

Your PC will then scan the local Ethernet subnet for targets running Nard and automatically login with a key it recently built. If multiple Nard boards are found you will get a list to choose from. Should it doesn't work you can log in with telnet as well. The default credentials is username=root and password=pass.

If your network setup is malfunctioning or you have a model A/0 Raspberry Pi you may login via a USB-to-Serial dongle as well:

  1. Connect the dongle to the Raspberry Pi USB host port.
  2. Connect a null modem cable between the dongle and your PC serial port.
  3. Open a terminal program on your PC, set it to 115,200 8N1 and press enter.
USB-to-Serial photo USB-to-USB photo
The FTDI USB to USB Null Modem cable
icon upload

Upgrades

When Nard has booted up it's ready for remote unattended upgrades. From your build environment in your PC, run this command:

$ make upgrade

It will scan the local network subnet for your board and upload your build with FTP firsthand and via SSH secondhand. A script in Nard will verify the uploaded files, replace the SD-card contents and reboot if everything was OK. When number of remote devices becomes large though you might need automation separated from Nard:

$ scp -i product_ssh_key sdcard.tar.gz <IP-addres>:/tmp
$ ssh -i product_ssh_key <IP-addres> /sbin/upgrade-os.sh

These PC command will achieve an upgrade as well but is cross platform, scriptable and independent of Nard installed. Thus deployment to large sets can be done using Windows as well. The SSH key is copied from intermediate/ and the tarball from images/.

icon settings

Device settings

Unique device settings (such as static IP-address) for each of your devices should be put in the directory /settings in the FAT partition of the SD-card. A field engineer can then easily configure each device during deployment with a standard Windows laptop. There are four small files that optionaly need adaptions. They are well commented inside but briefly described here too:

Modifications of the settings can be performed remotely as well. Login with a serial cable or SSH, edit them with vi /boot/settings/nodeid and issue a reboot.

icon tips

Tips

icon information

Further reading

What can one use Nard for?

Example productsicon next


Formalities

icon download

Download

Get your copy here

icon authors

Authors

icon support

Support

First check Trouble Shooting and then Questions and Answers. If you can't find what you need there then join the mailing list and ask for help there. Feedback and comments are welcome too! We would like to know how you find Nard. Do you like it? Have a wish-list etc? Commercial support can be arranged if necessary but is no arrogation.

icon license

License

Nard SDK is a Donationware variant. Business firms selling +100 Nard based units annually are expected to donate for the continued maintenance, security updates and development. An amount in the range of USD $200
PayPal USD:
Bitcoin BTC: 3AsK4t2e1XuEbuRHkjTnLZkLcSECBDuoW9
for each hundred unit sold would be appreciated. Bitcoin is accepted as an alternative. Copyright ©
2014 – 2019 Ronny Nilsson

icon disclaimer

Disclaimer

Nard is an unofficial SDK, not associated with the Raspberry Pi Foundation and Raspberry Pi is a trademark of the Raspberry Pi Foundation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Nard SDK comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.