compute module photo

Nard SDK

Not Another Raspberry Distribution

Introduction

Nard GNU/Linux is a software development kit (SDK) written from scratch for the Raspberry Pi family of boards. Unlike "ordinary" Linux distributions Nard is intended entirely for the development of MOTS embedded systems running day and night for years, 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 a 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:


Quick Start Guide

raspberry pi photo

Easy building

For the impatient here is a pre-built image for the Pi model B. 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      # Each product and RPi model has unique values 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 half 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.

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 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

my_product: all

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.

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 30 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 here
$ sync                                      # Flush before removing it

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

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 30 seconds from power-on.)

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

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 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

Upgrades

When Nard has booted up it's ready for remote unattended upgrades. From your buildenvironment 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 by SCP secondhand. A script in Nard will check the uploaded files, replace the SD-card contents and reboot if everything was OK.

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 three small files that optionaly need adaptions. They are well commented 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.

Tips

Advance use

If you have made it this far you qualify for next course; go ahead to the tutorial!


Formalities

Legal symbol

Download

Get your copy here

Authors

Support

Use the mailing list firsthand if you need help. If that doesn't work, send a mail to the authors and we will try to help you out. 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.

License

Nard GNU/Linux is a Donationware variant. Business firms selling more than 100 Nard based units yearly are expected to donate for the continued maintenance, security updates and development. An amount in the range of USD $200 for each hundred unit sold would be appreciated. However - there are no obligations.
Copyright © 2014 Ronny Nilsson

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.


Tux