Linux on the Intel Mote2 Sensor Nodes

Get distribution containing blob (boot loader), zimage and filesystem image

A complete installation for Intel Mote2 with 32 MB root file system, working USBnet and SSH daemon is provided here . The flash images consists of bootloader, kernel and 32MB file system with blackdown-1.3.1. It is based on the current 0.5 SG2 release from platformX

Get the xflash utility

Currently, you have to download the whole evaluation license of the Intel C++ Software Development Tool Suite . And this tool is for Windows only. There have been some discussions about alternatives in the intel-mote2-community .

Prepare flash programming (with JTAG interface)

Instructions on how to use other ways than the JTAG interface can be found here

add the following:

[INTELMOTE2]
standardflash=GP_J3_K3_K18_8
monaddr=0x01000000
scanchain=PXA27X
algoaddr=0x5c000000
baseaddr=0x00000000
to boards.ini in your xflash directory.
  • set the parallel port to ECP mode and base address 0x378
  • connect mote to debug board and debug board to JTAG parallel port adapter cable
  • power JTAG board and mote (e.g. by connecting USB to JTAG board)
  • Program mote with blob, zimage and filesystem image (from the downloaded zip archive)
  • xflash -p intelmote2 -tt "INTEL(R) JTAG Cable" blob     -offset 0x00000000
    xflash -p intelmote2 -tt "INTEL(R) JTAG Cable" zImage   -offset 0x00040000
    xflash -p intelmote2 -tt "INTEL(R) JTAG Cable" fs.jffs2 -offset 0x00240000
    

First boot

  • connect to serial debug console:
    • connect the USB interface of the debug board (not the mote!) to a computer. It appears as two USB serial ports. Drivers are available here . Note that Linux kernels 2.6 already include the necessary driver.
    • run a terminal emulator on the second serial port (e.g. /dev/ttyUSB1, if no other USB to serial adapters are connected) with port settings: 115200 8N1 no hardware and no software handshake.
  • hard-reset the mote by unattaching the power supply. Otherwise the mote won't boot.
  • watch linux boot on mote :-)
  • logon as root (empty password)
  • set root password
  • passwd
    
  • reboot

The result ...

INIT: version 2.86 booting

 *           *          *       *     *         *                 ***
 *           *          *       **   **         *                *   *
 *        *******       *       * * * *      *******                 *
 *  * ***    *    ***   *       *  *  *   ***   *   ***            *
 *  *    *   *   *****  *       *     *  *   *  *  *****          *
 *  *    *   *   *      *       *     *  *   *  *  *             *
 *  *    *   *    ****  *       *     *   ***   *   ****         *****





Please wait: booting...

depmod: QM_MODULES: Function not implemented

pxa27x_udc: version 23-Sep-2004
Using local version of is_stargate2!  Needs to be fixed/removed!
usb0: Ethernet Gadget, version: May Day 2005
usb0: using pxa27x_udc, OUT Bulk-out-2 IN Bulk-in-1
usb0: MAC e6:64:f3:58:b8:bb
udc: USB reset
udc: USB reset
udc: USB reset
usb0: full speed config #1: 100 mA, Ethernet Gadget, using CDC Ethernet Subset
INIT: Entering runlevel: 2
Starting OpenBSD Secure Shell server: sshd
done.

SG2-3 login: 

Networking via USB

The distribution for the mote already has an active USB network driver which is compatible with the RNDIS/USB CDC protocol. This allows to connect the mote to a computer and run e.g. TCP/IP over the USB link.

Linux

The kernel modules cdc_subset and usbnet provided by recent kernels implement a suitable counterpart for the mote (that has the g_ether module). When connected to the mote, a new interface usb0 should appear. The mote's static IP configuration is

IP address: 192.168.99.101
Netmask:    255.255.255.0
Default GW: 192.168.99.100
so usb0 on the Linux desktop is preferably configured with IP address 192.168.99.100. You should enable some kind of IP forwarding on your Linux desktop and add a proper /etc/resolv.conf on the mote to successfully complete the next steps.

Windows

Though an RNDIS driver is included in Windows XP, we could not get the USB network running. The problem is either related to creating the appropriate Windows INF file or to the driver itself. Currently, this is not investigated further.

Bootstrapping ipkg

ipkg is the package tool known from the familiar distribution for iPAQ and friends. Since the linux of the platformX distro is derrived from familiar 0.8.2, one might want to have the tool to make use of the familiar package repository.

via ssh or serial console on the mote:

wget http://www.flowsgi.inf.ethz.ch/imote2/ipkg-cl
chmod 750 ipkg-cl
cd /usr/lib
wget http://www.flowsgi.inf.ethz.ch/imote2/libipkg.so.0
ldconfig
cd 
./ipkg-cl install http://familiar.handhelds.org/releases/v0.8.2/feed/base/libipkg0_0.99.147-r1_arm.ipk http://familiar.handhelds.org/releases/v0.8.2/feed/base/ipkg_0.99.147-r1_arm.ipk http://familiar.handhelds.org/releases/v0.8.2/feed/base/ipkg-collateral_1.0-r2_arm.ipk  
rm ipkg-cl

To have all the feeds for 0.8.2 available, add the following to /etc/ipkg.conf:

src/gz base http://familiar.handhelds.org/releases/v0.8.2/feed/base
src/gz update http://familiar.handhelds.org/releases/v0.8.2/feed/update
src/gz world http://familiar.handhelds.org/releases/v0.8.2/feed/world
(The opie and x11 feeds do not make much sense on a system that has no display ...)
One should avoid to use ipkg upgrade, this will destroy the custom setup and install many useless startup scripts.

Java on iMote2

Blackdown 1.3.1

Blackdown 1.3.1 can be found in /j2re1.3.1. The binaries are already in the $PATH and $LD_LIBRARY_PATH respecively. It should work out of the box. You can copy your Java code via scp (secure copy).

JamVM

JamVM is a very small Java VM implementation with a 1.4 compliant classpath. To install JamVM, do the following:

ipkg install http://familiar.handhelds.org/releases/v0.8.2/feed/world/classpath_0.14-r0_arm.ipk http://familiar.handhelds.org/releases/v0.8.2/feed/world/classpath-common_0.14-r0_arm.ipk
ipkg install http://familiar.handhelds.org/releases/v0.8.2/feed/world/jamvm_1.3.0-r0_arm.ipk 

Advanced steps

Setting up a cross-compilation environment on Linux

  • Get the official 0.5 SG2 release from platformX
  • Follow the installation guide found here . Note: the kernel patch is at platx/kernel26-px2/patch-2.6.14-px2_05 of the SG2Release-0_5/buildTree/platx-0.5.tgz archive.

Create your own linux image for iMote2

The root file system (fs.jffs2) from the 0.5 release is 16MB, although the iMote2 features 32 MB of flash memory. Do the following to create your own 32 MB flash image:

Create a root fs image

Use mk.jffs2 from the 0.5 release (directory SG2Release-0_5/images/fstarball). It is invoked by the build_fs script, so apply changes there. Tell mk.jffs2 to add padding bytes at the end.

# 16 MB root file system
./mkfs.jffs2 --squash-uid -r ./root -o fs.jffs2 -e 0x20000 --pad=0x01000000

# 32 MB (in fact 29.75 MB) root file system
./mkfs.jffs2 --squash-uid -r ./root -o fs.jffs2 -e 0x20000 --pad=0x01DC0000
Note: The root fs will be flashed at address 0x00240000. On iMote2 the size of the flash is 0x02000000, thus giving a max. fs size of 0x1D0000 bytes. The content will be used from ./root directory, so put everything you want to add there.

Changing the MTD partition map

The kernel from the 0.5 release works with a 256kB bootloader (blob), a 2MB kernel image and a 16MB root fs (fs.jffs2). This mapping is statically set in the kernel. The kernel used in our java image works with a maximum sized root fs (29.75 MB). If you want a different size you must provide a different MTD mapping. You can either add the static mapping in the kernel (requires recompilation of the kernel, i.e., rebuilding the zImage) or you can specify the new mapping as kernel parameter when booting.

Boot-time configuration

  1. Abort the boot loader by pressing a key before the timeout expires.
    blob version 2.0.5-pre3 for Intel Stargate 2 and Mote 2
    Copyright (C) 1999 2000 2001 2002 2003 Jan-Derk Bakker and Erik Mouw
    blob comes with ABSOLUTELY NO WARRANTY; read the GNU GPL for details.
    This is free software, and you are welcome to redistribute it
    under certain conditions; read the GNU GPL for details.
    Loading blob from flash . done
    Loading kernel from flash ........ done
    Autoboot (10 seconds) in progress, press any key to stop ..........
    
  2. Boot with the following boot options (e.g., for using a 29.75 MB root fs, the -(filesystem) uses the remaining part of the image for the root fs). For different sizes use the formal size-in-bytes-in-hex@byteoffset-in-hex. Blobs default option (when it times out) are root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS2,115200 mem=32M, these options have to be supplied as well.
    boot mtdparts=PXA27xOnChipROM:0x00040000@0x00000000(bootloader),0x00200000@0x00040000(kernel),-(filesystem) root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS2,115200 mem=32M
    
  3. Unless you recompile blob, remember that you have to provide these parameters on each boot.

Changing the MTD patition map in the kernel

  1. Open linux-2.6.14/drivers/mtd/maps/pxa27x-flash.c in an editor.
  2. Modify the size field of "Filesystem" struct (line 59). For example for 29.75 MB root fs:
    static struct mtd_partition pxa27x_partitions[] = {
       {
          .name =     "Bootloader",
          .size =     0x00040000,
          .offset =   0,
          .mask_flags =  MTD_WRITEABLE  /* force read-only */
       },{
          .name =     "Kernel",
          .size =     0x00200000,
          .offset =   0x00040000,
       },{
          .name =     "Filesystem",
          .size =     0x01DC0000,
          .offset =   0x00240000
       }
    };
    
  3. Recompile the kernel
    $ make zImage
    
  4. Flash the new kernel image linux-2.6.14/arch/arm/boot/zImage
  5. Power-cycle the iMote2.

First time boot with custom image

  • setup your mote
  • On the mote: (via serial console)
    ./configure-im2
    
  • enable ssh root login
  • vi /etc/ssh/sshd.config
    uncomment "PermitRootLogin yes"
    :wq
  • enable ssh on startup
  • cd /etc/rc2.d
    ln -s ../init.d/sshd S11sshd
    

Michael Duller, Renè Müller and Jan S. Rellermeyer