Meego Wiki
Views

ARM/Meego on Beagleboard from scratch

From MeeGo wiki
< ARM
Jump to: navigation, search

This document describes how to create a MeeGo image for the beagleboard. More information regarding MeeGo on the Beagleboard can be found at ARM/Meego_on_the_Beagle.

[Youtube video of BeagleBoard running MeeGo handset UX]

Contents

Introduction

Tested distros

Creating this image has been tested on Ubuntu 10.04, other distros may require some things to be done differently. Several people have tried and failed to make this work on Ubuntu 9.04 and Ubuntu 9.10. It is recommended to use Ubuntu 10.04, if you want the best chance of success. Conversely, if you have made this work for other versions of Ubuntu or other distros, please add to this page any information that will help others achieve the same success.

  • Debian Lenny (you'll need to install some packages from Sid and you'll need to build some software.)

This is a work in progress. However, if you think these instructions are incomplete or lack some important aspect, feel free to edit this page or ask for help on IRC in #meego-arm on irc.freenode.net.

What works, what remains to do

Please keep in mind that MeeGo is a work in progress. Things which already worked may be broken again and you might not end up with a working setup even though you followed the instructions precisely. Everything up to the running TI demos will likely be stable, but the MeeGo UI itself is still broken every now and then.

Working:

  • System boots into command prompt
  • Xserver starts
  • xterm/twm are working incl. mouse, keyboard and touchscreen
  • SGX/GLES loads
  • TI 3D demo apps run
  • QT demo apps run
  • MeeGo handset UX works with touchscreen
  • MeeGo ivi UX works with mouse/touchscreen
  • GUI is actually usable, but very slow since the device keeps swapping
  • Audio works
  • Known working on Ubuntu 10.04 only

Todo:

  • Make mouse cursor visible under MeeGo HX for users without touchscreen
  • Improve overall usability by e.g. reducing memory usage
  • Definitive works / does not work on other distros and other versions

Supported BeagleBoard versions

The RevA and RevB board come with 128MB RAM only. This is not enough for the handset UX. With swap enabled the UX boots, but is barely usable. The IVI UX may work better, since it seems to require less memory. Everything else works. Tested board revisions: B7

The RevC boards are the best choice at this moment as their hardware is fully supported by the linux kernel and since their 256MB RAM allow for fluid UX experience. Tested board revisions: C4

The XM RevA boots into handset UX and is very fast and responsive. The stock kernel doesn't yet fully support this board (CPU only runs at ~500Mhz, audio doesn't work etc). Tested board revisions: XM-A2

Prerequisites

This document assumes that you have worked with the beagleboard before and e.g. know how to format a memory card to boot from.

If you are new to BeagleBoard you will want to learn the basics using the following resources:

Setup for the Beagleboard usually consists of the following three things:

  • A rootfs image / directory tree
  • A kernel image (uImage)
  • A set of kernel modules

The rootfs and the kernel modules go onto the second partition on the memory card which for MeeGo should be newly ext3 formatted. The kernel goes onto the first partition which is FAT formatted and should aready contain MLO and u-boot.bin.

Please use a memory card of at least 2GB size for the following experiments. The boot partition should only be a few megabytes of size (10MB will do fine). And the remaining space should be ext3 formatted.

If you prefer to boot xloader and u-boot from on-board flash (nand), you might need to update them. A very convenient way to do this is to follow these instructions.

Prepare SGX/GLES libs

The beagleboard can do accelerated 3D and MeeGo will finally make heavy use of this. Therefore it's vital to get this running. A script named create_sgx_package.sh can be found here. Please download it.

Since the SGX drivers are partially TI closed source, you'll have to register and download the file OMAP35x_Graphics_SDK_setuplinux_3_01_00_06.bin from TI's GFX SDK download page.

Put both files in the same directory and then run the script:

./create_sgx_package.sh

This will extract the file you just downloaded and build packages suitable for linux from it. One of the resulting files is named GFX_3_01_00_06_libs.tar.gz. You will need this when building the rootfs.

The second file generated by the script is named GFX_Linux_SDK.tar.gz. This contains various code examples and 3D demo applications. You may want to take a look at these later.

Build the rootfs

Let's start with building the rootfs. This is automatically assembled from various pre-compiled packages available from the MeeGo arm repositories. The tools to assemble the rootfs is called mic (MeeGo image creator). Follow the instructions at Image_Creation#From_Development_Git_Tree to install the latest version from git. Older versions will probably not work.

When using ubuntu 10.04 you'll need to install qemu using the qemu-kvm-extras-static package. If you have an existing scratchbox setup, this will collide with qemu-kvm-extras-static. After installing that package scratchbox arm will not work anymore. Removing that package and restarting the scratchbox services makes scratchbox work again.

The kickstart file we'll be using is a slightly modified version of the n900 one found here.

Download File:Handset-armv7l-beagle.ks for the handset UX or File:Ivi-armv7l-beagle.ks for the in vehicle infotainment (ivi) UX. Unfortunately, this wiki makes the first character of a filename uppercase. Therefore you have to rename the file from Handset-armv7l-beagle.ks (or Ivi-armv7l-beagle.ks) to handset-armv7l-beagle.ks (ivi-armv7l-beagle.ks). Make sure the previously generated GFX_3_01_00_06_libs.tar.gz is also in the current directory as the kickstart file will use this to add support for accelerated 3D to the image.

Then type (replace handset by ivi if you are using the ivi kickstart)

sudo mic-image-creator --run-mode=0 --cache=mycachedir --format=loop --arch=armv7l --release=daily  --compress-disk-image=none --config=handset-armv7l-beagle.ks 

to build the rootfs image in your current directory. This may take very long and will download several hundred megabytes to your harddisk.

Afterwards, the entire file system will be present as a file system image under

./daily/handset/images/meego-handset-armv7l-beagle/meego-handset-armv7l-beagle-daily.img

The resulting image can be mounted via loopback and the contents then rsync'ed to the card.

mkdir ./image
sudo mount -o loop ./daily/handset/images/meego-handset-armv7l-beagle/meego-handset-armv7l-beagle-daily.img ./image
sudo rsync -aHx --progress --delete ./image/* /media/<your cards root partition>

This will put everything but the kernel and the kernel modules onto the card.

Build the kernel and kernel modules

You need to compile the new kernel and thus need a working cross compiler for arm first.

Arm cross compiler

The cross compiler needed to build the kernel for the omap3 of the beagleboard can be obtained in different ways.

Re-use compiler installed with scratchbox

The easiest way is probably to re-use one that has already been installed. If you have a working scratchbox setup, then you also have working arm compilers you can re-use from outside scratchbox. On my setup this gcc was installed under /opt/maemo/tools/arm-2007q3/bin/ (the arm-2xxx part may be different in your setup if you use a different version of the scratchbox environment).

Be careful as this compiler may be too old to support arm in the way required to build a recent kernel. The version should at least be 2009q1 (the one mentioned above is thus indeed to old). The kernel build process will also warn you if the compiler is too old.

Use binary package from codesourcery

If you don't want to use the scratchbox compiler, or don't have a scratchbox setup or if the installed compiler is too old, you can install the Codesourcery arm toolchain.

Just download that package, unpack it somewhere and add the bin directory contained in this into your path environment variable and build the kernel.

Download and build the kernel

The compiler and linker are now installed and you can start downloading and compiling a kernel. A very convenient way to do so is the to use the Beagleboard kernel scripts. Make sure to have the bazaar tool installed and then type:

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

For the beagleboard XM you'll need the latest development kernel. Use the following command to download the tools to build that kernel:

bzr branch lp:~beagleboard-kernel/+junk/2.6.35-devel

In the resulting directory copy system.sh.sample to system.sh and adjust the line specifying the compiler. If your user name is "test" and you are using the codesourcery compiler, then this line might have to look like this:

CC=/home/test/arm-2009q1/bin/arm-none-linux-gnueabi-

If you are using the 2.6.35-devel version you'll also have to enable the git line and set the LINUX_GIT variable to point to a 2.6-stable directory within your current path. You can comment the git line once you've successfully pulled the kernel.

Finally type

./build_kernel.sh

This will download and build the kernel.

Customize kernel configuration

You'll be shown the kernel configuration screen during the previous script run. You can just quit this screen pressing ESC twice and continue building the default kernel.

However, you may want to customize your kernel.

Reducing reserved video memory

Especially when you are intending to use the kernel on a RevB board and you know that your screen resolution is 800x600 or lower, then you can save 12MB RAM by reducing the video RAM buffer at

Device Drivers ---> Graphics Support ---> OMAP2/3 Display Subsystem support (EXPERIMENTAL)  ---> VRAM size (MB) 

to 2 MB.

Be careful to adjust boot.cmd/boot.scr settings if necessary. If your boot.cmd contains some vram setting you need to adjust this to reflect (not exceed!) your new video ram size. On my setup i am using the following line:

vram '2M omapfb.vram=0:2M,1:0M,2:0M'

This puts the entire 2M to the first video buffer and gives none to the second and third done.

If your boot.cmd does not contain anything related to the video memory size at all, that's fine also.

Other kernel versions

If you intend to build a different version of the (2.6-)kernel, update the checked out scripts, e.g.

bzr up -r tag:<tagname>

You can see a list of all available tags as follows:

$ bzr tags
[...]
2.6.33.3-x1          78
2.6.33.3-x2          82
2.6.33.4-x3          84
2.6.33.5-x3          85
2.6.33.x-end         85
2.6.34-x1            90
2.6.34.1-x2          96
$

(tagnames correspond to the kernel releases/patch levels)

Install kernel and modules

The resulting kernel image is placed in the "deploy" directory. Copy kernel and modules to your memory card:

cp deploy/2.6.34.1-x2.uImage /media/<your cards boot partition>/uImage
tar xvfz /home/test/2.6-stable/2.6.34.1-x2-modules.tar.gz -C /media/<your cards root partition>

Run the MeeGo handset UX

The card should now be able to boot into a command prompt and the MeeGo handset UX should appear on the screen. You can stop here if everything works as expected. The following sections may be helpful to sort things out if something doesn't work.

Start ordinary X applications

The handset UX cannot be used to launch ordinary X applications or to run the 3D demos provided by TI. Instead a classic window manager like twm is needed for this.

To prevent the handset UX from launching and to start twm instead, comment the last line in /etc/sysconfig/uxlaunch on your card and add one to start the twm window manager and an xterm instead:

#session=/usr/bin/mcompositor
session=/usr/bin/twm-session

Booting with your card should now give you a twm window manager and an xterm. A mouse and keyboard might be useful from now on. Both should be working out of the box.

Starting X programs from the serial console

If you have a keyboard and mouse you can skip this section. If you don't have a keyboard connected and want to run X programs from the console, you need to log in as root and become the meego user as the root user isn't allowed to access the screen which belongs to the meego user:

[root@localhost ~]# su meego
[meego@localhost root]$ export DISPLAY=:0
[meego@localhost root]$ xeyes

Run the TI demos

If you to run the TI demos you can also copy the contents of the file GFX_Linux_SDK.tar.gz also generated by create_sgx_package.sh into /home/meego on your memory card.

As the user meego (use xterm or see previous section) untar any of the demo files OGV.tar.gz, OGLES.tar.gz and OGLES2.tar.gz. All of these contain some path containing X11 binaries like e.g. OGLES/SDKPackage/Binaries/CommonX11/Demos which in turn contains ready to run binaries.

Have fun!

Remark: The error message "PVRShell: Unable to create surface." when starting one of the demos may indicate that the config file /etc/powervr.ini is missing. If so, create the file e.g. using vi

vi /etc/powervr.ini

Set the contents to

[default]
WindowSystem=libpvrPVR2D_LINUXFBWSEGL.so

There are different versions of libpvr<XXX>.so available, the one to choose might vary depending on the setup. Following the steps described here, the one stated above worked out fine.

Enable swap memory

The revA and revB versions of the original beagleboard come with 128MB RAM. This isn't enough for complex applications and we thus need to add swap space. Even the 256MB RAM on the newer revC boards might not be enough when running several applications in parallel. Thus even these boards should be setup with swap memory. The beagleboard xm comes with 512MB RAM and will do fine without swap enabled, although adding swap memory doesn't hurt.

Note, that the N900 comes with 256MB of RAM and a 768KB swap area, so the Rev C beagleboard is roughly comparable if a swap space is setup.

First we have to add the swap partition to the memory card. gparted is a nice tool to do this. You'll likely have to shrink your root partition on the card. I freed up 500MB at the end of the card and created a linux swap partition in it.

[root@localhost ~]# fdisk /dev/mmcblk0

Command (m for help): p

Disk /dev/mmcblk0: 4005 MB, 4005560320 bytes
255 heads, 63 sectors/track, 486 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0001efd7

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *           1           6       48163+   c  W95 FAT32 (LBA)
/dev/mmcblk0p2               7         421     3333487+  83  Linux
/dev/mmcblk0p3             422         486      522112+  82  Linux swap / Solaris

MeeGo is already configured to make use of this automatically.

QT demos

You can either run the qtdemo application which will give you some simple fullscreen GUI to launch the demos. Or you can launch them manually as they are all placed under /usr/lib/qt4/demos. Some of these need much memory, so setup of swap memory is required.

Start the MeeGo handset UX

With PVR being enabled on boot time and with enough virtual memory, you can now re-enable the MeeGo window manager mcompositor in /etc/sysconfig/uxlaunch.

At this point i made a silly mistake: I still had the TI 3D demos stored under /home/meego. The full MeeGo UX will start tracker in order to scan for media files in /home/meego. Having placed ~1GB files there from the 3D demos made tracker run at 100% CPU load in the background. To avoid this you'll have to make sure that there's not much more than the example Picture files under /home/meego. I moved the folder containing the 3D demos to /root, but it should also be possible to move them into a hidden directory (starting with a dot) in /home/meego.

Now reboot and be patient. I'll take a few minutes until you'll see the MeeGo UX.

File:Meego_beagle.jpg

Unfortunately there's no mouse cursor yet, but with a touchscreen the UI is usable. Although the beagleboards 128MB memory is not enough and the device keeps swapping and is very slow.

Peripheral hardware

I have tested various peripheral devices on this setup and most of them are working out of the box.

Custom video settings

You can change the video settings as usual via the kernel command line given via u-boot. The current MeeGo handset UX is mainly being used on devices with 800x480 pixel screen resolution. This is not supported by the mode database of the standard kernel and needs some simple tweaking.

Furthermore, some displays (like mine) need a very specific timing.

The following patch adds a mode with 800x480 pixels with the timing of my display (Toshiba LTA070B220F) to the kernels mode database.

If you want to use this mode, just download File:800x480.patch and place it in the patches directory in the kernel build directory (./patches) and add the following lines near the end of patch.sh:

#dsp

# add local 800x480 patch
echo "Switch default display to 800x480"
patch -s -p1 < ${DIR}/patches/800x480.patch

echo "patch.sh ran successful"

This will add a video mode with 800x480 resolution to the mode database which may even be a good idea if you don't have a display requiring that particular mode. The MeeGo handset and tablet UXs are likely to be made for this resolution, so it makes sense to use it, anyway.

To use the resolution you have to specify it on the kernel command line (e.g. in boot.cmd/boot.scr) as '800x480-16@60'.

Another way to achieve this resolution change is to stop u-boot (press a touch during the waiting time at the boot) and set the 'dvimode' environment variable at value '800x480-16@60'. Hereafter are the commands you have to enter at the u-boot prompt:

OMAP3 beagleboard.org # set dvimode 800x480-16@60
OMAP3 beagleboard.org # saveenv

On the same way, it is possible to reduce the waiting time at the beginning of the boot with a new value assignment on the variable 'bootdelay'.

USB hubs, mice and keyboards

These just work, nothing to configure.

Bluetooth keyboard

My CSR bluetooth dongle works out of the box. Hcitool is present to scan for devices as well as hidd to connect to bluetooth HID devices. This has been tested with a bluetooth keyboard.

Touchscreen

My 7 inch egalax based touchscreen worked nearly perfectly out of the box. It was just a little bit mis-calibrated.

The latest hal driven xorg can be given a input configuration file to deal with this. Placing the following file as /etc/X11/xorg.conf.d/50-input-touch.conf in the root partition adusts my touchscreen nicely:

Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "Calibration" "80 1918 133 1863"
EndSection

This configuration is automatically applied to all touchscreen devices that map to /dev/input/event*. You may have to adjust the calibration values match your device.

The current kickstart file includes this file automatically. If you don't have a touchscreen it just isn't used.

Ethernet

A D-Link DUB-E100 ethernet dongle works out of the box and gets an IP address via DHCP. With this network connection i was able to verify that zypper and the package management also work. A "zypper up" successfully updated a few packages.

The beagleboard XM's onboard Ethernet (a SMSC95xx based USB device) also works out of the box.

WLAN

A Ralink RT2501 based USB dongle works, is detected and can scan for networks. But it isn't provided an address via dhcp.

Audio

Audio does not yet work on beagleboard XM.

Audio works on beagleboard revA, revB and revC out of the box, but is muted by default. It can be enabled using the alsamixer tool. Alsamixer does some fancy console graphics and didn't work for me through the serial console. I had to log in from an xterm via ethernet to be able to actually control alsamixer.

You need to be logged in as user meego (not root) and start alsamixer. You'll see one single volume bar. This is the pulseaudio setting. You need to unmute this (press 'M') if it's muted (indicated by 'MM' at the bars bottom. The 'MM' should become green '00'. Also increase volume to max using cursor up if necessary,

Then hit 'F6' and switch to the omap3beagle setup. This is the hardware config. You need to unmute and increase the volume of at least the following entries:

DAC1 Analog
DAC1 Digital Course
DAC1 Digital Fine
Headset
HeadsetL Mixer AudioL1
HeadsetR Mixer AudioR1

File:Alsamixer.png

Entering the following command should now give you an audible output on the headphone jack:

aplay /usr/share/sounds/alsa/Rear_Center.wav 

If you don't hear anything you'll likely have to adjust the omap3beagle settings in alsamixer. Fortunately these settings are automatically saved and restored at system reboot. You thus only need to adjust these once.

Making screenshots

Do you like what you see? Want to share it? Make a screenshot! This doesn't need any special software. Just copy the framebuffer contents into some file:

cp /dev/fb0 screenshot.raw

The resulting file should have a size of exactly 770048 bytes (800x480x2) if you are using a 800x480 display size at 16 bits per pixel.

On your host use ffmpeg to convert this into some standard format like png:

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800x480 -i screenshot.raw -f image2 -vcodec png screenshot.png

File:Beagle-Main.jpg

Related stuff

Personal tools