HOWTO: Ubuntu on the BeagleBoard

This post is more to gather information that’s spread over a few different pages all into one place, so if I need to do it again from scratch I’ve got an easy reference to follow.

I’m running on Mac OS X as my primary operating system, and whilst it’s Unix, it’s not Linux so some of the development tools needed to get the beagleboard up and running either are outdated ports or don’t exist. As a result, I started out with creating a vm using Ubuntu Server 9.04 x64 in VMware Fusion.

I performed a basic install into the VM, accepting most of the the default settings – 1 CPU, 512 MB RAM, 20GB SCSI HDD. The one setting I changed was to use Bridged networking rather than NAT. During the installation of Ubuntu, the only set of pre-configured packages I selected was the OpenSSH Server. I let the installer automatically configure the disk, using the whole disk with a guided LVM setup and accepted the defaults.

Once Ubuntu was installed, the first thing I did was to set up a static IP address and configure passwordless logins for ssh.
Modify /etc/network/interfaces and configure eth0 with an IP address for your LAN

# The primary network interface
auto eth0
iface eth0 inet static

Modify /etc/resolv.conf as well to add in your DNS Server.

domain localdomain
search localdomain

Finally, restart the networking subsystem so it picks up the new static IP.

sudo /etc/init.d/networking restart

Once this is done, you can ssh in from the host operating system. Test that ssh logins work, and then set up passwordless logins for convenience.

ssh [email protected]

Once logged in to the vm via ssh

ssh-keygen -t dsa

I don’t bother with a password for these keys as I’m not going to be using them for anything that requires a high degree of security. When the keys are generated log out of the remote system. From the host os, copy over your public keys to the vm. If you haven’t already generated ssh keys, do so with ssh-keygen.

scp ~/.ssh/ [email protected]:~/.ssh/authorized_keys

Now you will be able to log into the vm, and copy files to it, without needing to enter a password.

Next up, are some system updates, installing a basic build environment and VMware Tools.

sudo apt-get -y upgrade

If this updates the kernel, reboot before continuing. If not, continue on with more updates.

sudo apt-get -y install build-essential
sudo apt-get -y install linux-headers-`uname -r`

Next, in VMware select the Virtual Machine -> Install VMware Tools menu item, then in the VM:

mount /cdrom
cd /tmp
tar zxvf /cdrom/VMwareTools-7.9.7-196839.tar.gz
cd vmware-tools-distrib
sudo ./ --default

If it has problems finding the linux headers, reboot and re-run the command

sudo apt-get -y install linux-headers-`uname -r`

Then try installing the VMware Tools again.

Now that the build environment is set up, we can start installing the beagleboard specific stuff. At this point, if you’re feeling cautious, you can snapshot the VM so that you can roll back to this point should anything go wrong with it later on.

A lot of the information following comes from these two pages:
BeagleBoard Ubuntu on eLinux
How to boot beagle

Set up the development environment

sudo apt-get install qemu
sudo dpkg -i debootstrap_1.0.13~jaunty1_all.deb

Install rootstock (this is a listed package in 9.10 so you can apt-get rootstock)

tar xf rootstock-0.1.3.tar.gz
cd rootstock-0.1.3
sudo ./rootstock --fqdn beagleboard --login ubuntu --password mypass --imagesize 1G --seed xfce4,gdm --dist jaunty --serial ttyS2 --kernel-image

Everything from sudo ./rootstock through to the armel.deb above is all on one line.
This downloads the ARM kernel and builds a tar archive of the root filesystem for ARM. It will be sized for a 1G SD card, using the login username of ubuntu and a password of mypass. It will take quite some time to do it, as it’s running inside qemu to emulate an ARM processor (inside a VM at that)

Format the SD Card using fdisk. In my VM, it came up as /dev/sdb. I created a 32MB partition at the start – this will be FAT format and hold the boot image, the rest of the disk will be ext3.

sudo fdisk /dev/sdb

In fdisk, type p to print the partition map, just to make sure you’re working with the correct disk. You don’t want to destroy the partition map from the system disk.
Then, once you’ve verified you’re talking to the correct disk, enter o to create a new, empty partition table. Enter n and then p to create a primary partition. Make it partition 1, with the first cylinder at 1 and the size as 32M. Then enter n, p, 2 to make a second primary partition. Take all the defaults for the sizes and this will make the second partition fill the rest of the SD card.
Next, using a, toggle the bootable flag on partition 1. Finally, hit p to print out the partition table so you can check it and hit w to write this to disk and exit.

When the prompt returns, create a FAT and an ext3 filesystem on the disk

sudo mkfs.msdos -v -n MSDOS /dev/sdb1
sudo mkfs.ext3 /dev/sdb2
sudo tune2fs -c0 /dev/sdb2

Once that’s one, create the boot image

sudo apt-get install uboot-mkimage
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux" -d ./vmlinuz-* ./uImage

Mount /dev/sdb1 on /mnt/disk1 and /dev/sdb2 on /mnt/sdb2

cd /mnt/disk1
sudo cp ~./rootstock-0.1.3/uImage uImage
cd /mnt/disk2
sudo tar xpvf ~/rootstock-0.1.3/armel-rootfs-[date].tgz

OK, now we’re ready to boot the beagle. Connect to it’s serial port using your favourite piece of software. I use screen and a USB-RS232 adapter like so:

screen /dev/tty.usbserial-FTC9PP16 115200

Your /dev/tty… entry will be different depending on the USB-RS232 adapter you have. 115200 is the baud rate that the beagleboard expects to use. Depending on the serial cable you get for the beagle, you may need a null-modem adapter – I got the serial cable from Digikey and it just worked. Make sure you plug into the header pins the right way around though.

Now you are in screen – to quit screen, the default keystroke is Ctrl+a, Ctrl+, y

Power up the board and interrupt the boot process when it asks you. Type in the following to default to booting off the SD card:

setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000'

setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rootwait rootfstype=ext3 ro omapfb.mode=dvi:[email protected]'



If you’re using a different revision of the board, you may need to use an alternate syntax for the mmc init bit:

setenv bootcmd 'mmcinit; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000'

Once you enter boot, it should then start to boot off the SD card, you’ll see all the regular linux startup messages happen and at the login prompt, you will be able to log in using the credentials you passed to rootstock.

Done and donner.

This article was posted by Kai Howells. If you liked this content and have any technical work in the Melbourne area, say hello via my contact form or give me a call on 0419 361 653 - I cover most of the greater Melbourne area and my rates are competitive.

10 Responses to HOWTO: Ubuntu on the BeagleBoard

    • The MSDOS FAT partition is used to hold the boot image – uImage
      The preboot environment in the Beagle Board, as far as I can tell, only understands basic file systems like FAT so the uImage file contains more code that can then mount and understand the ext3 partition with the rest of the OS on it.

      The uImage file is pretty small, 3MB or so, so if you’re trying to keep things as small as possible, you don’t need a 30MB partition for it as the uImage file is the only thing on this slice.

  1. do you know how to start on graphic mode, mi board boots but only stands on text mode, i tried to look for the x11.conf but i didn’t find it, i found a xkb file. I made the xorg.conf file but it doesn’t work.

    • No, I’m not sure yet how to do this. I’ve ordered a HDMI to DVI cable from DealExtreme, but it hasn’t shipped yet, so I haven’t as yet plugged my beagleboard into a display. I’ve had a half-arsed go at getting remote X working, but so far no luck. I’ve got a USB Ethernet adapter on it’s way which should make this a bit easier…

    • Hi Milo,

      On the FAT partition there are no other files other than the uImage – MLO is used for the Angstrom boot process (if I remember correctly).
      The rest of the OS is all on the ext3 slice, which makes up the bulk of the SD card…

  2. in the angstrom tutorials, we have a file in the FAT side called U-boot.bin that contains all the config for the hardware. To edit settings like which mux settings are used on the expansion header we edit the files that make the u-boot.bin then recompile. How would we do the same thing using this method? thanks

  3. Jimmy–

    In this case, I believe the BeagleBoard is using a version of MLO and u-boot stored in NAND. In order to change pin mux settings, you’d either need to update the NAND u-boot, or erase NAND (forcing the OMAP to look on the SD card) and put MLO and u-boot in the FAT partition, as in the Angstrom instructions.

Leave a Reply

Your email address will not be published. Required fields are marked *