Maemo Getting Started

This page has some details of getting Maemo 5.0 (code name Fremantle) to run on non Nokia (N900) devices. These instructions are based on the ones from Maemo 5.0 alpha on BeagleBoard page and updated for Maemo 5.0 final version. Changes done to Maemo 5.0 port is an updated sources.list & packages list with a busybox rebuild.

=Maemo 5.0 SDK and Scratchbox=

To be able to build the root file system (rootfs), Maemo 5.0 SDK and Scratchbox has to be installed.


 * For install and setup visit Maemo 5 Final SDK Installation page.
 * Download both SDK and Scratchbox from Maemo 5 SDK page.

Follow the installation instructions and install SDK and scratchbox.

After this, accept the EULA and get access to the closed binary repository.

Note down your token (note: Don't copy the complete link. Only the token)

=Maemo 5.0 Kernel=

Currently, Maemo 5.0 uses a heavily patched 2.6.28 kernel. To run Maemo 5.0 on your board, you need a special kernel, e.g. with SGX support.

The original N900 kernel can be found in Maemo5 respository.

=Environment= The files needed to complete this setup are available at Maemo Garage:OMAP_Maemo_environment.tar.gz The files included are listed below:


 * Scratchbox build scripts for both Zoom2 and Beagle
 * Zoom2: uImage, uboot.bin, MLO and kernel modules
 * Beagle: uImage and kernel modules
 * Complete package version list

However if you wish to rebuild the bootloader and kernel for Zoom2/Beagle yourself please feel free to follow the instructions below.

ARM Cross Compiler
Refer to OMAP Platform Support Tools section for more information regarding Cross Compiler download and installation. Note that the 2008q3 compiler is required in order to do the modules build. The issue is in the DSP patch. The 2009q3 compiler checks all the options of #if...#elif...#end, even after it finds a clause which evaluates to true, whereas the 2008q3 compiler is satisfied once it has found a true clause.

Bootloader
u-boot $ cd maemo_env $ mkdir bootloader $ cd bootloader $ git clone git://git.omapzoom.org/repo/u-boot.git $ cd u-boot/ $ git checkout -b maemo_uboot 5589e8145624d6ad06414b5704ea1e0354b063b8

x-loader $ cd maemo_env/ $ git clone git://git.omapzoom.org/repo/x-loader.git $ cd x-loader/ $ git checkout -b maemo_xloader cfb391293e15cf4685ef9029933a4ea1ea621be0

Building uboot and x-loader $ cd maemo_env $ cd bootloader/u-boot/ $ make distclean $ make CROSS_COMPILE=arm-none-linux-gnueabi- omap3430zoom2_config $ make CROSS_COMPILE=arm-none-linux-gnueabi-
 * 1) u-boot.bin is located in maemo_env/bootloader/u-boot/
 * 2) Note: add maemo_env/bootloader/u-boot/tools to PATH directory prior to building kernel

$ cd maemo_env $ cd bootloader/x-loader/ $ make distclean $ make CROSS_COMPILE=arm-none-linux-gnueabi- omap3430zoom2_config $ make CROSS_COMPILE=arm-none-linux-gnueabi- ift
 * 1) MLO is located in maemo_env/bootloader/x-loader

MLO and u-boot.bin should be installed on boot sector of SD card or added in tftp directory when using NFS. For more information on u-boot and x-loader visit: Bootloader Project

Kernel
Pulling lo-sync kernel for zoom2

$ mkdir -p maemo_env/patches $ cd maemo_env $ git clone git://dev.omapzoom.org/pub/scm/integration/kernel-omap3.git $ cd kernel-omap3/ $ git checkout -b zoom2_maemo_branch 2a4c3983e4b07437c6989bb788b29a7a1a150fa5

gst-dsp

gst-dsp is opensource project provided by Felipe Contreras. It is currently hosted at http://gitorious.org/~felipec/linux-omap/felipec. Please feel free to join this project at http://groups.google.com/group/gst-dsp. The patch provided below was created based off of the dspbridge-0.1 branch. It was then merged with lo-sync 2.6.31-rc7 (see commit id above) kernel.

Added SGX and gst-dsp support for kernel:

$ cd maemo_env/ $ cp patches/zoom2_kernel_fix.patch kernel-omap3/ $ cd kernel-omap3/ $ patch -p1 < zoom2_kernel_fix.patch

Enable Modules for 2.6.31 for SGX Graphics and DSP
 * Enable  PowerVR Services

$ cd maemo_env/kernel-omap3 $ make omap_zoom2_defconfig $ make menuconfig Device Drivers ---> Graphics support--->  PowerVR Services --->
 * 1) exit and save changes


 * Enable  DSP Bridge driver (should be set by default)

$ cd maemo_env/kernel-omap3 $ make omap_zoom2_defconfig $ make menuconfig Device Drivers --->  DSP Bridge driver --->
 * 1) exit and save changes

Building Zoom2 Kernel and modules $ cd maemo_env $ mkdir 2.6.31_modules $ cd kernel-omap3/ $ make CROSS_COMPILE=arm-none-linux-gnueabi- uImage $ make CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=/2.6.31_modules modules $ make CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=/2.6.31_modules modules_install

The makefiles are sensitive to the form of . So, for example, ~/maemo_env will not do, it has to be /home/user/maemo_env. Otherwise one of the rules in maemo_env/kernel-omap3/scripts/Makfile.fwinst will complain that targets do not match patterns. The pattern is derived by substitution of INSTALL_MOD_PATH. So, in the example, the target will come to /home/user/maemo_env/... and the pattern therefore needs to start with /home/user as well.

uImage can be found at arch/arm/boot/ and it should be installed on boot sector of SD card or added in tftp directory when using NFS. For more information on kernel and kernel modules visit: Building Kernel for Zoom2

Beagle
Carsten Valdemar Munk provides a 2.6.28 kernel for BeagleBoard with the patches needed for Maemo5. It is an OMAP PM kernel with BeagleBoard patches on top, as well as few patches to get Nokia SGX module going. This is available in source and as precompiled binary.

Source
The kernel is available at gitorious. Check it out using git

git clone git://gitorious.org/maemo5-sgx-beagle/maemo5-beagle-cvm.git maemo5-beagle-kernel

For configuration use defconfig.

Note: Answer 'm' to the PVR module when doing make oldconfig.

Note: For Beagle, you might want to disable CPU frequency scaling and CPU idle PM support. Most probably Beagle will never by run from battery. And there are some reports that it improves stability to disable this.

Binary
A compiled kernel (e.g. from above) is available within the environment files. Copy uImage to boot partition of your Beagle SD card (where e.g. mlo and u-boot.bin are located, too), and extract modules to your root file system (see below how to create it).

Note: This kernel has CPU frequency scaling and CPU idle PM support enabled.

=Rootfs=

This section will describe the steps to create a rootfs on SD card. For Zoom2 NFS is also available and has been tested to work with this environment. For information on how to set up NFS for Zoom2 visit: Zoom Flashing

Generating a rootfs
A root file system creation script make_rootfs.sh is used to create the rootfs to be put on the SD card. This script can be used to create a root file system from given packages. It will automatically pull all the package dependencies to the configuration. Below you will need the following files. Refer back to Environmentfor location of files


 * make_rootfs.sh
 * sources.list
 * packages

The make_rootfs.sh script has to be run inside Scratchbox and it will modify the current target:

$ sb-conf st maemo-beagle -c cs2007q3-glibc2.5-arm7 \ -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb
 * 1) create a new target named 'maemo-beagle'

$ sb-conf se maemo-beagle $ /scratchbox/login
 * 1) select the new target

[sbox-maemo-beagle: ~/ ] > mkdir rootfs; cd rootfs
 * 1) create a directory for building the rootfs

Copying files to scratchbox env

Note: this is done outside of scratchbox environment

$ cp make_rootfs.sh /scratchbox/user/ /home/ /rootfs $ cp sources.list /scratchbox/user/ /home/ /rootfs $ cp packages /scratchbox/user/ /home/ /rootfs

For more information regarding scratchbox environment visit: http://www.scratchbox.org/

Modify the sources.list file to include your closed binary token from above. For this, edit sources.list and replace YOURTOKEN by the token noted down above.

[sbox-maemo-beagle: ~/ ] >vim source.list deb http://repository.maemo.org/ fremantle//nokia-binaries
 * 1) the maemo 5 alpha closed binary repository (MODIFY THIS LINE)

Now, you can run the rootfs script:

[sbox-maemo-beagle: ~/rootfs ] > fakeroot ./make_rootfs.sh
 * 1) run the rootfs script

Opps Build Fails:

[sbox-maemo-beagle: ~/rootfs] > fakeroot ./make_rootfs.sh /scratchbox/tools/bin/fakeroot:\ line 185: ./make_rootfs.sh: No such file or directory

There currently is an issue with the make_rootfs.sh file. Thanks to Jarkko and Linamm for pointing this out and for finding a quick solution. Run the following then retry the build:

dos2unix make_rootfs.sh

Now be patient!

If everything goes ok, you should get a tarball image-rootfs.tgz that contains the root file system for your device

Note: If you run into an error relating to opt, remove /targets/maemo-beagle/opt by some means.

Installing the rootfs
Once you have created the root file system tarball, it is time to untar it to your SD or NFS directory.

Note: It is important to untar the root file system with numeric owner info since otherwise tar will use the uid/gid of your host for certain system services like dbus.

$ cd /media/rootfs $ sudo tar -x --numeric-owner -f image-rootfs.tgz

Installing kernel modules
If you use pre-compiled kernel (e.g. from above), extract it in root of rootfs to have the kernel modules in place. If you compiled your own kernel, copy modules into rootfs.

Installing Zoom2 modules in rootfs

$ sudo cp -rf lo_sync_kernel/2.6.31_modules/* /lib/modules/

Patching of configuration files
Apply the zoom2_rootfs.patch or beagleboard.patch and install it in root of rootfs by

$ patch -p1 < zoom2_rootfs.patch


 * Notes: zoom2's patch will add sgx, pulseaudio and touch support. Beagle's patch will just add sgx support.

Adding gst-dsp support
Pulling gst-dsp plugin

gst-dsp plugin can be found at: http://github.com/felipec/gst-dsp copy this into your scratchbox directory

$ git clone git://github.com/felipec/gst-dsp.git $ cd gst-dsp $ git log $ git checkout -b gst-dsp-test 32db91b0716c9c771c35ecbd8b02b28422644492 $ cp -rf gst-dsp /scratchbox/users/ /home/ /
 * 1) setup is based on commit 32db91b0716c9c771c35ecbd8b02b28422644492
 * 2) if commit does not match rebase to this commit id using the following command:

building plugin in scratch box $ /scratchbox/login/ [sbox-maemo-beagle: ~/ ] > sb-menu Select FREMANTLE_ARMEL [sbox-FREMANTLE_ARMEL: ~] > cd gst-dsp [sbox-FREMANTLE_ARMEL: ~] > dpkg-buildpackage -rfakeroot -us -uc -b build.
 * 1) there is a possiblity that this step will require some more packages to be install first. Just install them from within the scratchbox setup and rerun the

Moving libgstdsp.so to rootfs $ cp /scratchbox/users/ /home/ /gst-dsp/libgstdsp.so /usr/lib/gstreamer-0.10/

Copying DSP Socket Nodes to rootfs

DSP socket nodes are available for download at: tiopenmax-0.3.5.tar.gz. Run the install script and place them in a directory in the host. Then add the dummy.dll64P from the gst-dsp directory. $ cp -rf /lib/dsp/ /lib/ $ cp /scratchbox/users/ /home/ /gst-dsp/dsp/dummy.dll64P /lib/dsp/

Start target
$ sync $ umount your finished SD card

boot target into U-Boot and press any key to stop count down.

Configuring kernel command line
At U-Boot set kernel command line (bootargs):

Zoom2
OMAP34XX ZOOM2 # setenv bootcmd 'mmcinit;fatload mmc 0 0x81c00000 uImage;bootm 81c00000' OMAP34XX ZOOM2 # setenv bootargs console=ttyS3,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 mem=256M init=/sbin/init \ omap_vout.vid1_static_vrfb_alloc=y
 * SD option:

Note: SD tends to run a bit slower. Background desktops images may not appear at time and may require a reboot.

Visit:SD Configuration for more information on how to format a SD card for a Zoom2 device. Also visit: Flashing using a SD for more information on how to load u-boot, x-loader, and uImage to a SD formated card.


 * NFS option:

OMAP34XX ZOOM2 # setenv bootargs console=ttyS3,115200n8 nointrd,rw root=/dev/nfs rw nfsroot=:\ / init=/sbin init ip=dhcp mem=256M

Visit: NFS Setup on Zoom2 for more instructions on how to load uboot, xloaded, and uImage using tftp. Above is an example of the bootargs used for NFS.

Beagle
console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait omapfb.mode=dvi:800x600MR-24@60

Reboot
Reboot your board and enjoy Maemo5

login = root password = rootme

Zoom2 additional settings:
adjusting audio

amixer is no longer available when pulseaudio is installed. However alsa has been routed to pulseaudio so alsamixer should be used to select output. Note: sound can be heard from headset port as well as speakers. omapzoom2# alsamixer -c 0 +--[AlsaMixer v1.0.20 (Press Escape to quit)]--+ <                                                           |  |              > <                                                            |::|              > <                                                            |::|              > <                                                            |::|              > <                                                            |::|              > <                                                            |::|              > +--+ Move over to Handsfree and enable it by pressing "M" Select AudioL2 and AudioR2 for speaker output Press Esc to exit alsamixer menu
 * Card: Zoom2                                                                 |
 * Chip:                                                                       |
 * View: [Playback] Capture All                                                |
 * Item: HandsfreeL Switch                                                     |
 * Off   109/81/5  AudioL2           AudioR2              |::|              |
 * |OO|              |OO|              |MM|     |
 * 67<>67            |
 * HIFI Pla HS ramp  HandsfreHandsfre  Handsfre Headset  HeadsetL   |
 * |OO|              |OO|              |MM|     |
 * 67<>67            |
 * HIFI Pla HS ramp  Handsfre<Handsfre>Handsfre  Handsfre Headset  HeadsetL   |
 * HIFI Pla HS ramp  Handsfre<Handsfre>Handsfre  Handsfre Headset  HeadsetL   |

gst-dsp on Zoom2

Run the following command in order to get this options working. omapzoom2# cd /lib/modules/2.6.31-rc7-omap1-06733-g6af1d84-dirty/kernel/drivers/dsp/bridge/ omapzoom2# insmod bridgedriver.ko base_img=/lib/dsp/baseimage.dof omapzoom2# /usr/bin/gst-launch-0.10 playbin2 uri=file:///<path-to-media-files>

=Status=

Status from 11-05-2009:


 * Beagle: System boots and shows "water" background on attached DVI monitor. Mouse or keyboard can "wake" screen saver.

Status from 1-14-2010:


 * Zoom2: Maemo UI is up and running. Touch screen is working.
 * At startup we see time when the display does not show. Reset the device and reboot. (may take a few tries) Do not press anything on the terminal until UI is up and running.
 * Audio play back was tested using *.wav file. Both aplay and paplay are functional in environment.
 * Video update:

Zoom2 working with Mameo UI over NFS with touch and gst-dsp enabled

=Known issues=

Zoom2
 * latest Maemo update may cause Zoom2 not to work properly. To avoid this make sure that the following are added to your packages list in scratchbox environment:


 * remove xomap and replace it with
 * xserver-xomap=2:1.6.99.1-0osso20090208.95+0m5
 * Downgrade xserver-xorg-core
 * xserver-xorg-core=2:1.6.99.1-0osso20090208.95+0m5


 * Using SD does not show all four screen backgrounds.
 * reboot system and give it some time to startup

Beagle
 * "Screen saver" blanks the screen after ~1min and disables the screen. Workaround: Attached USB mouse or keyboard does "wake" it again if pressed/moved.


 * No mouse cursor available yet. The trick from alpha version to make mouse cursor visible doesn't work any more in Maemo5 final version (some applications like tuxpaint draw a mouse cursor and can be started from the command line)


 * Mouse isn't working and jumps randomly around when being moved (looks like a protocol mismatch)

=FAQ=

Garbage at serial console
Q: Trying to type at serial console, I get some garbage characters. I have problems to type anything. The serial console seems to work during the boot phase but it gets garbage later.

A: This is an OMAP power management kernel issue (mentioned in OMAP-PM wiki). First character is garbage after some idle time and it may need some trying to get it wake up (?) properly to get the serial console working with only that one garbage character instead of just garbage. There are two workarounds for this (depending on your target):


 * To stop the garbage on the console when left idle is to change the sleep timeout (E.g. make it an hour or 3600 seconds) by:


 * 1) echo 3600 > /sys/devices/platform/serial8250.0/sleep_timeout


 * For Beagle only, use Till's kernel that has CPU frequency scaling and CPU idle PM support disabled. Note: As Beagle is never powered from battery, it should be fine to disable these power management components.

Instable kernel
Q: The Beagle device tends to reset/reboot after a few minutes of being idle. Also it then doesn't reboot but hangs in/after TIs X-loader and before U-Boot.

A: For Beagle only, try to use Till's kernel that has CPU frequency scaling and CPU idle PM support disabled. Note: As Beagle is never powered from battery, it should be fine to disable these power management components.