Alert.png

Notice: This page contains information for the legacy Phidget21 Library.

Phidget21 is out of support. Bugfixes may be considered on a case by case basis.

Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21.

We recommend that new projects be developed against the Phidget22 Library.


Click on the 2phidget22.jpg button in the menu bar to go to the Phidget22 version of this page.

Alert.png

OS - Phidget SBC

From Phidgets Legacy Support

Icon-Linux.pngOn the Single Board Computer (SBC), Phidgets can be either plugged directly into one of the USB ports or run over a network using the Webservice.


Getting Started (Libraries and Drivers)

The SBC is a unique Phidget. It is a computer with a Linux operating system. It can compile code, save files, manage background jobs, host information over the web, and more.

To learn the basics about the SBC, we have a handy web interface to interact with the SBC. This is covered in detail on the Getting Started Guide for the SBC. So before reading this page on how to use the operating system, you should have done the following via the Getting Started Guide:

  • Set up networking on your SBC, via either Ethernet or wireless
  • Set up a password
  • Learned the IP address or link local address of the SBC

Conceivably, you could simply use the SBC like any Linux computer, and do all of your development and compiling of Phidget code on the SBC itself. In practice this is quite complicated as the SBC does not have a keyboard or screen. So usually, you will want to develop your code on an external computer and copy files and settings over to the SBC via a network. This makes this Getting Started section unique, in that we show you how to set up both computers:

  • Your External Development Computer, usually your main desktop or laptop which will transfer files and settings to and from the SBC
  • The SBC itself, which needs programming language libraries to use Phidgets.

Getting Started - External Computer

You have two ways to connect to the SBC from an external computer: via the SBC Web Interface and over the more powerful but complex Secure Shell (SSH).

SBC Web Interface

You have already worked extensively with the web interface in the Getting Started Guide for the SBC. This was the tool within a web browser which was opened either via the Phidget control panel on Windows, or by simply entering the IP or link local address into the browser. It allowed you to set the password, set up internet connectivity, and so on.

We talk about the additional functionality of the web interface elsewhere in this document. This web interface will probably stay your initial go-to way to connect to the SBC, especially for tasks that benefit from graphical interaction, like setting up wireless or using the webcam.

SSH

The most flexible way to transfer files and commands to and from the SBC is via a program called ssh. The ssh program provides command line text access over a network into the SBC. Using it, you can run programs and give the SBC commands. The ssh program has a companion program called scp which can copy files back and forth. For Linux users, this will be familiar territory. If you are using Windows or Mac OS, and are unfamiliar with ssh, you can think of it like the command line or a Mac terminal.

Before connecting over ssh, you will need:

  • The IP address (such as 168.254.3.0) or link local address (such as phidgetsbc.local) of the SBC
  • The admin password for the SBC

Both of these items can be found by following the steps in the Getting Started Guide for the SBC.

You will also need to enable SSH on the SBC side. This can be done through the Web Interface, under Network → Settings, by changing the SSH Server radio button to Enabled:

SSH on Windows

The ssh program is not installed on Windows by default. But, there are a variety of SSH programs available for free, one simple and commonly used program being PuTTY.

With PuTTY, when you first run the program it will ask you what to connect to. Enter the IP address or link local address of the SBC, and then click the SSH radio button right below the address, which will change the port to 22. Then click open, and you'll have an ssh connection to the SBC open in a terminal. It will prompt you for a user name (root) and password (the admin password).

To copy files back and forth, there is an SCP component to PuTTY, called PSCP, which is available from the same PuTTY download page.

SSH on Linux and Mac OS

Linux and Mac OS already have ssh installed by default. To run ssh simply open a terminal...

  • Ctrl-Alt-T on Linux
  • Applications → Utilities → Terminal on Mac OS

...and type:

ssh root@phidgetsbc.local

If you have re-named your SBC, include that name instead of the phidgetsbc.local link address. Or, you can use the SBC's IP address, e.g. ssh root@168.254.3.0.

To copy files back and forth, the command follows the form of: scp from to

So, to copy a file /root/data.txt from the SBC to your local machine, type:

scp root@phidgetsbc.local:/root/data.txt .

Note the use of the dot . to indicate that scp should put the file in the current local directory. If you're not sure what folder the terminal is operating in type pwd to print the working directory. Terminals usually start by default in your home folder.

Getting Started - The SBC (Debian Linux)

The SBC comes with the following Phidget functionality installed:

  • The Phidget C libraries libphidget21.so
  • The Phidget Webservice

These packages can be seen via the SBC web interface

Installing C/C++ and Java

The simplest way to install C/C++ and Java on the SBC is via the web interface. There is a button under System → Packages to install C support (including gcc) and another button to install Java support. Clicking the Java button will also install C support, as Java depends on the C libraries:

Installing Python

Installing Python has two steps. First, you'll need to install the basic ability to run python, and then you'll need to install the Phidget Python module.

Basic Python
apt-get install python


Install Phidget Python Method 1: Use a USB Key

Copy the Python Libraries onto a USB key. Unpack the zip file into a folder on the USB key. Insert the key into the SBC.

You will have to figure out where the USB key (and the Phidget Python library folder) is now located. We describe how in the general Using USB Data Keys section.

After you know the place where the USB key is mounted, go to that directory (e.g. cd /media/usb0/, enter the unpacked Phidget Python Library folder, and run:

 python setup.py install

Now, you're ready to begin writing Python code for the SBC. For more help on writing and using Python with Phidgets, we have an whole page on that topic.

Install Phidget Python Method 2: Use the Internet

Rather than using a USB key to transfer the file, the SBC can download it directly from the internet. You will need wget and unzip installed, both of which are small:

apt-get install wget
apt-get install unzip

Copy the web link address for the | Python Libraries.

In an SSH terminal to the SBC, type: wget http://www.python_library_link where instead of http://www.python_library_link you insert the link you just copied.

This will download the Phidget python libraries to the folder you ran the wget command in. Unzip the file using the command unzip.

Installing Other Languages

You may also be able to program on the SBC using Ruby and C# under Mono, though we do not offer in-depth support for these languages on the SBC. The installation procedures should more or less follow that of installing python on the SBC, except you will be installing Ruby or Mono. Performing package searches using apt cache search can help you find the relevant software.

Using SBC Linux

Now that you've set up communication with the SBC, and installed whichever programming language support you need, you're probably ready for a short tour of useful tools on the SBC's version of Linux.

First, you will by default be running on the SBC as root, which is the super-user. For experienced Linux users, this probably makes you nervous because you know you can overwrite important system files without the system asking for additional permission. Even as a Windows or Mac OS user - although you may usually run your computer as an administrator - the system usually prompts you to confirm before you do anything really dangerous, and this will not happen on the SBC as the root user.

Next, there is no installed help on the SBC. Help on Linux is usually called 'man pages' which is short for 'the manual pages'. On a full Linux system, usually if you need help with any command you can type, for example, man ls and it will give you help with the program ls. But these help pages take up significant space, and they are widely available online. So, if you need more help with a certain command, you can always type man command into your favourite search engine.

Finally, the SBC has no windowing system. For experienced Linux users, this means no X-windows (Gnome, KDE, etc). And as a Windows or Mac user, although you may not think of the graphical window interface as simply a front-end to the actual operating system, indeed it is. The SBC provides all of the functionality of an operating system (e.g. process scheduling, file management, etc) but without any graphical interface. The only exception is the web interface, which gives graphical access to a limited part of what the SBC can do.

Some Useful Commands

If you are doing more with the SBC than simply running pre-written programs in Java to run continuously from boot, you will be interacting with the SBC's Linux operating system over the command line by using SSH. This section discusses useful programs already installed on the SBC, and how to run them on the command line.

ls

The ls program lists the contents of a directory.

It will show both files and folders, but not files that start with a "." (these are hidden files on Linux).

  • If you also want to show hidden files, use ls -a
  • If you want more information, such as size and date modified, use ls -l
  • Commands can be combined, like ls -al

cd

The cd program changes to a new directory.

For example, cd /root changes into the directory at the base of the file tree called root.

Note:

  • Linux uses forward slashes
  • The base of all directories is "/" (not "C:\")
  • The tilde symbol (~) is short for your home directory (i.e. when you are root, this is short for "/root")
  • The double dot ".." means move one directory higher (for example from /root/data/ to /root/)

pwd

The pwd program prints the current directory you are working in. ('P'rint 'W'orking 'D'irectory)

For example:

root@phidgetsbc:~# pwd
/root

find

The find program does what it says - it finds things.

Unfortunately for the casual user, the find program is very flexible and powerful, and thus not especially intuitive to use. But, here are some examples:

SSH Command What it Does Example
find folder -name file.txt Looks for all files in a folder (/ for root - or all - folders) with a certain name (* for wildcard) find / -name *.jpg
find folder -mtime +X Looks for all files in a folder modified less than X days ago find /root -mtime +30

grep

The grep program takes text input and searches for a term.

For example, if you type mount to view what devices are mounted (e.g. loaded) on your SBC, you will see:

root@phidgetsbc:~# mount
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
rootfs on / type rootfs (rw)
procbususb on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,nodiratime)

This may be a lot of information you don't need. If you are only interested in a USB key attachment (as described in the Using USB Data Keys section), you can use grep to filter that one response:

root@phidgetsbc:~# mount | grep sda1
/dev/sda1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,nodiratime)

nano

The nano program is a small text editor that you can use within an SSH terminal.

Nano can be surprisingly useful for writing short lengths of code right on the SBC, so there is no need to transfer files and keep track of different file versions on different computers.

Nano has all keyboard commands which are listed at the bottom of the screen at all times as a reminder (Ctrl-O to save, Ctrl-X to exit, these expand with a larger terminal window). And, nano provides what is called 'syntax highlighting', which colours reserved keywords, comments, strings, and so on as appropriate to the programming language you are using. Nano detects the programming language via the extension of the file (.java for Java, .c for C/C++, and .py for Python).

Typing nano test.py on an SSH command line and then entering a few lines of Python into the new empty file results in:

apt

The apt program allows you to install, uninstall, upgrade, and search software available for the SBC. For a non-Linux user, the apt framework may be daunting at first, but it actually allows you to keep your system up to date

SSH Command What it Does Example
apt-cache search term Looks for all programs (packages) that have term in the title or description apt-cache search opencv
apt-cache show package Shows a lot of data about package including size, version, etc apt-cache show unzip
apt-get update Gets the most recent listing of available software apt-get update (No options)
apt-get install program Installs program from the internet apt-get install python

which

The program which tells you if and where a program is installed.

For example, on a default SBC, typing which python will return no results. But after successfully installing python, it will return /usr/bin/python as the location of the python program/binary/executable.

Some Useful Commands to Install

These are other programs you may find useful on the command line. Although they are not on the SBC by default, these and other programs can usually be installed simply by using apt-get install, with the exception of gcc. For example, apt-get install wget will download and install wget.

Note: This section and the section on pre-installed commands can hardly cover all of the complexities and benefits of the Linux operating system. There are many excellent tutorials online, and between them and using apt to find and install programs you should be able to learn a lot and perform any number of complex useful tasks.

gcc

The gcc program is the C compiler for Linux.

If you are an experienced C/C++ user on Mac or Linux, or if you've already read our C Language page, you might think you need to install gcc via apt-get to compile C code. However, gcc is not in the package repository for the SBC, so apt-get install gcc will fail. Rather, to install gcc, you can do it via the web interface, as described in the Installing C/C++ and Java section.

After installing it via the SBC web interface, you can use gcc normally.

less

The less program displays the contents of a text or source code file. When displaying the file, less allows you to scroll up and down to read it.

This is useful if you are writing your sensor readings to a data file, and you want to read the data file while it is being written by your main code. If your data file is called data.txt, you can type less data.txt and see the lines in the file, and what they are.

The less program output can also be piped into another program. For example, you can use less and the word search program grep to find lines within a file with a search term. For instance, if you have a C source code file Program.c on the SBC, and you want to see all the lines in Program.c that contain a variable name var, you can type:

less Program.c | grep var

wget

The wget program allows you to get an online file (over http) and download it to the SBC.

For example, to get the source file (HTML) from the Phidgets home page, you can type:

wget http://www.phidgets.com

This is most useful for downloading libraries, drivers, or anything (zip, tar, etc) you need from the web which is not available by using apt.

Writing a Phidget Program

We provide two ways to write and upload a Phidget Program:

  1. The web interface, which is useful for:
    • This is useful for simple projects written in Java that you want to start only at boot
    • You can also use C projects, but they must be compiled off the SBC for an ARM processor
  2. Over SSH, which will allow you to write or transfer source code directly to and from the SBC
    • This is useful for all other projects, such as:
      • Projects that run at scheduled times (e.g. once per minute)
      • Projects that use other languages

Note that you can still run an SSH project at boot, you just have to write and install a startup script. This is a bit complex, but we do have an example that starts the program phidgetwebservice21 at boot using a script.

Once you know which method you'd like to use, you can continue on to learn how to Program in Java with the Web Interface, or how to Program with SSH using C or Python.

Program in Java with the Web Interface

To show how to write, compile, and install Java programs on the SBC, we'll use the Java Hello World example code. You can download the HelloWorld example by downloading the whole Java example package.

Here's how to get the HelloWorld code running on the SBC:

1. Download the SBC version of the Phidget Java libraries (phidget21.jar). You can download this from the web interface, on the page under Projects → Projects, under the Notes section.

2. Place the SBC version of phidget21.jar into a directory on your external computer. This will be your working directory that you will use to compile the Java files.

3. Also copy the HelloWorld.java file into that working directory.

4. Compile the HelloWorld.java file from within that working directory. From the command line prompt on Windows, this will be:

javac -classpath .;phidget21.jar HelloWorld.java

In a terminal on Linux or Mac OS, this will be:

javac -classpath .:phidget21.jar HelloWorld.java

5. You should now have three compiled class files: HelloWorld.class, HelloWorld$1.class, and HelloWorld$2.class. You don't need to try and run them, and if you do you may encounter an error because the SBC phidget21.jar may be slightly different than the Phidget support you have installed on your external computer.

6. Create a new project on the SBC, in the web interface under Projects → Projects. Call it HelloWorld:

Program with SSH

Editing Notes

In the Linux command line, the command Ctrl-C means stop the currently running program, not copy. Within most SSH terminals, you can copy and paste using the right-mouse button, and on some terminals (and all native Linux terminals) you can copy by simply highlighting text, and you can paste it using the middle (scroll) mouse button.

Also Ctrl-Z does not mean undo, rather it is a reserved command to run the current program in the background. This is useful because usually running a program simply hangs your SSH input until the program is done, so typing Ctrl-Z while the program is running frees up the command line for more input. If you accidentally hit Ctrl-Z while running an editor like nano, the editor will immediately exit to the command line, but it will not stop or lose your work. You can bring it back up by using the fg (e.g. 'foreground') command, like fg nano, and this will automatically bring your nano process back to the front.

Running a Program Automatically

Via the Web Interface

Via Cron

Using USB Data Keys

After plugging the USB key in, it won't just appear on your desktop, so to speak, so you'll need to figure out where you can read and write to it within the SSH directory structure.

The web access program can help with this. After you plug a USB key in, it will show up under Status → System. Or, the USB key and all other attached devices can be seen at Status → USB:

In the screenshot above, you can see that the USB key is located in /media/usb0.

Alternately, you can use the SSH command mount, and the searching program grep which will filter the response of mount and only return the lines with your search term (usb):

root@phidgetsbc:~# mount | grep usb
/dev/sda1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,nodiratime)

In this case, the USB key can be written to and read from using the /media/usb0 directory. Copying a file to /media/usb0 will copy a file to the USB key. The same goes for removing, renaming, opening files within your program, etc.

Note: Mount points like /media/usb0 should not be hard-coded into any of your programs. (See the Common Problems and Solutions section for more information.) If you need to obtain the mount point for a freshly mounted USB key within your code, have your code obtain the mount tables and search on the device (e.g. /dev/sda1 or /dev/sdb1) and obtain the corresponding mounted /media/usbN location, where N is a number 0-9.

Saving and Retrieving Data

Over the Web (an SBC Webserver)

Troubleshooting

If the examples do not work but USB does work (i.e. your computer can consistently see the device in the hardware), take a moment to check the basics:

  • No other programs, drivers, or processes are using that USB port in software
  • You are running the example program as root (or your udev rules have been set properly)
  • You are using libusb 0.1 (not 1.0 or later)
  • You have compiled versions of libphidget21.a and libphidget21.so in your system library location (usually /usr/lib)
  • The Phidget libraries are the latest version (visit the getting started section to download them)
  • Your Linux kernel version is 2.6 or later (type uname -r in a terminal to get your kernel version)
  • Check the common problems section below, some specific combinations can cause problems

If your problem doesn't seem to be fixed by these steps, make sure that the Phidget is seen consistently by USB (if it is erratic, try our general troubleshooting guide). If you are still having problems after the troubleshooting guide, please ask us!


Initial Internet Setup

To set up the SBC, you need a wired Ethernet connection with DHCP, and without a firewall. Even if you do not have this type of a connection at home, these types of connections are very common at both offices and universities.

Sometimes it can work to plug the SBC, using Ethernet, directly into an Ethernet port on your home router. This is a very picky process, however, and can fail because:

  • Some home and office routers place a firewall between wireless connections (clients) and wired connections (the local area network)
  • Some home and office routers do not by default allow both Ethernet DHCP and wireless DHCP.
  • Some routers and DHCP hubs only provide access to an internet connection, and do not provide local area network inter-connections (this is common on mobile device tethering hubs)

Routers are quite complex, and even with admin privileges it can be a painstaking process to find all the right firewall settings to turn off in order to allow two computers on the network to talk to one another, rather than just connect to the internet. This is why university or office networks are often ideal for the purpose of setting up the SBC, because these institutions depend on computers on a local network being able to talk together. Covering all of the different router configuration possibilities, and how to change them to make the SBC work, is essentially impossible.

The good news is that if you can find an Ethernet DHCP connection a single time, you can use that connection to set up as many wireless DHCP connections (with passwords) that you need on the SBC. Once wireless is enabled, and allowed wireless network names are set up with passwords if needed, the SBC will automatically seek out and connect to the networks on the list as they appear. It is rare for home or office routers to put a firewall between wired and wireless connections, and so connecting over wireless only will allow your external control computer and the SBC to connect easily. At that point, you can also use wireless to modify all settings, including wireless and other Internet settings.

If you have a wired DHCP connection, no firewall, and no link local addressing (e.g. bonjour or avahi is not installed) then you will need access to the router logs.

Recovery / Upgrade System

The recovery / upgrade system is a small system from which the main system can be reset/upgraded, or recovered.

Entering the Recovery System

The recovery system can be entered in two ways.

  1. From the 'System: Backup & Restore' web interface page.
  2. By holding down the reset button for 20+ seconds - until the green light has switched from flashing slowly to flashing quickly.

Upgrades

Generally, you should not need to do a full system upgrade. Upgrades are meant to be performed via the package system, and Phidgets maintains it’s own package repository from which to push out updates. Occasionally, you may wish to go back to a clean install and upgrade to the latest rootfs/kernel from Phidgets. Phidgets will not be creating these images with every release of phidget21 as we did with PhidgetSBC1, rather they will be released several times a year, as needed for major changes not easy to push out via packages. You can also flash your own custom kernel or root filesystem image.

Factory Reset

This restores the kernel and root filesystem from backup, overwriting any changes that may have been made. This is equivalent to holding down the reset button for 10 seconds.

Recovery

If the main filesystem has been damaged/misconfigured in such a way that it won’t boot, you may be able to fix the issue / recovery important files before running a reset. The recovery system runs an SSH server that you can login to for console access. Username/password is: root/root. You can mount the main root filesystem with the following commands (assuming it’s not damaged):

  1. ubiattach /dev/ubi_ctrl -m 6
  2. mount -t ubifs /dev/ubi0_0 /mnt

Programming Languages

Now that you have the basic libraries installed, you can pick your language and begin programming!

If you are not using the webservice (discussed below) to control a Phidget over a network, your next step will be to delve into the use of your specific language. Each page has its own set of specific libraries, code examples, and setup instructions.

On Linux, we recommend the following languages:

Also check the following languages:

  • Ruby
  • C Sharp over Mono

Webservice

Advanced Uses

Using a Different Wireless Adapter

Using a Different Webcam

Taking Pictures With the Webcam

Probably the most straightforward way to use a webcam for pictures rather than video is to use the opencv library. You can get it by:

apt-get install opencv

The opencv libraries can also be used within Python, by installing the link between them:

apt-get install python-opencv

Then taking pictures from within code becomes quite simple. For example, in Python, taking and saving an image is four lines:

#! /usr/bin/python

import cv

# The webcam is located at /dev/video0 
# OpenCV only needs the number after video
webcam = cv.CaptureFromCAM(0)

frame = cv.QueryFrame(webcam)

cv.SaveImage("image.jpg", frame)

For the complete OpenCV documentation, see The OpenCV Reference, and specifically the section on Reading and Writing Images.

Checking System Logs

Custom Kernel and Filesystem

You can compile your own Kernel and flash it to the board. Phidgets Inc. provides our kernel patches on phidgets. com. It is left up to the user to configure an appropriate cross-compiler for kernel development. You may also be able to compile a new kernel on-board.

Installing a new kernel involves erasing the old kernel, flashing the new kernel, installing the new kernel modules, and rebooting:

  1. 'make uImage; make modules' in the kernel directory
  2. 'flash-eraseall /dev/mtd3'
  3. 'nandwrite -p /dev/mtd3 arch/arm/boot/uImage'
  4. 'make modules-install'
  5. 'reboot'

Custom kernels can also be flashed from the Recovery/Upgrade system.

Custom filesystem can be flashed from the Recovery/Upgrade system. The creation of custom filesystems is not documented, as the Debian package repository should provide enough flexibility for most users. However, if you need to create a root filesystem image, use the following settings:

Filesystem type is: UBIFS

Commands to create it:

  1. 'mkfs.ubifs -m 2KiB -e 126KiB -c 4050 -r $ROOTFS/ system_ubifs.img'
  2. 'ubinize -o system_ubi.img -m 2KiB -p 128KiB -s 512 ubinize.cfg'
Where ‘ubinize.cfg contains:
# Section header
[rootfs]		
# Volume mode (other option is static)
mode=ubi		
# Source image
image=system_ubifs.img	
# Volume ID in UBI image
vol_id=0		
# Volume size
vol_size=64128KiB
# Allow for dynamic resize
vol_type=dynamic	
# Volume name
vol_name=rootfs		
# Autoresize volume at first mount
vol_flags=autoresize
You then flash ‘system_ubi.img’ (not ‘system_ubifs.img’) from the recovery system.

Software Details

For even more advanced uses of the SBC, it may help to know the gritty details of the SBC software system.

Operating System
Debian/GNU Linux
Kernel 2.6.X or higher (generally kept up to date with latest releases, use uname -r to check the kernel version)
Main Filesystem (rootfs)
UBIFS (a raw flash type of file system)
Mounted in a 460 MB Nand partition (in Read/Write mode)
Kernel
uImage format
Has its own 3MiB partition on bare Nand
Web Interface Scripts and Configuration Data
Located in /etc/webif
Modifying these scripts can be done; however, it is very easy to enter invalid data that could cause the system to behave unexpectedly or not boot.
User Applications uploaded through Web Interface
Located in /usr/userapps
Webcam Device Location
/dev/video0
Date and Time
Set using ntp (network time protocol) at boot.
The ntp daemon continues to run in the background and will periodically update the clock
The network keeps the SBC very close to real time.
Also there is a real-time clock with battery backup which will preserve date/time across reboots, power removal. :The real-time clock is synced to system time during reboot/shutdown.
If power is unplugged suddenly, and the network not restored, the real-time clock may not have the correct time.
Wireless Networking System
Wireless adapter support for the wireless adapter that Phidgets sells is written into the kernel
It supports WEP and WPA
It is best configured through the configuration interface.
Nand Layout
The board contains 64MB on Nand. This nand is split into 7 partitions as follows:
0: u-boot size: 256K Read Only
1: u-boot_env size: 128K Read Only
2: recovery_kernel size: 2M Read Only
3: kernel size: 3M Writable
4: flashfs size: ~3.625M Read Only
5: recovery_fs size: ~ 43M Read Only
6: rootfs size: ~ 460M Writable
The final size of flashfs/recovery_fs/rootfs depends on the image size at production, and on the number/location of bad blocks in the NAND.
Note: U-Boot and recovery kernel and filesystem cannot be written from Linux - this is a safety measure.
Boot Process
From power on...
1. Processor loads first 4 bytes from NAND into Steppingstone and runs it.
2. Steppingstone sets up RAM, copies u-boot from NAND into RAM and runs U-Boot.
3. U-Boot initializes the processor, sets GPIO state, etc., copies the linux kernel into RAM, sets up the kernel command line arguments, checks that the kernel image is valid, and boots it.
4. Linux boots, bringing up USB, Networking, NAND, etc. and then mounts the rootfs NAND partition on /.
5. init gets run as the parents of all processes, as uses the /etc/inittab script to bring up the system. This includes mounting other filesystems, settings the hostname, and running the scripts in /etc/init.d, among other things.
6. inittab then turns the green LED on.
7. inittab then sets up a getty on the first serial port, ready for interfacing using the debug board.

Common Problems and Solutions

USB Memory Key mounting: Sometimes USB Memory Keys mount at more than one location

When you insert a memory key, the SBC will load it as a device (e.g. /dev/sda1) and it will also mount the key for reading and writing within the /media/ directory. The /media/ directory version will be called something like usb0. At times, an inserted memory key will get mounted in more than one location. You can observe if this occurs by checking the currently mounted devices with the command mount:

root@phidgetsbc:~# mount
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
rootfs on / type rootfs (rw)
procbususb on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,nodiratime)
/dev/sda1 on /media/usb1 type vfat (rw,noexec,nodev,sync,noatime,nodiratime)

You will note that the same device (/dev/sda1) is now mounted at both /media/usb0 and /media/usb1. To fix this problem as it occurs, you can use umount (notice there is no letter 'n') to unmount the second instance:

root@phidgetsbc:~# umount /media/usb1

In practice, this should not be a problem, because writing to or reading from either usb0 or usb1 will have the same effect on the memory key. However, if you hard-code a media location into your program (i.e. expecting /media/usb0 to be the first USB key you insert and /media/usb1 to be the second key) your program will sometimes work and sometimes fail.

To get around this within code, find the mount point for each device as it appears. The devices, such as /dev/sda1 will always refer to the actual memory key. But, they cannot be written to directly without being mounted, so you will have to parse the mount table (what is returned from mount) within your code to find the device and its corresponding mount point.

This is a problem with the standard embedded Debian automount program, and we have no known fix.