Installing Scratchbox/Maemo SDK

A VERY IMPORTANT VERSION NOTE:
     Although, Scratchbox 1.x version has been released, as of today (Jul 2006) Maemo SDK will not run with it!

Maemo 2.0 runs with Scratchbox 0.9.8.8.

Download Scratchbox and SDK 0.9.8.8 kit for Maemo 2.0 from scratchbox.org. Scroll down to "Core packages" and click on Binary tarballs link.
You have to get these files:

Uncompress all tarballs in root directory '/'

# tar xvfz package -C /
		  

After extraction configure Scratchbox with following command:


# echo 0 > /proc/sys/kernel/vdso
		  

This probably should be added to your /etc/rc.d/rc.local file.

Also, in /scratchbox/sbin/sbox_configure script, find groupadd and change it to /usr/sbin/groupadd.

Now, run initialization scripts and give all default answers.


# /scratchbox/run_me_first.sh
		  

Add users to the Scratchbox with command:

# /scratchbox/sbin/sbox_adduser vlg
		  

Now, log out from the desktop and login back again. Make sure you are added to the sbox group.

$ groups
vlg wheel uucp users sbox
		  

If you see an error message like one below, perhaps you should reboot:


[vlg@dedalus]/home/vlg> /scratchbox/login

ERROR: You don't have permission to run '/scratchbox/sbin/chroot-uid'.
Maybe you have not logged out and in again after being added to sbox group.

		  

You are ready to login:

# /scratchbox/sbin/sbox_ctl start

$ /scratchbox/login

Welcome to *Scratchbox*, the cross-compilation SDK!

		  

Add the following lines to .bash_profile:

export LANGUAGE=en_GB
export PAGER=less
export DISPLAY=:2
		  

Installing Maemo Rootstrap

Download Maemo_Dev_Platform_v2.0_i386-rootstrap.tgz and Maemo_Dev_Platform_v2.0_armel-rootstrap.tgz (~100Mb each would take you somewhere around ~30 mins) and put them in /scratchbox/packages/ directory:

# cp Maemo_Dev_Platform_v2.0_i386-rootstrap.tgz   /scratchbox/packages/
# cp Maemo_Dev_Platform_v2.0_armle-rootstrap.tgz  /scratchbox/packages/
		  

Configure SDK_PC Target

Create new rootstrap target

[sbox-HOST: ~] > sbox-config -ct SDK_PC

Available compilers:
        0) cs2005q3.2-glibc-arm
        1) cs2005q3.2-glibc-i386
        2) host-gcc


Enter compiler number: 1

Available CPU-transparency methods:
        sbrsh
        qemu-arm
        qemu-ppc

Enter method name (none): [Enter]

Available devkits:
        debian

Enter list of devkit names (none): debian

Completed writing configuration to: /targets/SDK_PC.config

[sbox-HOST: ~] >
		  

Select the newly created target


[sbox-HOST: ~] > sbox-config -st SDK_PC
Restarting Scratchbox shell...
Hangup
Shell restarting...
		  

Extract the downloaded rootstrap to your target


[sbox-SDK_PC: ~] > sbox-config -er /scratchbox/packages/Maemo_Dev_Platform_v2.0_i386-rootstrap.tgz

Extracting /scratchbox/packages/Maemo_Dev_Platform_v2.0_i386-rootstrap.tgz to /targets/.tmp/SDK_PC
Moving /targets/SDK_PC to /targets/.old/SDK_PC
Moving /targets/.tmp/SDK_PC to /targets/SDK_PC
Restarting Scratchbox shell...
Hangup
Shell restarting...

		  

Configure newly created target compiler and setup libfakeroot environmen :

[sbox-SDK_PC: ~] > sbox-config -cc
[sbox-SDK_PC: ~] > sbox-config -cf
		  

If you run into an error from scratchbox "cp: cannot overwrite directory `/usr/include/asm' with non-directory", simply remove the directory (it is suppose to be a symbolic link to asm-i386):

[sbox-SDK_PC: ~] > sbox-config -cc
cp: cannot overwrite directory `/usr/include/asm' with non-directory

[sbox-SDK_PC: ~] > file /usr/include/asm
/usr/include/asm: directory

[sbox-SDK_PC: ~] > /bin/rm -rf /usr/include/asm
[sbox-SDK_PC: ~] > sbox-config -cc

[sbox-SDK_PC: ~] > echo $?
0

[sbox-SDK_PC: ~] > sbox-config -cf
		  

Xephyr Startup Script

Xephyr is a kdrive based X Server which targets a window on a host X Server as its framebuffer. It is already included in the rootstrap. Create a convenience script, start-xephyr.sh, to bring it up:

#!/bin/sh -e

prefix=/scratchbox/users/${LOGNAME}/targets/SDK_PC/usr
export LD_LIBRARY_PATH=${prefix}/lib; export LD_LIBRARY_PATH
exec ${prefix}/bin/Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac

		  

Make the script an executable with % chmod 755 start-xephyr.sh.

Configure SDK_ARMEL Target

Login and create new rootstrap target:

[sbox-SDK_PC: ~] > sbox-config -ct SDK_ARMEL

Available compilers:
        0) cs2005q3.2-glibc-arm
        1) cs2005q3.2-glibc-i386
        2) host-gcc

Enter compiler number: 0

Available CPU-transparency methods:
        sbrsh
        qemu-arm
        qemu-ppc

Enter method name (qemu-arm): qemu-arm

Available devkits:
        debian

Enter list of devkit names (none): debian
		  

Select the newly created ARMEL target

[sbox-SDK_PC: ~] > sbox-config -st SDK_ARMEL
Restarting Scratchbox shell...
Hangup
Shell restarting...

		  

Configure newly created target compiler


[sbox-SDK_ARMEL: ~] > sbox-config -cc
		  

Setup libfakeroot environment


[sbox-SDK_ARMEL: ~] > sbox-config -cf
		  

Extract the downloaded rootstrap to your target


[sbox-SDK_ARMEL: ~] > sbox-config -er /scratchbox/packages/Maemo_Dev_Platform_v2.0_armel-rootstrap.tgz

Extracting /scratchbox/packages/Maemo_Dev_Platform_v2.0_armel-rootstrap.tgz to /targets/.tmp/SDK_ARMEL
Moving /targets/SDK_ARMEL to /targets/.old/SDK_ARMEL
Moving /targets/.tmp/SDK_ARMEL to /targets/SDK_ARMEL
Restarting Scratchbox shell...
Hangup
Shell restarting...

		  

You are ready to use SDK_ARMEL target!


Vladislav Grinchenko