Maemo Getting Started

From OMAPpedia

Jump to: navigation, search

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.


Contents

[edit] 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.

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)


[edit] 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.


[edit] Environment

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

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


[edit] Zoom2

[edit] 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.

[edit] 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-
# u-boot.bin is located in maemo_env/bootloader/u-boot/
# 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
# 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


[edit] 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

$ cd maemo_env/kernel-omap3
$ make omap_zoom2_defconfig
$ make menuconfig
Device Drivers --->
Graphics support--->
<M> PowerVR Services --->
#exit and save changes


$ cd maemo_env/kernel-omap3
$ make omap_zoom2_defconfig
$ make menuconfig
Device Drivers --->
<M> DSP Bridge driver --->
#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=<path-to-maemo_env>/2.6.31_modules modules
$ make CROSS_COMPILE=arm-none-linux-gnueabi- INSTALL_MOD_PATH=<path-to-maemo_env>/2.6.31_modules modules_install

The makefiles are sensitive to the form of <path-to-maemo_env>. 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

[edit] 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.


[edit] 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.


[edit] 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.


[edit] 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


[edit] 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


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

# create a new target named 'maemo-beagle'
$ sb-conf st maemo-beagle -c cs2007q3-glibc2.5-arm7 \
 -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb
# select the new target
$ sb-conf se maemo-beagle
$ /scratchbox/login
# create a directory for building the rootfs
[sbox-maemo-beagle: ~/ ] > mkdir rootfs; cd rootfs

Copying files to scratchbox env

Note: this is done outside of scratchbox environment

$ cp make_rootfs.sh /scratchbox/user/<username>/home/<username>/rootfs
$ cp sources.list /scratchbox/user/<username>/home/<username>/rootfs
$ cp packages /scratchbox/user/<username>/home/<username>/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
# the maemo 5 alpha closed binary repository (MODIFY THIS LINE)
deb http://repository.maemo.org/ fremantle/<your-token-goes-here>/nokia-binaries


Now, you can run the rootfs script:

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


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.


[edit] 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


[edit] 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/* <path-to-rootfs>/lib/modules/


[edit] 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


[edit] 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
# setup is based on commit 32db91b0716c9c771c35ecbd8b02b28422644492
# if commit does not match rebase to this commit id using the following command:
$ git checkout -b gst-dsp-test 32db91b0716c9c771c35ecbd8b02b28422644492
$ cp -rf gst-dsp /scratchbox/users/<username>/home/<username>/


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
# 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
  build.


Moving libgstdsp.so to rootfs

 $ cp /scratchbox/users/<username>/home/<username>/gst-dsp/libgstdsp.so <maemo-rootfs-dir>/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 <path-to-tiopenmax-0.3.5>/lib/dsp/ <maemo-rootfs-dir>/lib/
$ cp /scratchbox/users/<username>/home/<username>/gst-dsp/dsp/dummy.dll64P <maemo-rootfs-dir>/lib/dsp/

[edit] Start target

$ sync 
$ umount your finished SD card

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


[edit] Configuring kernel command line

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


[edit] 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

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.


OMAP34XX ZOOM2 # setenv bootargs console=ttyS3,115200n8 nointrd,rw root=/dev/nfs rw nfsroot=<host-ip-address>:\
<path-to-rootfs dir>/ 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.


[edit] Beagle

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


[edit] Reboot

Reboot your board and enjoy Maemo5

login = root
password = rootme


[edit] 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)]------------------+
| 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   Handsfre<Handsfre>Handsfre  Handsfre Headset  HeadsetL   |
+------------------------------------------------------------------------------+
Move over to Handsfree and enable it by pressing "M"
Select AudioL2 and AudioR2 for speaker output
Press Esc to exit alsamixer menu 


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>


[edit] Status

Status from 11-05-2009:

Status from 1-14-2010:

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


[edit] Known issues

Zoom2

Beagle

[edit] FAQ

[edit] 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):

# echo 3600 > /sys/devices/platform/serial8250.0/sleep_timeout


[edit] 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.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox