BeagleBoardUbuntu

This page is about running a (ARM EABI) Ubuntu distribution at BeagleBoard. BeagleBoard will boot the (ARM EABI) Ubuntu distribution from SD card.

Note: for the best experience, make sure you have an LCD attached to the HDMI port, 2GB/4GB/8GB SD card, and a known good usb2.0 hub with mouse and keyboard.

= Help =

If you need any help:


 * Kernel related help:
 * Email Beagleboard user group *Recommended method
 * #beagle: Beagle irc on freenode, accessible also by web interface (logs)
 * Launchpad Project "Beagleboard Kernel"
 * Stable Kernel 2.6.35 src
 * Development Kernel src
 * Kernel Testing Results


 * Ubuntu related help:
 * #ubuntu-arm: Ubuntu's arm irc on freenode (logs -> year -> month -> day -> #ubuntu-arm.html)


 * When asking for help, please provide some debugging information:
 * U-Boot Version installed on board
 * Kernel Version: uname -a
 * pastebin dmesg
 * Copy from serial port or use "dmesg | pastebinit" (sudo apt-get install pastebinit)

= Required Beagle Software =

X-loader/MLO (1.4.4ss) & U-Boot (2010.03) (Zippy1 & Zippy2 Support)
 * All Bx, C2/3/4 Boards are required to upgrade to atleast these MLO and U-Boot versions.
 * XM Boards have no NAND, so u-boot.bin is always required on the first partition
 * Directions: Upgrade X-loader and U-Boot

=Demo Image=

Lucid 10.04.1
Note: On first boot, you must use an DVI/LCD monitor, oem-config seems to force tty0.. 2nd boot you can switch to serial by default..

Built with rootstock trunk (ARM native mode, run directly on beagleboard): sudo ./rootstock --fqdn beagleboard --imagesize 2G --dist lucid --serial ttyS2 \ --seed aptitude,btrfs-tools,i2c-tools,nano,pastebinit,uboot-envtools,uboot-mkimage,usbutils,wget,wireless-tools,wpasupplicant \ --script fixup.sh --components "main universe multiverse" \ --kernel-image http://rcn-ee.net/deb/lucid/v2.6.35.2-l0/linux-image-2.6.35.2-l0_1.0lucid_armel.deb

fixup.sh: http://bazaar.launchpad.net/~beagleboard-kernel/%2Bjunk/image-builder/annotate/head:/tools/fixup.sh

Get prebuilt image:

wget http://rcn-ee.net/deb/rootfs/lucid/ubuntu-10.04.1-minimal-armel.tar.7z mirrors (updating): wget http://ynezz.ibawizard.net/beagleboard/lucid/ubuntu-10.04.1-minimal-armel.tar.7z

Unpack it: (sudo apt-get install p7zip-full for 7za)

7za x ubuntu-10.04.1-minimal-armel.tar.7z tar xf ubuntu-10.04.1-minimal-armel.tar cd ubuntu-10.04.1-minimal-armel

Quick Install script for Beagle Bx, C2/C3/C4 ./setup_sdcard.sh --mmc /dev/sdX --uboot beagle --swap_file 50 (YOU need atleast 50Mb for oem-config to NOT Opps)


 * Additional Options
 * --rootfs
 * --swap_file 
 * --addon
 * pico

md5sum: 6a2d6d085dae74f504e3f424e41efe90 ubuntu-10.04.1-minimal-armel.tar.7z

For a full gui install: sudo aptitude install xfce4 gdm xubuntu-gdm-theme xubuntu-artwork xserver-xorg-video-omap3

Maverick 10.10 Alpha-3
Built with rootstock trunk (ARM native mode, run directly on beagleboard): sudo ./rootstock --fqdn beagleboard --imagesize 2G --dist maverick --serial ttyS2 \ --seed aptitude,btrfs-tools,i2c-tools,nano,pastebinit,uboot-envtools,uboot-mkimage,usbutils,wget,wireless-tools,wpasupplicant \ --script fixup.sh --components "main universe multiverse" \ --kernel-image http://rcn-ee.net/deb/maverick/v2.6.34.2-l2/linux-image-2.6.34.2-l2_1.0maverick_armel.deb

fixup.sh: http://bazaar.launchpad.net/~beagleboard-kernel/%2Bjunk/image-builder/annotate/head:/tools/fixup.sh

Get prebuilt image:

wget http://rcn-ee.net/deb/rootfs/maverick/ubuntu-maverick-alpha3-minimal-armel.tar.7z mirrors (will take some time to update): wget http://ynezz.ibawizard.net/beagleboard/maverick/ubuntu-maverick-alpha3-minimal-armel.tar.7z wget http://vivaphp.net/beagle/maverick/ubuntu-maverick-alpha3-minimal-armel.tar.7z

md5sum: e52a1fd4adac95888821044d8bd738c4 ubuntu-maverick-alpha3-minimal-armel.tar.7z

Unpack it: (sudo apt-get install p7zip-full for 7za)

7za x ubuntu-maverick-alpha3-minimal-armel.tar.7z tar xf ubuntu-maverick-alpha3-minimal-armel.tar cd ubuntu-maverick-alpha3-minimal-armel

Quick Install script for Beagle Bx, C2/C3/C4 ./setup_sdcard.sh --mmc /dev/sdX --uboot beagle --swap_file 50 (YOU need atleast 50Mb for oem-config to NOT Opps)


 * Additional Options
 * --rootfs
 * --swap_file 

= NetInstall Method =

NOTE: Lucid's NetInstall will not work with the new XM model..

The NetInstall Method, allows you to install Ubuntu directly onto your Beagle by pre-populating a boot image that will perform the complete install.

Note: The boot arg's are stored in boot.scr which will be copied to the first partition.

Recommended:
 * 2GB+ SD card
 * USB Ethernet/Wifi

Script Source: https://code.launchpad.net/~beagleboard-kernel/+junk/debian-di

Install bzr sudo apt-get install bzr

Download debian-di script bzr branch lp:~beagleboard-kernel/+junk/debian-di

Discover SD/MMC Partition sudo fdisk -l

Run Script cd debian-di ./mk_mmc.sh --mmc /dev/sdX --distro lucid --firmware


 * Options:
 * --distro : lucid
 * --firmware : install firmware for WiFi devices
 * --serial-mode : force NetInstall to use Serial Port

Note: The default boot options work for most people, but if you'd like to tweak boot settings, edit these before running the script. NetInstall boot Settings: gedit ./debian-di/scripts/dvi.cmd gedit ./debian-di/scripts/serial.cmd Normal Boot Settings: gedit ./debian-di/scripts/dvi-normal-lucid.cmd gedit ./debian-di/scripts/serial-normal-lucid.cmd

Place SD card into Beagle and Boot

Troubshooting: If boot fails.. nand erase 260000 20000
 * Hold the user button down to force booting from MMC
 * Upgrade X-loader and U-boot Upgrade X-loader and U-Boot
 * Clear U-boot's Environment Variables in nand:

NetInstall assumptions: Continue with out Kernel Modules Partition 

= RootStock: Build an Ubuntu root file system =

Ubuntu Version's
This guide only covers the latest Ubuntu stable (lucid) release and notes for the testing (lucid+1) dists. Notes for older release's can be found here:


 * Jaunty, aka Ubuntu 9.04, is the very-old-stable version (armv5 optimized)
 * TODO: http://elinux.org/BeagleBoardUbuntuJaunty
 * Karmic, aka Ubuntu 9.10, is the old-stable version (armv6 optimized)
 * http://elinux.org/BeagleBoardUbuntuKarmic
 * Lucid, aka Ubuntu 10.04 is the stable version (armv7 optimized)
 * TODO: http://elinux.org/BeagleBoardUbuntuLucid
 * Maverick, aka Ubuntu 10.10 is the development version. Currently listed here as 'testing'. (armv7 optimized)
 * TODO: http://elinux.org/BeagleBoardUbuntuMaverick

Install RootStock
This is based off Ubuntu's RootStock Project; RootStock script.

Debian Squeeze (unsupported as tested on 4/28/2010, qemu segfaults)

Karmic (9.10) sudo apt-get install (FIXME: rootstock minimum requirements) bzr branch lp:project-rootstock cd project-rootstock bzr revert -r 94 (Commit 95, isn't supported by Karmic's QEMU)
 * qemu: unknown parameter 'aio' in 'file=/tmp/tmp.QxNNQAxEyv/qemu-armel-201004221701.img,aio=native,cache=none'

Lucid (10.04) sudo apt-get install rootstock

RootStock: Useful seed Packages
Useful Packages: linux-firmware,wireless-tools :wifi adapters.. ntpdate :sync real time clock from network

GUI's (broken bug: FIXME) xfce4: xfce4,gdm,xubuntu-gdm-theme,xubuntu-artwork

RootStock: Running
Rootstock Command line: sudo ./rootstock --fqdn --login --password --imagesize \ --seed --dist  --serial  --kernel-image

Basic Lucid (10.04) Beagleboard minimal image: sudo ./rootstock --fqdn beagleboard --login ubuntu --password temppwd --imagesize 2G \ --seed wget,nano,linux-firmware,wireless-tools,usbutils --dist lucid --serial ttyS2 \ --components "main universe multiverse" \ --kernel-image http://rcn-ee.net/deb/lucid/v2.6.33.4-l3/linux-image-2.6.33.4-l3_1.0lucid_armel.deb

Upon Completion, you should have: armel-rootfs- .tgz -> Root file System, dump to ext2/3 partition of SD card vmlinuz-2.6. -> Boot Image, use mkimage to create uImage and dump to the first fat16 partition of SD card initrd.img-2.6. -> Boot initramfs, use mkimage to create uInitrd and dump to the first fat16 partition of SD card

Partition SD Card
You will need a 1GB SD card or greater. Standard Console System : ~286MB + Desktop environment (lxde,gdm) : ~479MB

Starting with an empty SD card and using gparted, create: 50 MiB Primary Partition, fat16/fat32 Rest as ext2/ext3/ext4/btrfs

Gparted Example: http://nishanthmenon.blogspot.com/2008/08/how-to-boot-beagle.html

For Reference: Disk /dev/sdd: 2038 MB, 2038431744 bytes 255 heads, 63 sectors/track, 247 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x0008e471 Device Boot     Start         End      Blocks   Id  System /dev/sdd1              1           6       48163+   6  FAT16 /dev/sdd2              7         247     1935832+  83  Linux

Copy Root File System to SD Card
Mount your SD card's larger root file system partition (assuming /dev/sdX2) and 'untar' the rootfs into it.

mkdir -p ./tmp sudo mount /dev/sdX2 ./tmp sudo tar xfp armel-rootfs-*.tgz -C ./tmp sudo umount ./tmp

Boot Partition
Requirements:

sudo apt-get install uboot-mkimage

U-Boot uImage
U-Boot needs a compatible kernel image to boot. To do this, we are using mkimage from (uboot-mkimage) to create an image from the vmlinuz kernel file.

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

U-Boot uInitrd
This step is Optional, but it helps with the lucid and Lucid++ experience.

mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ./initrd.img-* ./uInitrd

U-Boot Boot Scripts
The version of U-Boot installed or recommended to install uses boot scripts by default. This allows users to easily switch between multiple SD cards with different OS's with different parameters installed. Ubuntu/Debian requires a slight modification to the bootargs line vs. Angstrom, 'ro' vs 'rw'.

fixrtc: (only uInitrd) Resets RTC based on last mount buddy=${buddy}: (both) Kernel Zippy1/2 Support mpurate=${mpurate}: (recommended core clock)

create ubuntu.cmd setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; bootm 0x80300000' setenv bootargs console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait ro vram=12M omapfb.mode=dvi:1280x720MR-16@60 buddy=${buddy} mpurate=${mpurate} boot

With optional uInitrd: create ubuntu.cmd: setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80300000 0x81600000' setenv bootargs console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait ro vram=12M omapfb.mode=dvi:1280x720MR-16@60 fixrtc buddy=${buddy} mpurate=${mpurate} boot

Use mkimage create to actual *.scr file for U-Boot:

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Ubuntu 10.04" -d ./ubuntu.cmd ./ubuntu.scr

Copy to Boot Partition
Mount your SD card fat16/fat32 partition (assuming /dev/sdX1) and copy the uImage, boot.scr, and optional uInitrd to the first partition.

mkdir -p ./tmp sudo mount /dev/sdX1 ./tmp sudo cp ./uImage ./tmp/uImage sudo cp ./uInitrd ./tmp/uInitrd Beagle: sudo cp ./ubuntu.scr ./tmp/boot.scr IGEPv2: sudo cp ./ubuntu.scr ./tmp/boot.ini sudo umount ./tmp

Enable Network Access
Modify /etc/network/interfaces auto eth0 iface eth0 inet dhcp

Manual: From the Command line sudo ifconfig -a sudo dhclient ethX (or wlanX/etc..)

Additional Network Setup Information can be found HERE

= Advanced =

Script File
Note: this subsection is basically obsolete every time it's modified...

Latest Stable is : https://code.launchpad.net/~beagleboard-kernel/+junk/2.6-stable

But for example: http://rcn-ee.net/deb/lucid/v2.6.34.1-l2/ wget http://rcn-ee.net/deb/lucid/v2.6.34.1-l2/install-me.sh /bin/bash install-me.sh

Reboot with your new uImage

Upgrade X-loader and U-boot
Compatible with Bx,C2/3/4

Requires MMC card..

bzr branch lp:~beagleboard-kernel/+junk/omap-flasher cd omap-flasher ./mk_mmc.sh --mmc /dev/sdX (i.e. use /dev/sdc - the entire device, not a partition)

1: Place MMC card in Beagle 2: Push/Hold User Button Down 3: Apply Power 4: After U-boot loads, Let Off User Button 5: Wait for Flashing to end 6: Power down, remove/edit boot.scr from MMC card

Example 4G card:

sudo fdisk -l

Disk /dev/sde: 3957 MB, 3957325824 bytes 255 heads, 63 sectors/track, 481 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00080e99 Device Boot     Start         End      Blocks   Id  System /dev/sde1  *           1           9       72261    e  W95 FAT16 (LBA)

./mk_mmc.sh --mmc /dev/sde

Worst case, depending on what's actually in NAND, you might still have to stop and do this:

nand erase 260000 20000 reset

Manual Run
mmc init fatload mmc 0:1 0x80200000 MLO nand unlock nand ecc hw nandecc hw nand erase 0 80000 nand write 0x80200000 0 20000 nand write 0x80200000 20000 20000 nand write 0x80200000 40000 20000 nand write 0x80200000 60000 20000 fatload mmc 0:1 0x80300000 u-boot.bin nand unlock nand ecc sw nandecc sw nand erase 80000 160000 nand write 0x80300000 80000 160000 nand erase 260000 20000 reset

SGX Video Acceleration
Note: With 3_01_00_07 we don't have to register any more, the file is fully wget-able..

http://tigraphics.blogspot.com/2010/08/sgx-graphics-sdk-3010007-now-available.html.

Requirements: 2.6-stable from launchpad or 2.6.35.3-x1+ deb's from rcn-ee.net https://code.launchpad.net/~beagleboard-kernel/+junk/2.6-stable

Note: An older version of these instructions was adapted for the IGEPv2 platform - if you are following this tutorial and have an IGEPv2, consider using http://wiki.jmaustin.org/wiki/IgepSGXUbuntu instead

SDK unPackage Script
Download the latest version of the "create_sgx_package.sh" script http://bazaar.launchpad.net/~beagleboard-kernel/%2Bjunk/2.6-stable/annotate/head:/create_sgx_package.sh (click: download file)



Make script executable chmod a+x ./create_sgx_package.sh

Run script ./create_sgx_package.sh

After Successfully running:

GFX_Linux_SDK.tar.gz                           : -> Copy to Beagle (DEMO's) OMAP35x_Graphics_SDK_setuplinux_3_01_00_07.bin SDK SDK_BIN

Beagle: GFX_*_libs.tar.gz
tar xf GFX_3_01_00_07_libs.tar.gz (extracts install-SGX.sh and run-SGX.sh) ./install-SGX.sh (copies necessary SGX libs and startup script) ./run-SGX.sh (force run the new init script, or you can just reboot...)

On Successful install: Stopping PVR Starting PVR Starting SGX fixup for ES2.x (or ES3.x) (or ES5.x xM)

Reboot for good measure (Maverick's Alpha-1 needs this....) sudo reboot

Beagle: GFX_Linux_SDK.tar.gz
tar xf GFX_Linux_SDK.tar.gz cd GFX_Linux_SDK tar xf OGLES.tar.gz

Test SGX with a DEMO
cd OGLES/SDKPackage/Binaries/CommonX11/Demos/ChameleonMan ./OGLESChameleonMan

Trouble Shooting
sudo rm /etc/powervr-esrev sudo depmod -a omaplfb sudo /etc/init.d/pvr restart

DSP
This is still a major work in progress...

Here is one approach: BeagleBoard Ubuntu & DSP From Sources

Xorg omapfb Drivers
By default Ubuntu will try to use the FBDEV video driver, however for the beagleboard we can take advantage of a more software optimized driver (still not using the sgx video hardware) using the NEON extensions of the Cortex-A8 core.

cat /var/log/Xorg.0.log | grep FBDEV (II) FBDEV: driver for framebuffer: fbdev (II) FBDEV(0): using default device (II) FBDEV(0): Creating default Display subsection in Screen section (==) FBDEV(0): Depth 16, (==) framebuffer bpp 16 (==) FBDEV(0): RGB weight 565

Login into Ubuntu and open a new terminal, xorg has to be running..

xvinfo -display :0.0 X-Video Extension version 2.2 screen #0 no adaptors present

Drivers
Note: These are built with neon optimizations: http://git.debian.org/?p=collab-maint/xf86-video-omapfb.git;a=blob;f=debian/rules;h=c2f0d5391c96c5abb60b1e691ad86bb27e0c17d8;hb=HEAD (line 48/49)

Lucid: sudo apt-get install xserver-xorg-video-omap3

To verify it was correctly installed, reboot and:

cat /var/log/Xorg.0.log | grep omapfb (II) LoadModule: "omapfb" (II) Loading /usr/lib/xorg/modules/drivers//omapfb_drv.so (II) Module omapfb: vendor="X.Org Foundation" (II) omapfb: Driver for OMAP framebuffer (omapfb) and external LCD controllers: (WW) Error opening /sys/devices/platform/omapfb/ctrl/name: No such file or directory (II) omapfb(0): VideoRAM: 1800KiB (SDRAM) (II) omapfb(0): Creating default Display subsection in Screen section (**) omapfb(0): Depth 16, (--) framebuffer bpp 16 (==) omapfb(0): RGB weight 565 (==) omapfb(0): Default visual is TrueColor (--) omapfb(0): Virtual size is 1280x720 (pitch 1280) (**) omapfb(0): Built-in mode "current" (==) omapfb(0): DPI set to (96, 96) (II) omapfb(0): DPMS enabled (II) omapfb(0): Video plane capabilities: (II) omapfb(0): Video plane supports the following image formats: (II) omapfb(0): XVideo extension initialized

Login into Ubuntu and open a new terminal, xorg has to be running..

xvinfo -display :0.0 X-Video Extension version 2.2 screen #0 Adaptor #0: "OMAP XV adaptor" number of ports: 1 port base: 56 operations supported: PutImage supported visuals: depth 16, visualID 0x21 number of attributes: 1 etc..

S-Video
S-video is tested to be working on 2.6.35-rc5-dl9. S-video output can be enabled using bootargs at uboot as mentioned below.

NTSC
omapfb.mode=tv:ntsc omapdss.def_disp=tv

Bootargs that has been validated.

setenv bootargs 'console=tty0 console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootwait ro vram=12M omapfb.mode=tv:ntsc omapdss.def_disp=tv fixrtc buddy=unknown'

Note that the NTSC resolution is 640x480. However the edge bands around the TV screen differ from TV to TV. Output of fbset shown below, which does not seem right.

mode "720x482-30" # D: 13.500 MHz, H: 15.734 kHz, V: 29.970 Hz        geometry 720 482 720 482 32 timings 74074 16 58 6 31 64 6 rgba 8/16,8/8,8/0,0/0 endmode

PAL
I do not have PAL tv, most likely changing above to omapfb.mode=tv:pal should work. Someone with access to PAL tv please check and update.

Building Kernel
https://launchpad.net/~beagleboard-kernel

Register on launchpad.net, install bzr sudo apt-get install bzr

Download SRC bzr branch lp:~beagleboard-kernel/+junk/2.6-stable

Build Kernel ./build_kernel.sh

Optional Building Deb File ./build_deb.sh

= Ubuntu Software =

Midori
Given that the BeagleBoard has fewer resources than a desktop a light weight browser is more responsive. Midori is a light weight browser that still supports flash etc It is available from the standard repositories. http://en.wikipedia.org/wiki/Midori_%28web_browser%29

Motion
If you have a video source (webcam, IP cam etc) which appears as /dev/video0 etc then you can use the Linux Surveillance software "motion" to monitor the video stream and record periods of activity.

Motion is also available from the standard repositories. http://www.debian-administration.org/article/An_Introduction_to_Video_Surveillance_with_%27Motion%27 Using a 960x720 resolution webcam with 15 fps rate under the UVC driver the Rev C BeagleBoard under Xubuntu reports ~60% CPU utilisation.

To make the BeagleBoard automatically start recording on boot do the following:


 * Auto Login - run "gdmsetup" from a terminal and select a user to automatically login
 * Sessions - make sure you don't save any previous xwindows sessions so that it doesn't prompt you for which one you want
 * motion.conf - amend /etc/motion/motion.conf to the settings you want (ie video output directory, record only video, record in mpeg4, set frame rate etc). Do this with "sudo medit /etc/motion/motion.conf" at a prompt.
 * Boot script - create a new script in /etc/rc2.d called "S65motion_client" and set permissions appropriately ("sudo chmod 777 /etc/rc2.d/S65motion_client"). Then edit the file so it has the following text in it:

/usr/bin/motion -c /etc/motion/motion.conf
 * 1) ! /bin/sh

This will now launch the motion client as root when you boot up.

Also note that unless your BeagleBoard can remember the time (battery backed up clock installed) the timestamps will not be correct until you update the time. If your BeagleBoard has an Internet Connection this can be achieved with the ntpdate app.