Sheeva Plug Dev Station

I mentioned the Sheeva Plug computer several times here on this blog. Today I start a series of posts that will continue on the tech.slupik.com, devoted to Sheeva development, and to plug computers and other embedded systems in general. But let me post the inaugural story in both places.

At the moment I run two Sheeva servers in my little data center. I have the third one set up as a development / staging environment. There are many ideas continuously coming to my mind. Most of them require testing various scenarios and it would simply be inconvenient to mess with the production machines. That is why I purchased the third one. hey, at $99 it is not a life changing decision.

When the third Plug arrived, I thought to myself it would be nice to have a permanent environment in place to play with it. Environment here means a host machine, needed to prepare the Sheeva to run and then a simple I/O for screen and keyboard and a web browser. The hardware requirements for such a machine are pretty minimal. As usual I wanted to have a decent screen resolution (1280 by 1024) and a good mouse / keyboard. I had a Samsung Syncmaster LCD display collecting dust underneath my desk. There was also a Logitech DiNovo keyboard and a Microsoft Mouse. The Samsung had simple VGA input and both keyboard and mouse were "Bluetooth". So all I needed was a kind of a low - end CPU with OS, storage and network interface. A Linux netbook seemed like a good idea. I called a friend of mine who purchased a number of HP-2133 mini-note netbooks some time ago. He had one for sale at a reasonable price. It arrived with Suse Linux on board. I played with it for a day, but did not like the Suse and tried a number of alternatives, finally selecting the Mandriva 2010 edition. The Mandriva was selected only because it installed almost flawlessly, detecting all the peripherals on board the netbook. I had some issues forcing it to support the native 1280 times 1024 resolution of the external monitor, but ultimately after upgrading the BIOS, I was clear to declare the victory. The system was fully up and running. Good screen, excellent keyboard and mouse, wired and wireless network and USB to connect serial console to the Sheeva.

Apart from the host Linux machine, I also needed an Ethernet switch. The Netgear GS105 is really nice. It is relatively heavy, so does not get pulled by the Ethernet cables. It is very small too, not taking too much space on the desk. I also found a very nice USB hub by Asmax (this is a Polish brand, but the product itself is probably available worldwide, just with a different name. It is white (matching the Sheeva) and has very thin and short cable with angled plug - perfect companion for the Sheeva - see the attached photos.

Now a few hints I put down.

To set up the Sheeva, I successfully use the SheevaPlug Installer. I never made it run on Windows, so won't help you here. But if you use the Linux version, here are a couple of things to consider (with respect to the Linux host machine):
  • Install the PHP client (sudo apt-get install php5-cli)
  • Install the missing LIBFTDI1 (sudo apt-get install libftdi1)
  • Set a proper MAC address to be burned to Sheeva by the Installer. The procedure is detailed in the installer's readme.
  • I strongly recommend setting up the Sheeva with a SD card. Personally I use 4GB Sandisk Extreme III 30 MB/s edition. It probably is faster than the internal NAND and most importantly - can be replaced once it wears out. On the other hand when you wear out the internal NAND, you will have to replace the entire Sheeva. To setup the system on a SD card, you invoke the installer as follows: [sudo php runme.php mmc].
Before you start installing system on the Sheeva, it is good to prepare a serial console on the host machine. This way you can watch the installer doing its job. To setup the console I had to do the following steps on the host machine:
  • Ensure proper serial interface is connected:
    rmmod ftdi_sio
    modprobe ftdi_sio vendor=0x9e88 product=0x9e8f
    chown uucp /dev/ttyUSB0 (or .../ttyUSB1 - depending on your setup)
  • Start serial terminal application
    gtkterm
After setting things up as described above and launching the installer the entire setup process takes about 10 minutes. It ends up with the Sheeva loaded with Ubuntu 9.04 (the rootfs is on the SD card) and its IP assigned by a DHCP server. You can ssh to root@. The initial password is [nosoup4u]. Before we start setting it up further, there is one issue, that has to be fixed in the boot loader. To get there keep the serial terminal open and reboot the Sheeva (do not disconnect from the mains, just use a paper clip to press the reset switch via the small hole by the SD card). Once it starts booting, hit Enter to stop the boot process. You will find yourself in the boot environment, that works on a set of string variables.

Display the environment by typing [printenv]. There are two variables we need to fix. Both are identical, one is called bootcmd, the other one is realbootcmd.

Type
setenv bootcmd 'setenv bootargs $(bootargs_console) $(bootargs_root); mmcinit; mmcinit; ext2load mmc 0:1 0x800000 /uImage; bootm 0x00800000'
and then
setenv real_bootcmd 'setenv bootargs $(bootargs_console) $(bootargs_root); mmcinit; mmcinit; ext2load mmc 0:1 0x800000 /uImage; bootm 0x00800000'
and finally
saveenv
to make changes permanent.

The reason we do this is the double mmcinit command. There is a bug in the boot environment. After power up, it does not initialize the SD card properly. So without the above modifications, your Sheeva would not boot after power loss. Calling the mmcinit twice is a good enough workaround.

And we do this twice for a reason. Usually the bootcmd is used. But there will be time when you will have a need to reinstall the system from scratch. Having access to the boot environment, all that has to be done is to
run recover1
at boot time. The system will be refreshed. And so will be the bootcmd (it is copied from the real_bootcmd). Applying the fix in both places (bootcmd and real_bootcmd) lets you run the fresh installation process anytime without any need for additional fixes.

So the system is up and running now. I will continue the series on the tech blog, those who are interested - see you there. Apologies to the rest of the audience for the technical content today :)

Comments