Beagleboard XM and Angstrom – Getting the Big Dog to Run At Full Speed

When I received a Beagleboard XM low-power computer a few weeks ago, I promptly installed Ubuntu Maverick 10.10 on it. I’ve found Ubuntu’s build for Beagleboard‘s ARM-based processors to be remarkably stable on my previous generation Beagleboard C4, so this seemed to be a safe bet. On the XM, Ubuntu seems remarkably solid, but remarkably slow.

I noticed some early signs of trouble on the initial boot: an ominous “”Kernel is not ready for 1Ghz limiting to 800Mhz” message, and a Windows-like leisurely boot time. My first impressions were confirmed by running the HardInfo benchmarks. Every one of them except BogoMIPs was lower on the XM than the C4 by 10-20%. BogoMIPs was a disappointment too, at just over 600. On the Angstrom demo build that is bundled with the XM, the BogoMIPs benchmark was close to 1000.

I tried installing Ubuntu 10.04 on the XM, but the HardInfo benchmarks were just as slow. A Google search confirms that others have run into the same problem with the XM, and as of now (early December 2010) there doesn’t seem to be a workaround. It would appear that Ubuntu isn’t yet optimized for the XM’s faster DM3730 processor.

Performance aside, Ubuntu 10.10 ran well on the XM. But it broke my heart to see the old C4 running rings around the new pup. So goodbye Ubuntu, hello Ångström, at least for now.

Angstrom (sorry, I’m not going to type in those umlauts again) is a Linux distribution that seems to be designed for speed and not comfort. As the name suggests, its roots are as a relatively tiny OS that can run on portable devices that are slower and more memory constrained than the XM, such as Pandora handheld gaming console and the Sharp Zaurus. The XM lets Angstrom stretch its legs, and it responds with blazing speed!

Unfortunately, it’s also much trickier than Ubuntu to configure. Angstrom’s default installation doesn’t include a lot of the packages that are included in every Ubuntu install (and most other distros too). Many of the packages available for Angstrom have generic or misleading names, so it can be hard to track down the one you want. There isn’t a lot of end user documentation for Angstrom, and the user base is much smaller than Ubuntu’s, so Googling won’t always find you the answer either.

Here’s a step-by-step description of how I got Angstrom up and running. To take optimal advantage of Beagleboard’s ultra low power design, my goal was a “headless” application server (i.e. no monitor and therefore no GUI).

1. Angstrom’s has an online image builder named Narcissus. While its pretty easy to generate an image, it isn’t obvious how to boot the image on your Beagleboard. The best instructions that I found were in this article on Trey Weaver’s blog. The only thing that I did differently than what it describes is the command to extract files from the Angstrom image file. Since Narcissus is (currently) using a default image format of gzip (i.e. the downloaded image file ends with .gz), the command to extract the boot files has slightly different parms:

tar --wildcards -xzvf [your-download-file] ./boot/*

Similarly, the command to extract the root filesystem is:

sudo tar -xvz -C /media/Angstrom -f [your-download-file]

2. The Beagleboard XM has a built-in serial port, and the default Angstrom build supports it, so you can initially login by connecting a PC to the serial port (a USB-to-serial adapter works fine) and running a terminal program. (Settings are 115200 bps, N-8-1 no flow control.) On Windows, WinPutty works well – on a Linux PC, minicom is, I think, the best bet.

However, you may run into an irritating problem with the display and keyboard input being garbled. I’ve had that problem when I’ve installed Angstrom on both my Beagleboards, and I’m not aware of any workaround.

Fortunately, the garbled terminal only occurs when connecting through the Beagleboard’s serial port, so you’ll want to switch to some other type of connection as soon as possible.

[Update: It turns out that the garbling occurred only when using a PCI Serial Port card.  I switched to a USB-Serial converter (which uses the common Prolific chipset), and WinPutty works flawlessly.]

Since I wasn’t interested in hooking the Beagleboard up to a monitor and keyboard, I switched to using SSH to bring up a command line connection from another PC. Here is another area where Angstrom is easier to use than Ubuntu – Angstrom activates the Ethernet port by default, and includes an SSH server named Dropbear by default, so you may be able to connect by SSH on your very first boot, bypassing the serial port entirely.

In any case, the default user-ID is root, and it has no password.

3. To set a password, use the passwd command. I’d suggest you do so even if you aren’t at all concerned about security, since some utilities will expect a password.

passwd

Angstrom makes some suggestions about the length and types of characters in your password, but it doesn’t enforce them.

4. You might want to add a regular user account too. The command for that is useradd

useradd youruserid

You need to assign a password to this user-ID before it can be used to login:

passwd youruserid

5. If the only Linux distro you’ve used before is Ubuntu, you might be puzzled about the command used to run root commands when logged in as another user. “sudo” isn’t installed in Angstrom by default. Configuring sudo in Angstrom is surprisingly difficult, so you might want to stick to running as root, or get used to switching from a user account to root by entering:

su -

Enter the root password when prompted, not the user password à la Ubuntu.

6. The command to install packages in opkg (which, like pretty much every other command I list, must be run as root). Entering “opkg –help” will tell you all you need to know, but here are some commonly used commands:
To bring your installed packages up-to-date

opkg update
opkg upgrade

To install a package:

opkg install packagename

To remove a package:

opkg remove packagename

If the removal of a package fails due to a long list of dependent packages (and you are sure you don’t want to keep any of them!):

opkg remove packagename --force-removal-of-dependent-packages

Unlike Ubuntu’s aptitude, opkg doesn’t automagically remove conflicting packages for you. So, when an install fails due to conflicts, you need to either remove them manually, or (as a last resort) grit your teeth, cross your fingers, and enter:

opkg install packagename --force-overwrite

To list the files in an installed package:

opkg files packagename

If you want to install something and are trying to figure out its packagename, you can get a list of packages whose name includes a search term:

opkg list | grep "whatever"

To get a description of a package:

opkg info packagename

A better way of finding a package is to use the package browser on Angstrom’s web site. Better, but frankly not great, since Angstrom tends to use different package names from other distros, and the package descriptions are usually vague.

To get a list of packages already installed:

opkg list_installed

7. As with most Linux distros, the default text editor is “vi”. Lots of alternatives are available, but the one I use is emacs:

opkg install emacs

8. You’ll need an editor to change the hostname to something other than the default of “beagleboard”. The 2 files you’ll need to edit are /etc/hostname and /etc/hosts. For example, to change your hostname to bigdog, the contents should be:

youruserid@bigdog:/etc$ cat hostname
bigdog
youruserid@bigdog:/etc$ cat hosts
127.0.0.1       localhost.localdomain           localhost
127.0.0.1       bigdog

9. [Update: This step may no longer be necessary – I noticed that the Angstrom 11.03 Narcissus image uses bash as the default user shell] By now, you’ve probably noticed that the shell is missing some features that you’re used to, like color coding. Strangely, one of the things that Angstrom doesn’t install by default is the nearly-universal bash shell. To install it:

opkg install bash

After installing it, you need to make it the default for your user-ID (though you can run it temporarily by just entering “bash”). The command for doing this is

chsh /bin/bash

Since you have to be root to do this, if you want to change a non-root user to the bash shell, enter

chsh /bin/bash youruserid

10. You’ll probably want to make some folders on the Beagleboard accessible over the network. In my case, I primarily use Windows PCs, so I needed to install Samba. Since configuring samba can be tedious using its command line tools, I also installed the browser-based samba configuration tool, SWAT:

opkg install xinetd
opkg install samba swat

xinetd is the standard way of invoking SWAT (and other port-based utilities). You’ll probably have to manually edit the SWAT settings in the xinetd configuration file — the following settings will allow access from any PC:

The updated /etc/xinetd.conf file should look like this:

# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

}

service swat
{
   disable = no
   port    = 901
   socket_type = stream
   wait    = no
#       only_from = localhost
   user = root
   server = /usr/sbin/swat
   log_on_failure += USERID
}
includedir /etc/xinetd.d

After changing the xinetd.conf file, you need to restart xinetd:

/etc/init.d/xinetd restart

You should now be able to open the following address in a browser on another PC: http:<ipaddress>901

Login as root at the prompt.

By default, the home folders are shared – if you created a non-root user-ID then the defaults may be fine. However, you’ll need to go to the SWAT password page and enter the user-ID and password that you login to Windows. Click the “Add New User” button when you’re done — it may be old to you, but it’s new to SWAT:

I’d also suggest you go to the Global page and change the workgroup to whatever your Windows PC uses, and enter something meaningful in the “netbios name” field.

After saving your changes you don’t need to restart Samba – it applies your changes automatically.

If you go to a Windows PC, you should now be able to see your Beagleboard in your network, with some shares underneath. If you are prompted for a user-ID and password, use the one you entered into SWAT’s password page.

11. One of the things I want to use my XM for is as a Tweet-A-Watt server. It’s a good match: software to monitor electricity usage running on an ultra low-power platform. This requires adding a couple of things to Angstrom: Python, and access to an XBee connected to a USB drive. Both of these turned out to be somewhat trickier than they are on Ubuntu.

12. The main package for Python is named python-core. However, Angstrom’s idea of a “core” lacks a lot of python libraries that are standard on pretty much any other Python installation. After playing hide-and-seek with various packages, I gave in and installed the full set of libraries, packaged as python-modules. I also included pyserial for access to the XBee

opkg install python python-modules python-pyserial

At this point, you can install the Python setuptools package, which includes the easy_install command. easy_install allows you to install many other python libraries that don’t (seem to) have Angstrom packages. In my case, I needed Tweepy, which can be used to provide Twitter access to tweetawatt (I wrote an earlier post about that):

opkg install python-setuptools
easy_install tweepy

13. Unlike Ubuntu for Beagleboard, Angstrom doesn’t include support for serial port USB devices in the kernel. If you plug in a USB serial I/O device like an XBee or Arduino, it will be recognized, but no port (e.g. /dev/ttyUSB0) will be assigned to it.

(On the other hand, USB storage devices are supported by default in the Angstrom kernel. And, unlike Ubuntu on the Beagleboard, some drives are automatically mounted, so after plugging in a USB drive you should be able to immediately access it under /media/sda. Kewl.)

To install support for USB serial I/O devices:

opkg install kernel-module-ftdi-sio

You can temporarily load the kernel module to confirm that it works by entering

depmod -a
modprobe ftdi-sio

If you plug in an XBee, it should now be assigned a port. (Probably /dev/ttyUSB0, but you can enter dmesg and look at the bottom of the output to confirm this).

To automatically load the kernel module at bootup:

echo usbserial > /etc/modutils/usbserial
echo ftdi_sio > /etc/modutils/ftdi_sio
update-modules

this will update the /etc/modules file.


Phew. In the unlikely even that you read this far before actually trying to get Angstrom working, you might be wondering if it is worth all the effort. The process of setting up the same configuration in Ubuntu is simpler and much better documented.

While its somewhat rewarding to use long-neglected command line skills (and learn a few new ones), I’d frankly have to admit that I’ll probably change back to Ubuntu when (if?) its performance on the XM is comparable to Angstrom’s. There are some packages that don’t seem to exist yet in Angstrom, and I don’t have the time/skillz to port them over. (Most notably, I would love to have Python’s Matlib package, and a browser administration tool along the lines of WebMin. Oddly, the standard Linux help command, man, is currently not available for the Beagleboard).

One other concern: Ubuntu is rock solid on my older Beagleboard, and Angstrom’s stability is, for me, unproven. However, Tweet-a-Watt is now up and running on my XM – if it’s still posting updates to www.twitter.com/gigamegabot when you read this, then maybe tiny Angstrom and the Big Dog really are a match.

This entry was posted in Gadgets and tagged , . Bookmark the permalink.

14 Responses to Beagleboard XM and Angstrom – Getting the Big Dog to Run At Full Speed

  1. greg B says:

    Great Blog! I would love to see some basic C code for connecting to a Xbee under Ubuntu. I don’t know any Python and don’t want to have to learn a new language. I would love to create a Gtk+ interface for home automation/data logging. Got this page bookmarked for sure!

  2. Helen Loeb says:

    Thanks for the blog. I just took my beagleboard XM out of the box, so far so good. I will install those packages and see what I can do. I have some working C++ code that I need to get running on the Beagleboard to interface USB and serial.
    Thank you

  3. Anon says:

    You don’t have to rely on opkg to get all your Python libraries. Why not try pip?

    • Dan says:

      Good idea. I wasn’t aware of pip, but it looks like it has some advantages over easy_install. I’ll give it a try.

      Ironically, since Angstrom doesn’t appear to have a package for pip, I installed pip using easy_install: # easy_install pip. But pip seems to run well on the Beagleboard and Angstrom.

  4. 3Phase says:

    Thank you very much! This is a great piece of work. I’m waiting for my Beagleboard and reading this assured me of alot of doubts and uncertainty. Bad news is – I just followed some readings over the last weekend and went out today for a not-so-sure-it-will-work USB to serial cable. Should I found your detailed write up here I could have save some $$$ hehe.

    May I ask a question please? If the ethernet port is enabled by default, what IP address should be used to connect to it? I guess the board can negotiate one from the router?

    • Dan says:

      Yes, with the default settings the Beagleboard XM will try to get its IP address from the router using DHCP. Depending on the router software, you might be able to tell which IP address it received by using the router’s “DHCP Clients” page.

      If you can’t find the Beagleboard XM’s IP address that way, then another approach is to connect to it from a PC using the XM’s built-in serial port, login as root, then enter the ifconfig command. That will display the IP address, if it has one.

      If the XM wasn’t automatically assigned an IP address for some reason, it won’t be reachable over the network. You’ll have to use the serial port connection to set the IP address manually – I have instructions for this in another blog post: http://gigamegatech.com/2010/12/26/beagleboard-xm-angstrom-next-steps-assigning-a-static-ip/. You’ll probably want to do this anyway, since the XM’s ethernet port is assigned a different IP address every time you boot the board.

      Dan.

  5. 3Phase says:

    Thanks again Dan! Just prepared an SD card with the pre-build packages at http://www.angstrom-distribution.org/demo/beagleboard/ Still waiting for the Beagleboard which is at the airport by now..

    Are these pre-build images good or would you recommend build my own on Narcissus? There are quite a lot of fancy options at Narcissus and is kind of overload to a newbie like me. Probably i’d have checked all options ^^

    Thanks in advance.

    • Dan says:

      Yeah, in theory, those demo images should work just as well as one generated from the Narcissus. It looks like the demo images on that page are being updated regularly with the latest kernel.

      However, in the wonderful, wacky world of Angstrom, it’s always “hard to say without knowing”, and I haven’t tried the demo images. If your Beagleboard won’t boot or isn’t stable when running the image on your SD card, or if you have problems installing or updating packages with opkg, the Narcissus approach would be a good fall-back plan.

  6. 3Phase says:

    Thanks so much Dan, for both your valuable advice and the excellent site here. Thank you!

  7. Abhimanyu says:

    Thanks for the post. BTW for USB Serial the method u described did not work for me probably because i had a different chip (PL2303) .. so instead of installing ftdi-sio i installed the module for PL2303.

  8. Nilavarasan says:

    I copied files from http://www.angstrom-distribution.org/demo/beagleboard/ but the Beagleboard hang at line
    “Loading -u-boot.bin from mmc”………
    Can someone help why beagleboard hang?

    • Dan says:

      Hi,

      That error could be caused by a lot of things:

      – something went wrong when you copied the files to the SD card (you have the exactly follow the instructions in “How to Unpack and Boot the Demo Image” on the Angstrom Demo page)
      – a bad SD card
      – the wrong DC adapter for the Beagleboard (be sure it is 5V and at least 1A)
      – a bad Beagleboard (but that is rare)

      If you are new to the Beagleboard and Linux, you might want to try Ubuntu Linux instead, since the process of building the SD card is simpler. See http://elinux.org/BeagleBoardUbuntu#Demo_Image

      Dan.

  9. Pingback: BeagleBoard XM and Ubuntu 11.04 – The Big Dog Still Has a Burr in its Paw | GigaMegaBlog

  10. Pingback: Beagleboard setup and coding | Interesting Implications