If you’re in the market for a low cost embedded Linux development board then look no further than the Omnima embedded controller. £23 gets you a MIPS platform with Ethernet and USB host ports, 16MB of RAM and (via OpenWRT) a wide-ranging repository of pre-packaged Linux applications and libraries. Compared to the likes of the Arduino, this is a lot of bang for your buck.
Omnima deliver this board with their own Linux distribution derived from OpenWRT known as Squidge, but development on this has been discontinued in favour of vanilla OpenWRT. This post describes how to set up a development environment so that you can build and run bleeding edge vanilla OpenWRT on the Omnima board, rather than relying on the now out-of-date Squidge distribution. The Omnima board has a limited amount of flash (2MB) so you will use an additional USB memory stick for storing the root filesystem (rootfs).
You can use this guide if you are interested in kernel development or application development; OpenWRT provides an environment for working at both the kernel and the application/library level.
As a bonus there are also instructions below for including a Python interpreter. The Omnima provides a very cost-effective development embedded platform for Python development, however beware that 16MB of RAM is not a huge amount when you factor in the Linux operating system, Python interpreter etc.
Much of the OpenWRT build information came from this message on the OpenWRT forum by Heruan. We flesh that out here with further instructions for fully configuring the device and installing packages such as an SSH server and the Python interpreter. There is an Ubuntu slant as the PC used in this case was running Ubuntu but the same principles will generally apply across any distro.
Install Serial Comms Tools
You will initially talk to the board via its UART interface. Two popular terminals available in Ubuntu are minicom (command-line) or gtkterm (GUI), so install one of these together with lrzsz, which is used for sending your binary images to the board via xmodem:
sudo apt-get install minicom lrzsz
If using minicom you should configure the serial port device name which it will use. USB-to-serial converters will generally come up as /dev/ttyUSB0, but you can confirm this by connecting the cable between your PC and the Omnima, and running dmesg to view the new device name. With the device name known you can run minicom -s to change the default port name.
Download and Build OpenWRT
Next you will download OpenWRT “kamikaze” and build the Linux kernel and USB rootfs. The build process has a few prerequisites which can be installed on Ubuntu as follows:
sudo apt-get install quilt gawk flex zlib1g-dev libncurses-dev
Create a directory for storing the OpenWRT/kamikaze sources, and download the latest version from Subversion:
svn checkout svn://svn.openwrt.org/openwrt/trunk kamikaze
The feeds update script downloads the latest package tree which you can use to add many auxiliary applications and libraries to the base OpenWRT installation. We will make use of this later to install python-mini.
With the latest sources downloaded, you can now configure your kernel and rootfs build using the standard kamikaze tools make menuconfig and make kernel_menuconfig. Much of the instructions herein came from Heruan’s message. There you will find details on the configuration required. Be sure to remove as many packages as possible to reduce the size of the kernel image such that it will fit in flash (e.g. excluding dnsmasq, dropbear, iptables):
With the kamikaze configuration in place, build from the command-line using simply:
Your kernel image for programming in flash, and rootfs for copying onto the USB memory stick will be built in the bin directory.
First we will format the USB disk and install the root filesystem which Kamikaze built for us:
# mkfs.ext3 /dev/sdb1
# mount /dev/sdb1 /mnt
# cd /mnt
# tar -xzf /path/to/openwrt/bin/openwrt-adm5120-rootfs.tgz
# umount /mnt
It is convenient at this point to also tweak the rootfs on the USB disk, by copying on some additional application packages and configuring the network. With the USB disk mounted, copy all of the prebuilt base packages onto the USB disk ready for installation on the unit if desired:
# cp /path/to/openwrt/bin/packages/target-mipsel_uClibc-0.9.30.1 /mnt/opkg
You may also wish to change the network configuration to suit your requirements. For example to change the default IP address of 192.168.1.1 to 192.168.1.110 and set the appropriate gateway and DNS addresses, edit the USB disk file /mnt/etc/config/network and change the lan section:
config interface lan option ifname eth0 option type bridge option proto static option ipaddr 192.168.1.110 option netmask 255.255.255.0 option gateway 192.168.1.1 option dns 192.168.1.1
You now have a USB disk containing a rootfs which is configured and ready to connect to your network at bootup, and which contains a selection of packages which you can install from the serial terminal (including an SSH server). You should unmount the USB disk now and insert it into one of the device’s USB ports.
Download Kernel into Flash
You are now ready to download the kernel image into flash. This can be done using the
xmodem-upload script from Heruan’s article. You should download this and make it executable using chmod +x xmodem-upload.
Power down the Omnima device and insert the USB disk. Check that your serial cable is connected to the device, and verify the serial port’s Linux device name (if you are using a USB-to-serial converter, plug the USB cable in and view the results of dmesg to find the device name). It will usually be /dev/ttyUSB0. If it is USB1 or higher on your machine, you will need to edit the xmodem-upload script to use the correct device name.
Now start the script from the bin directory:
On startup the script waits for the Omnima to power up. Turn the device on now and you should see the xmodem upload start and progress for some time. If the script complains of a missing sx command, you will need to install the lrzsz package which contains the xmodem upload tool. The upload script quits as soon as the file has been uploaded and does not wait for the flash programming phase to complete. It is therefore vital that you do not power down the device just yet. When the script exits, fire up your serial terminal and view the results:
You should see the flash erase and flash programming phases complete. Once these are done, you are ready to reboot your board and run your new OpenWRT build. You can view debug output from the entire boot process on your serial terminal. Assuming the build was successful, on booting up you will be prompted to press Enter and will see a command shell. Your unit is now booted into Linux and ready for installation of your own applications.
Note that if there are problems finding the USB disk, you may see the following:
Waiting 10sec before mounting root device...
VFS: Cannot open root device "sda1" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00 32 mtdblock0 (driver?)
1f01 32 mtdblock1 (driver?)
1f02 1984 mtdblock2 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
If this happens then check your USB disk is inserted correctly and confirm that the USB driver was correctly built into the kernel in kernel_menuconfig (ADM5120 HCD support under the USB section – this must have a ‘*’ and not an ‘M’ or blank).
If everything goes to plan, you should be met with the following at bootup:
_______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M KAMIKAZE (bleeding edge, r17053) ------------------- * 10 oz Vodka Shake well with ice and strain * 10 oz Triple sec mixture into 10 shot glasses. * 10 oz lime juice Salute! ---------------------------------------------------
With an Ethernet cable inserted into the WAN port you should now be able to communicate with the board, which can be tested using ping or similar. If there are any problems with the network, double-check your /etc/config/network file. This can be done from the serial terminal (which you can edit it “online” using vi).
Install SSH Server
The OpenWRT base system includes the Dropbear SSH client/server. We omitted this from the flash image earlier to save flash-space but you can add it now via an installation into the USB rootfs. You previously copied a selection of packages onto the USB disk, and you can now install the Dropbear package from that location:
opkg install /opkg/dropbear_0.52-2_mipsel.ipk
Before allowing clients to log in using SSH you must set root’s password using the standard passwd command.
You can now start the Dropbear server as follows:
Be patient while this loads. Eventually you will be able to SSH into the unit from elsewhere using the password you set above.
Finally, if you want the SSH server to start at boot time (so that you can dispense with the clunky serial connection), you simply create a link to the dropbear init script in the /etc/rc.d folder:
ln -s ../init.d/dropbear S50dropbear
You will now find that the SSH server starts every time you boot the Omnima.
With all of this in place, you have a remarkably full-featured Linux system at your disposal. You can install applications from the internet, write and install your own applications, modify the kernel etc.
Install OpenWRT Packages (Python)
Now that you have the OpenWRT base installation complete you can start extending the Omnima with additional software packages. OpenWRT makes this easy via the opkg system which you saw earlier when installing the Dropbear .ipk package. A wide library of packages is available in the feeds folder on your development PC which you can keep up to date using the feeds script:
A python-mini package is available here, and can be enabled using:
./scripts/feeds install python-mini
Having enabled python-mini on the development PC you will find it available in menuconfig. To build the package run make menuconfig and select the Python interpreter to be built as a module using the ‘M’ key. Exit menuconfig and run make. You will now find the python-mini .ipk package in the bin/packages folder. Rather than go through the trouble of mounting the USB disk and copying the package across, you can copy this straight to the unit via SSH thanks to the Dropbear server you now have running on there:
scp bin/packages/target-mipsel_uClibc-0.9.30.1/python-mini_2.6.1-2_mipsel.ipk email@example.com:/opkg
Note, however, that Python depends on a few other packages, which will also be present in the bin folder so you should copy them across too, namely zlib, librt and libpthread. Copy these across using scp and you are ready to install. SSH into the unit and install all four packages:
opkg install zlib librt libpthread python-mini
You can now execute the python command and you will be presented with the Python interpreter.
Finally there is also an online repository of prebuilt OpenWRT packages which can be downloaded and installed directly on the device. In order to use this you must first correctly set up DNS in order to resolve the package server domain name. This should be already done if you set the DNS server address earlier in /etc/config/network. With that in place, simply run:
You can now download and install prebuilt OpenWRT packages from the internet.