Boot Linux on the Beagle Board

Creating a functional Linux single-board computer on the cheap

The Beagle Board is an open-hardware single-board computer that is both inexpensive and capable of running Linux® at a reasonable speed. Get to know the Beagle Board, and learn how to get a Linux development environment together on the cheap.

Jeffrey M. Osier-Mixon, Embedded Developer and Writer, MontaVista Software, Inc.

Author photo - Jeffrey Osier-MixonJeffrey Osier-Mixon is a technical writer, open source advocate, and community manager. He blogs about open source software, runs the Meld embedded Linux community, and speaks at Linux conferences.



18 August 2009

Also available in Japanese Portuguese

The Beagle Board is a pocket-sized reference board (see Figure 1) containing a Texas Instruments OMAP3530 system-on-a-chip (SoC) processor (ARM Cortex A-8 core) running at up to 600MHz. (Find a link to more system specs in Resources later in this article.) Tiny reference boards are not themselves necessarily newsworthy—companies such as Gumstix have been providing similar boards for several years, including some based on the OMAP3530 processor. I picked the Beagle Board because it is an inexpensive platform for learning how Linux and small systems work. It is a reasonable alternative for hobbyists designing projects for themselves, academics creating projects for classes, and professionals designing low-cost appliances or thin clients.

Figure 1. The Beagle Board
Diagram showing the layout of the Beagle Board

Building your development environment

Notes on host platforms

Your host platform (that is, development machine) must be capable of transferring bits from the Internet to an SD card (generally by using a card reader), and thus should also have an Internet connection available.

It does not matter whether your host platform runs Linux, Windows®, BSD, Solaris, or any other operating system as long as it can communicate over a serial port. Most community members use Linux, so the help they provide most often relates to that operating system.

Note that with modern systems, the 1980s-style 9-pin RS-232 serial port requirement may be problematic. Nearly all machines as of early 2009 provide USB for serial access, obviating the need for RS-232. As a result, many newer machines do not provide one. Community members report success using an RS-232-to-USB converter as long as you can set up the port as /dev/ttyS0 (under Linux) or COM1 (under Windows), and, in fact, Texas Instruments recommends this setup. However you accomplish it, the rest of this article assumes that you are able to set up some kind of serial connection from the Beagle Board to your host platform.

Three items are required to boot the Beagle Board:

  • A desktop or laptop computer with a serial port (see the sidebar Notes on host platforms for more information)
  • A serial connector
  • A USB device cable, standard-A to mini-A

The Beagle Board comes with no cables or connectors. See the Beagle Board Shopping List (in Resources) for a list of required and optional items, as well as links to them. Most of the items shown here are available individually or as a package.

Serial connection

For the serial connection, you need the following components:

  • IDC10-to-DB9M serial cable
  • DB9F-to-DB9F null modem cable
  • DB9M-to-USB cable (optional if your host platform has an RS-232 port)
  • USB mini-B male-to-USB A male cable

The combination of the first three cables gives you a serial connection, which enables you to watch and interact with the board's bootloader and operating system through a terminal emulation program on your host platform.

Input and output

For input and output, you need the following items:

  • Powered USB 3-port hub with Ethernet
  • 5mm barrel power plug-to-USB A male adapter
  • USB mini-A-to-USB A female On-The-Go (OTG) cable (optional; lets it be powered over its USB connection)

These items give you the maximum benefit from using a Linux distribution on your Beagle Board. The built-in Ethernet gives you a network connection. The hub itself gives you a USB port for providing power to the Beagle Board with the 5mm power plug.

Keyboard, video, mouse

For keyboard-video-mouse (KVM) functionality, you need the following items:

  • HDMI male-to-DVI-D male cable
  • Digital monitor
  • USB keyboard
  • USB mouse

You may be tempted to use a PS/2 keyboard with a converter. Take my advice: buy a USB keyboard. A PS/2 keyboard would probably work with the Ångström Linux distribution, the demo described in this article, but you may well go further than this in the future, and not all distributions include a PS/2 driver.

You may also be tempted to try to use an analog (VGA) monitor or a DVI-D-to-VGA conversion cable. The Beagle Board does not emit the analog signal that would drive this setup, so using a converter or analog monitor would be fruitless. If your monitor does not accept digital (HDMI or DVI-D) input, consider using a TV and a 4-pin S-video cable, instead. Also note that audio does not work acceptably yet on Ångström, so don't spend too much time trying to track down speakers or headphones.

SD cards

You need at least one SD card to store Linux and its bootloaders. If you do not want to go through the process of downloading the software and partitioning the card, Special Computing (see Resources for a link) has a deal: You can order a 4GB SD card with the Ångström demo preloaded.


Connecting the components

When you have all of the parts, it's time to start plugging things in. First, connect the serial port by performing the following steps:

  1. Plug the IDC10 cable into the Beagle Board with the cable's pin 1 going to pin 1 of the connector (the pink wire on the ribbon cable faces the outer corner of the board).
  2. Plug the DB9M end into the null-modem DB9F/DB9F cable.
  3. Plug the DB9F/DB9F cable into your host platform, if it has a DB9 port. Otherwise, plug the cable into a DB9M/USB cable, then plug that into the host.

Next, connect USB and power:

  1. Plug the USB mini-A end of the mini-A/USB A female cable into the Beagle Board's USB mini-A connector.
  2. Plug the powered USB hub into the USB A female end of the same cable.
  3. Plug the USB end of the USB/5mm barrel cable into the hub.
  4. Plug the 5mm barrel end into the Beagle Board's barrel connector.

Note: Do not connect power to the hub yet.

Now, connect the keyboard, mouse, and video:

  1. Plug the HDMI end of video cable into the Beagle Board's HDMI connector.
  2. Plug the DVI-D end into your monitor.
  3. Plug the USB keyboard into the hub.
  4. Plug the USB mouse into the hub.

Figure 2 shows the connected components.

Figure 2. The connected Beagle Board
Diagram showing the Beagle Board connected to video, power, USB hub, and host platform

Now, you're ready to set up the console.


Setting up the console

The only way to know what's happening on the board is to watch and interact with its serial output through a console. You do this by setting up a terminal emulation program. When the serial port is configured on the host platform, any activity on the board is displayed on the console, including prompts for bootloader commands, operating system login prompts, and error messages.

Setting up the console on Linux

To set up a serial console under Linux, use a terminal emulation program such as minicom, as shown here:

  1. Install minicom on your system (see Resources for a link).
  2. Launch into setup as root by running the command sudo minicom -s.
  3. Select Serial Port Setup, and then press Return.
  4. Set the serial port by typing A to select Serial Device, change to the /dev/ttyS0 directory, then press Return.
  5. Ensure that communications settings (E) are 115200 8N1.
  6. Turn Hardware Flow Control off by typing F.
  7. Ensure that Software Flow Control is also off.
  8. Press Return to go back to the main menu.
  9. Choose Save Setup as dfl to use these settings by default.
  10. Choose Exit to exit the setup section and launch minicom with these settings.

Setting up the console on Windows

To set up a serial console under Windows XP or Vista operating system, I recommend downloading PuTTY, a terminal emulation program for Windows available at no cost (see Resources). Configure PuTTY for serial use by clicking Serial in the Session window. Next, click Serial at the bottom of the Category pane. Set the speed to 115200, the data bits to 8, the parity to None, the stop bits to 1, and flow control to None.

Verifying setup

To find out whether your console is set up properly, apply power to the board, either by plugging in the cables as shown in Figure 2 or by simply plugging a USB standard-A-to-mini-A device cable directly into the Beagle Board, powering it through the cable using OTG power. If all is correct, the text in Listing 1 appears on the console.

Listing 1. Bootloader output
Texas Instruments X-Loader 1.41
Starting OS Bootloader...


U-Boot 1.3.3 (Jul 10 2008 - 16:33:09)

OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle Board + LPDDR/NAND
DRAM:  128 MB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Audio Tone on Speakers  ... complete
Hit any key to stop autoboot:  0
OMAP3 beagleboard.org #

The prompt at the end of the output is from the second-stage bootloader, waiting for instructions on how to load the operating system.


Setting up the operating system

The host system is ready and the Beagle Board is set up. All you need now is an operating system.

Downloadable binaries exist for many Linux distributions that run on the Beagle Board, with Ångström, Maemo, Ubuntu, and Android being the most popular. All are under active development, and all have been demonstrated in public by professionals and hobbyists alike. This article covers the Ångström distribution, which is well tested and lean enough that it turns the Beagle Board into a viable Linux desktop machine and not-so-thin client. See Resources for links to video demonstrations as well as to the Ångström binary download.

The Ångström Linux distribution

What is Ångström?

Ångström is a Linux distribution (kernel, bootloader, and application stack) optimized for small computer systems, particularly SoCs. It is not technically an embedded operating system, as it includes many general-purpose components, but it was designed to be used as a basis for creating embedded operating systems in specific products. See the link to the Ångström distribution in Resources for more information.

The Ångström distribution contains four major components. They are shown below in the order in which you must copy them to the SD card, as the bootloaders must appear first on the card:

  • First-stage bootloader
  • Second-stage bootloader
  • Linux boot image (uImage)
  • Linux file system

The Beagle Board's firmware contains a first-stage bootloader called X-loader. X-loader can also be loaded from a removable storage space (such as an SD card) in a signed file called MLO. X-loader bootstraps the system only enough to load the second-stage bootloader, which otherwise would not fit into memory.

The second-stage bootloader provided in flash memory on the Beagle Board is U-boot, although most distributions provide their own version of U-boot in a file called u-boot.bin. U-boot initializes the system, then boots the Linux kernel. It can also be run from the console.

The Linux boot image, named uImage, finally boots the Linux kernel, which resides in the Linux file system in the /boot directory.

There are several ways to set up the file system; the method shown here requires a bit of work at the beginning but is flexible. Also note that this is the way the pre-built Ångström SD cards arrive if you order them from Special Computing.

Download the distribution

To assemble the Ångström distribution, you need the following files:

  • Angstrom-Beagleboard-demo-image-glibc-ipk-2009.X-test-20090326-beagleboard.rootfs.tar.bz2
  • MLO
  • README.txt
  • md5sums
  • u-boot.bin
  • uImage

Double-check that each of the files has downloaded properly. Navigate to the download directory in a terminal window, type md5sum *, then compare the values for each file with the contents of the file md5sum.

Partition the card

This method creates two partitions on the SD card. The first is a FAT partition that hosts the bootloaders and the kernel image. The remaining space on the card is dedicated to a third extended file system (ext3) partition.

You must create two disk partitions on the SD card. The FAT partition contains the bootloaders and the raw Linux kernel image. FAT is used for the boot partition, because it's a very basic file system that is straightforward and well understood by the Beagle Board by default, requiring no intelligence from the bootloader or operating system.

The Linux root file system, however, can be in any file system format understood by the Linux kernel. This example shows ext3, but the Journaling Flash File System version 2 (JFFS2) and SquashFS are also good choices, particularly for flash-based storage systems.

Now, insert the SD card into your host platform and create two partitions on the SD card using your favorite partition tool. Create a small, bootable FAT partition, followed by a larger ext3 partition. Detailed instructions for this process using the fdisk utility are available on the Beagle Board community page. Follow the instructions to the letter, naming the FAT partition BeagleBoot and the ext3 partition BeagleRootFS.

Remove and reinsert the card, and the two new partitions should mount on your host platform.

Copy the files onto the disk

Now you're ready to copy the files onto the disk. Make sure you copy them in this particular order:

  1. Copy MLO onto the bootable FAT partition.
  2. Copy u-boot.bin onto the bootable FAT partition.
  3. Copy uImage onto the bootable FAT partition.
  4. Extract the root file system into the ext3 partition. The easiest way to do this is from the command line:

    cd ext3FileSystem; tar xvjf downloadLocation/Angst*.tar.bz2

Unmount the partitions

To unmount the partitions, run the following command:

cd ~; sync; sudo umount BeagleBoot; sudo umount BeagleRootFS

Finally, remove the SD card, then insert it into the Beagle Board.


Booting Linux

What is booting?

The term booting is short for bootstrapping, which refers to the process by which a newly reset computer prepares itself to load an operating system. Modern desktop machines usually relegate this process to the BIOS, which automatically discovers and initializes the computer's hardware.

Small, resource-constrained systems such as the Beagle Board use a slightly different, multi-step process because of constrained memory. This process often involves three stages. A small, first-stage bootloader, which fits neatly into the small ROM provided on the system, locates and loads a larger, second-stage bootloader into RAM. The second-stage bootloader initializes the system and boots the operating system.

With the serial console visible on your host platform, plug the power cable into the USB hub. The text shown in Listing 1 should appear on the console. (Note that if your Beagle Board was purchased after March 2009, it's likely a Rev C or later board with 256MB or more of DRAM. This article was researched using a Rev B7 Beagle Board with 128MB DRAM. The process is identical for all revisions.)

There are two ways to instruct the Beagle Board to boot Linux from the card:

  • Remove power, then hold down the user button (closest to the outside of the board) while reapplying power.
  • Type the following lines at the U-boot prompt to set the environment variables for booting from the card:

    setenv bootargs 'console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootwait'
    setenv bootcmd 'mmcinit; fatload mmc 0 80300000 uImage; bootm 80300000'
    boot

    Note that you can write these environment variables to memory to instruct the Beagle Board to boot always from flash memory by typing saveenv before booting with the boot command.

The first time Ångström boots, it inspects the buses on the system and initializes the keyboard, display, mouse, Ethernet adapter, and any other peripherals, then finds the correct drivers to use. Subsequent boots are much faster.

The image in Figure 3 eventually appears on the display after the boot graphic.

Figure 3. Ångström booting on the display
Angstrom booting on the display

Use the USB keyboard to provide a user name and password. If you log in from the serial prompt, you can use root as the user name with a blank password.

Congratulations! You now have a fully functional Linux system running a Web browser (Mozilla Firefox), an e-mail client (Evolution), and several other applications as well as a full set of desktop tools and a package manager (opkg). The best part is that this system is running on a tiny, inexpensive, fanless computer that consumes less than 4 Watts total—probably about 1/10 of the power consumption of the monitor and 1/25 that of the host system. You have built a thin client. It is time to start playing with it. Come join the communities and share your ideas!

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Linux on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux, WebSphere
ArticleID=421819
ArticleTitle=Boot Linux on the Beagle Board
publish-date=08182009