Installing qemu-arm-eabi patch into Scratchbox

Using Scratchbox and in particular the Maemo SDK with ARMEL target, very often when we try to execute some application we can get into this kind of errors (for example):

sem_post: Function not implemented

This happens because not all the functions have been implemented in the emulated environment. Lauro VenĂ¢ncio has created a patched version of qemu-arm called qemu-arm-eabi.

Thanks to Marcelo Lira, we have a simple howto to install the patch into the Scratchbox environment. Note: you have to execute these commands from outside the Scratchbox environment and you should not be logged into the environment at the same time.

1. You need gcc 3.4, SDL dev library and Zlib dev:

sudo apt-get install gcc-3.4 libsdl1.2-dev zlib1g-dev

2. Get the patched qemu-arm. Notice that the patches are already applied, everything is here, and you don’t need to get the qemu sources.


svn co https://qemu-arm-eabi.svn.sourceforge.net/svnroot/qemu-arm-eabi qemu-arm-eabi
cd qemu-arm-eabi
./configure --target-list=arm-linux-user --static
make

3. Copy qemu to the cputransp dir on scratchbox

sudo cp arm-linux-user/qemu-arm /scratchbox/devkits/cputransp/bin/qemu-arm-eabi-sb2

4. Add it to the list of cputransp methods. Open the file

sudo vim /scratchbox/devkits/cputransp/etc/cputransp-methods

and add this line:

qemu-arm-eabi-sb2

5. Configure the target to use the patched qemu as transparency method. Edit the file:

vim /scratchbox/users/USERNAME/targets/CHINOOK_ARMEL.config

and change this line:

SBOX_CPUTRANSPARENCY_METHOD=/scratchbox/devkits/cputransp/bin/qemu-arm-eabi-sb2

That’s all! You’re now ready to log again into your Scratchbox environment.

Upgrading Maemo SDK 4 Beta to Maemo SDK 4 final release

The final version of Maemo SDK 4 is out. Like most other people I couldn’t wait for the final release and I installed the beta version. The big question, when I did read about the final version was “how can I upgrade to the final version without installing it from scratch?!”. Luckly one kind person helped me on maemo-developer mailing list, and suggested me to do a dist-upgrade from inside the Scratchbox environment. So, login into tour Scratchbox environment and execute this:

[sbox-SDK_BETA_X86: ~] > fakeroot apt-get update
[sbox-SDK_BETA_X86: ~] > fakeroot apt-get dist-upgrade

That’s all! I don’t know if this is the official method to do the upgrade, but it worked for me. I checked, after the upgrade, if I had the right packages installed, using this page: http://tablets-dev.nokia.com/4.0/4.0b_vs_4.0_content_comparison.html
and they were right.

Spim – MIPS Emulator for N770

Spim is a self-contained simulator that will run MIPS32 assembly language programs. It reads and executes assembly language programs written for this processor. spim also provides a simple debugger and minimal set of operating system services. spim does not execute binary (compiled) programs.

I made a port of spim for the Nokia 770/800 device just for fun and to start learning how to do ports.

Download

You can download spim for N770/800 from here: http://www.ptlug.org/download/packages/spim_7.3-1_armel.deb

References

To create the package i followed the guide lines in these websites:

Installing Maemo SDK 4 Beta

Introduction

Maemo is an opensource development platform for Linux based devices. Actually is the base for the operating system installed on Nokia N770, N800 and the upcoming N810 but it could be adopted, with few changes, even by other similar devices.

In particular, this version of Maemo SDK is the only one that allow developers to develop new applications for N810 and to start porting old application to this new platform.

The SDK is not only a set of libraries and compiler, it gives you a real environment that emulates the Nokia device, so the developer can write applications, debug them and test them. Both command line and gui application are supported in emulator.

Graphical environment is based on a real X server, a window manager and on GTK libraries, with a particular extension called Hildon.

With Maemo SDK you can:

  • Test Maemo applications using a normal PC with Linux.
  • Write and debug applications written by you.
  • Port existing applications written for Linux/GTK and verify if they work correctly.
  • Compile and build ARMEL package so you can install them in the device.

Requirements

These are the minimum requirements to work with Maemo SDK:

  • Intel compatible processor (x86), at least 500 Mhz
  • 256 Mb RAM
  • 2 Gb space on hard disk
  • A Linux distribution (I suggest Debian or Ubuntu)

You need the following software packages:

Starting from 4.x version, Maemo has a simple installer script, so all you need are these two files:

Installing Scratchbox

The first tool you have to install is Scratchbox. I suggest you to use the script provided but you could choose also to install it manually (in this case please refer to [this site] for detailed instructions).

Before beginning the installation of Scratchbox, you have to become root.

First of all set the permission of the script file:

chmod +x maemo-scratchbox-install_4.0beta.sh

Then run it with these parameters:

./maemo-scratchbox-install_4.0beta.sh -d -u andy80

Please note that -d tells the installer to install from Debian dpkg packages while -u specifies your username (in my case is andy80, you have to change it using your local username).

Scratchbox environment will be installed in /scratchbox/

Please note that you’ll have to logout and login again to be able to log into you new Scratchbox environment. To test it you simply have to start Scratchbox from your local user:

[email protected]:~/download/maemo_4.0_beta$ /scratchbox/login

Welcome to Scratchbox, the cross-compilation toolkit!

Use 'sb-menu' to change your compilation target.
See /scratchbox/doc/ for documentation.

[sbox-SDK_BETA_ARMEL: ~]

Installing Maemo SDK

When Scratchbox is correctly installed on your system, you can install the Maemo SDK. Please note that you have to do it from normal user (the user you specified in the installation of Scratchbox).

Simply run this command and follow instructions:

bash maemo-sdk-install_4.0beta.sh

At the end you should get this message:


Installation was successful!
----------------------------

IMPORTANT! Please read this.

You now have the maemo 4.0beta 'chinook' installed on your computer.
You can now start your maemo SDK session with /scratchbox/login and
then select your target with 'sb-conf select SDK_BETA_ARMEL' for the
armel target or 'sb-conf select SDK_BETA_X86' for the i386 target.

If you have any problems with targets' package databases, you can try
running 'fakeroot apt-get -f install' on your scratchbox target.
This command will try to fix any problems with the package database.

Happy hacking!

Installing Xephyr

Xephyr is an X11 server that provides a device screen for the developer so that you can see all the maemo application windows and visuals on your computer.

To install it in a Debian based distribution, simply execute this (from root):


apt-get install xserver-xephyr

Running Xephyr

To see if all works fine, you should start Xephyr and Maemo environment. Execute this from outside the Scratchbox environment:

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -extension Composite

Now, from another shell, log into Scratchbox and execute this:

[sbox-SDK_BETA_X86:~] > export DISPLAY=:2
[sbox-SDK_BETA_X86:~] > af-sb-init.sh start

This should start the Hildon Application Framework inside the Xephyr window. That’s all!

References

Here you can find a list of website where I took information from to write this guide: