Scratchbox + Maemo SDK 4.1.1 on Fedora 9

My everyday working machine is based on Fedora 9 x86_64. Since Scratchbox is officially supported only by i386 archs I have been looking for an optimal solution to get it working inside of my box.

The most clean solution is to fake an i386 architecture by using setarch command, this way the checking prerequisites are satisfied and you able to install scratchbox by following the usual procedure, with some workarounds.

Scratchbox know limitations:

Qemu “mmap_min_addr” value grather than 4096

Edit /etc/sysctl.conf and add:
vm.mmap_min_addr = 4096

Scratchbox doesn’t work when VDSO support is enabled in the host’s kernel.

To disable VDSO support in x86_64 kernels you need to add the vdso32=0 options
in your kenel boot line

Edit /boot/grub/menu.lst and add vdso32=0 my kernel boot looks like:

kernel /vmlinuz-2.6.26.6-79.fc9.x86_64 ro root=/dev/VolGroup00/LogVol00 rhgb quiet vdso32=0

Reboot your machine so VDSO can be disabled.

Installing Scratchbox:

Get the installer script:
wget http://repository.maemo.org/stable/4.1.1/maemo-scratchbox-install_4.1.1.sh

Give executable permitions to the script:
chmod +x maemo-scratchbox-install_4.1.1.sh

Disable Selinux:
echo 0 > /selinux/enforce

Other wise the installer script will complain

Fake a i386 arch:

sudo setarch i386

Run installer script:

sudo ./maemo-scratchbox-install_4.1.1.sh -s <install-path> -u <your-username>

This will take a while, when it finish you will see a massage like this:

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

Installing Maemo SDK:

Download SDK installer script

wget http://repository.maemo.org/stable/4.1.1/maemo-sdk-install_4.1.1.sh

Give executable permitions to the script:
chmod +x maemo-sdk-install_4.1.1.sh

Fake i386 arch:

setarch i386

Satrt sbox service:

sudo <sb-install-path>/sbin/sbox_ctl start

Run the sdk install script
sh ./maemo-sdk-install_4.1.1.sh -y -s -d <sb-install-path>

Testing scratchbox and the sdk:

Install Xephyr server to forward sb xorg-X11

sudo yum install xorg-x11-server-Xephyr

Start Xephyr server:

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

Start sbox and login

sudo /opt/scratchbox/sbin/sbox_ctl start

/opt/scratchbox/login

Create a file named hello-maemo.c and add the following lines:

/*********/

#include <hildon/hildon-program.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkbutton.h>

int main(int argc, char *argv[])
{
/* Create needed variables */
HildonProgram *program;
HildonWindow *window;
GtkWidget *button;

/* Initialize the GTK. */
gtk_init(&argc, &argv);

/* Create the hildon program and setup the title */
program = HILDON_PROGRAM(hildon_program_get_instance());
g_set_application_name(“Hello maemo!”);

/* Create HildonWindow and set it to HildonProgram */
window = HILDON_WINDOW(hildon_window_new());
hildon_program_add_window(program, window);

/* Create button and add it to main view */
button = gtk_button_new_with_label(“Hello!”);
gtk_container_add(GTK_CONTAINER(window), button);

/* Connect signal to X in the upper corner */
g_signal_connect(G_OBJECT(window), “delete_event”,
G_CALLBACK(gtk_main_quit), NULL);

/* Begin the main application */
gtk_widget_show_all(GTK_WIDGET(window));
gtk_main();

/* Exit */
return 0;
}

/*********/

Compile the hello-maemo example:

gcc -o hello-maemo hello-maemo.c `pkg-config –cflags gtk+-2.0 hildon-1` -ansi -Wall `pkg-config –libs gtk+-2.0 hildon-1`

Set the DISPLAY variable to poit to the Xephyr server

export DISPLAY=:2

Start the maemo scratchbox enviroment test script:

af-sb-init.sh start

Run the hello_maemo application:

run-standalone.sh ./hello_maemo

hello_maemo

References:

http://www.progbox.co.uk/wordpress/?p=453

http://znark.com/blog/2008/09/21/maemo-sdk-on-fedora-9

Advertisement

3 thoughts on “Scratchbox + Maemo SDK 4.1.1 on Fedora 9

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s