Maemo 5 pre-alpha SDK installation


Index

  1. Automated installation
    1. Scratchbox1 installation
    2. SDK installation
  2. Manual installation
    1. Scratchbox1 installation
    2. SDK installation
  3. Xephyr X11-server installation
  4. Starting/shutting down hildon application framework
  5. Known issues in scratchbox1
    1. VDSO support
    2. Qemu and mmap minimum address
    3. Fakeroot running out of local sockets
    4. Tip: /etc/sysctl.conf

Maemo 5.0 pre-alpha SDK has been tested on Ubuntu Intrepid and Debian stable distrubutions. It can be installed with the aid of the following installers:

  • scratchbox installer : Downloads and installs the required version of scratchbox1 onto your host computer.
  • SDK installer: Downloads the minimal rootstraps for both armel and i386 targets in scratchbox and sets up the targets.

1. Automated installation

The scratchbox installer script downloads and installs the required version of scratchbox to your host system. This is the easiest and recommended way for installing scratchbox the first time. If you already have an existing scratchbox installation, jump to section 2.1

1.1 Scratchbox1 installation

1. Download the scratchbox installer script.

2. Run it as root user specifying the username to be added to scratchbox users and sbox group. On Ubuntu, you can use 'sudo' command to run the script as follows:

$ sudo ./maemo-scratchbox-install_5.0.sh -u USER    

3. For the group membership to be effective in the current terminal session , run the following command:

$ newgrp sbox

You should now have a working scratchbox environment ready. In a rare situation, if the installer cannot work properly on your system you may have to do a manual installation. This is explained in chapter 2.1.

Running this installer will not modify any files outside its given install path. Downloaded files are temporarily stored in /tmp directory. These can be safely removed after the installer has finished its execution.

On Debian based distributions, the install script will use Debian packages. Packages install to the default path, /scratchbox.

On any other Linux distribution, the install script will use .tar.gz files which can be installed to any given path. Scratchbox installation should be separate from host system's tools, e.g. to /scratchbox or
/opt/scratchbox.

 

1.2 SDK installation

Following steps will quickly guide you through the installation of the SDK.

1. Download the SDK installer script

2. Run it outside scratchbox environment as follows:

$ sh maemo-sdk-install_5.0.sh

If you have installed scratchbox in a path alternative to /scratchbox, you need to specify the path with '-s PATH' option.
More information on the available options can be found here.

3. On running the script, the SDK license information is displayed. Acceptance of the licence is needed inorder to proceed with the installation. Press 'Enter' key to accept and proceed.

license_agreement.png

 

4. You are presented with four options to configure the installation of the SDK:

1. Minimal Rootstrap only : Choose this only if you want to install only a minimal environment. Note that you will then need to manually install the packages you need.

2. Runtime Environment: Use this to install and run software inside scratchbox. For development, we recommend option 3.

3. Runtime Environment + All Dev Packages : Choose this to get a full development environment.

4. Runtime Environment + All Dev and Dbg Packages : You will get a full development environment plus debug symbols for many system components.

The default selection is option 3. Make your selection and proceed further.

selection.png

5. The summary of the selection made uptil now is presented to you. If all settings are as you have expected, proceed further. Else, cancel the installation and start again.

selection_summary.png

6. The installer continues to download the minimal rootstraps for both X86 and ARMEL targets, installs them and there after installs the packages based on your selection in step 4. Once the installation is successfull, you are ready to go!

Options available for the SDK installer

The sdk installer can be run with various options if needed. The available options are:

-v Display version and exit
-h Show this usage guide
-f Do not download or install Nokia binaries
-c Use exisitng downloads, don't try to download again
-y Yes, force remove of existing targets
-d Use defaults. Non-interactive mode
-p URI Specify http_proxy for scratchbox user (By default, host system's proxy is used ).
-s PATH Specify scratchbox installation path (default /scratchbox)
-q NAME Specify Qemu version (default qemu-arm-cvs-m)
-a FILE Specify alternative sources.list file for both targets
-A Advanced mode


2. Manual installation

If you have an existing installation of scratchbox1, you can upgrade it manually by following the instructions below. You may also need manual installation, if for some reason the automated installation script fails to install scratchbox1 on your host system.

2.1 Scratchbox1 installation

In Fremantle, the following scratchbox1 packages are used:

scratchbox-core 1.0.11
scratchbox-libs 1.0.11
scratchbox-devkit-cputransp 1.0.7
scratchbox-devkit-debian 1.0.10
scratchbox-devkit-doctools 1.0.7
scratchbox-devkit-git 1.0.1
scratchbox-devkit-svn 1.0
scratchbox-devkit-perl 1.0.4
scratchbox-toolchain-cs2007q3-glibc2.5-arm7 1.0.8-6
scratchbox-toolchain-cs2007q3-glibc2.5-i486 1.0.8-4
scratchbox-toolchain-host-gcc 1.0.11

2.1.1 Installing Scratchbox1 on Debian GNU/Linux

1. Add the following entry in your host system's /etc/apt/sources.list file:

deb http://scratchbox.org/debian/ maemo5-sdk main

2. Execute the following commands:

$ sudo apt-get update
$ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-cputransp scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-git scratchbox-devkit-svn scratchbox-devkit-perl scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-toolchain-host-gcc

3. After downloading, Scratchbox will be unpacked to '/scratchbox' directory and the installation procedure will ask you some questions about the group and user accounts. Default group to Scratchbox users is 'sbox'. Group can be renamed, but default should be fine unless you have LDAP or similar network authentication scheme. If network authentication is used, then using an existing user group is recommended.

Users who will be using Scratchbox1 should be added using command:

 $ sb-adduser USER

It will automatically include users to the Scratchbox1 group, create user directories under '/scratchbox/users' and mount several directories (/dev, /proc, /tmp) under the user directory.

4. For the group membership to be effective in the current terminal session , run the following command:

$ newgrp sbox

5.Start Scratchbox1 using the command:

$ scratchbox  OR
$ /scratchbox/login

2.1.2 Installing Scratchbox1 on other Linux distributions

You will need root privileges for this part of the installation.

1. Obtain the required scratchbox1 packages (see above) as tarballs from here.

2. Uncompress the tarballs to the /directory

$ tar zxf <package> -C /

Note: If '/' directory does not contain enough space for Scratchbox1, it can be installed to some other partition by creating a symbolic link from '/scratchbox' to desired place with the command: ln -s /opt/sb /scratchbox

3. After extraction, configure Scratchbox with the following command:

$ /scratchbox/run_me_first.sh

Answer the questions (Defaults should be fine). This creates 'sbox' user group and sets up scratchbox1.

4. Add users to Scratchbox1 with the command:

$ /scratchbox/sbin/sbox_adduser <username>

It will automatically include users to the Scratchbox group, create user directories under '/scratchbox/users' and mount several directories (/dev, /proc, /tmp) under the user directory.

5. For the group membership to be effective in the current terminal session , run the following command:

$ newgrp sbox

6. Start scratchbox with the command:

$ /scratchbox/login 

Note: Since scratchbox1 was installed from tarballs, rebooting your machine will clear away all the mounts and binfmt_misc registrations that Scratchbox1 requires to work. To get your scratchbox working again after reboot, you have to run the following command as root:

$ /scratchbox/sbin/sbox_ctl start

For more information on Scratchbox1 installation, please refer the installation pages at scratchbox.org.

2.2 SDK installation

Generally, you do not need to do a manual install unless the maemo SDK installer script cannot function in your specific environment. If you do need, then here is the way to do it.

Make sure that you have the scratchbox installation complete prior to installing the SDK manually. See section 2.1 for manual scratchbox installation or section 1.1 for automated scratchbox installation.

1. Login to scratchbox using the command below:

$ scratchbox

2. The nextstep is to set up the X86 and ARMEL targets. There are two ways to set them up: one using the command line utility called sb-conf and the other using the interactive sb-menu command. In either case, the settings are as follows:

  • X86 target:
    • Compiler: cs2007q3-glibc2.5-i486
    • Devkits: perl debian-etch doctools svn git
    • CPU-transparency: none
  • ARMEL target:
    • Compiler: cs2007q3-glibc2.5-arm7
    • Devkits: perl debian-etch doctools svn git
    • CPU-transparency: /scratchbox/devkits/cputransp/bin/qemu-arm-cvs-m

 

Using sb-conf command line utility:

  • X86 target:
    sb-conf st FREMANTLE_X86 -c cs2007q3-glibc2.5-i486 -d perl:debian-etch:doctools:svn:git -t none
  • ARMEL target:
    sb-conf st FREMANTLE_ARMEL -c cs2007q3-glibc2.5-arm7 -d cputransp:perl:debian-etch:doctools:svn:git -t qemu-arm-cvs-m

You can alternatively use sb-menu interactive command to do the same setup.

3. Download the minimal rootstraps for both the architectures.

wget http://repository.maemo.org/unstable/fremantle/i386/maemo-sdk-rootstrap_5.0_i386.tgz
wget http://repository.maemo.org/unstable/fremantle/armel/maemo-sdk-rootstrap_5.0_armel.tgz

4. Select the FREMANTLE_X86 target

sb-conf se FREMANTLE_X86

5. Install the minimal rootstrap

[sbox-FREMANTLE_X86: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_i386.tgz

6. Install etc, devkits and fakeroot on the target and perform apt-get update.

[sbox-FREMANTLE_X86: ~] > sb-conf in -edFL
[sbox-FREMANTLE_X86: ~] > apt-get update

7. At this point, a simple C program should be compilable as the rootstrap provides you with a minimal compilation environment. The modular SDK provides you with the possibility to install only the packages that you need. The repository contains meta-packages for differentcomponents, for eg: desktop, connectivity, multimedia-framework etc. We also have three top-level meta-packages that allow easy installation of runtime, development and debug environments.

Maemo runtime environment

[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-runtime

Maemo runtime + development environment

[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-dev

Maemo runtime + development + debug environment

[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-debug

8. Repeat the same for FREMANTLE_ARMEL target


3. Xephyr X11-server installation

You need to install the Xephyr X11 server software to your host system before you can run applications inside maemo 5.0-prealpha SDK.

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. It is not included in the SDK. You need to install it yourself into your host system.

Getting Xephyr

Xephyr can be found for example at http://packages.debian.org/unstable/x11/xserver-xephyr

On debian based linux systems, you can install Xephyr by executing the following command outside scratchbox.

$ sudo apt-get install xserver-xephyr

Starting Xephyr

Xephyr requires command line parameters so that it can provide a real working window for the maemo environment. Start Xephyr outside scratchbox as follows:

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


4. Starting/shutting down the maemo SDK environment

1. Make sure that Xephyr is running (as explained above) outside scratchbox environment.

2. Set the DISPLAY variable to match the display setting given for the Xephyr server (parameter :2 in the above example)

[sbox-FREMANTLE_X86: ~] > export DISPLAY=:2

3. Run matchbox window manager and start the hildon application framework as follows:

[sbox-FREMANTLE_X86: ~] > matchbox-window-manager &
[sbox-FREMANTLE_X86: ~] > af-sb-init.sh start

desktop.png

4. You can shut down the application framework as follows:

[sbox-FREMANTLE_X86: ~] > af-sb-init stop

5. Bring the matcbox-window-manager process to foreground with 'fg' command and end the process with Ctrl^C


5. Known issus in scratchbox

The following issues have been noted in the usage of scratchbox

1. VDSO support

Scratchbox does not work when VDSO support is enabled in the host's kernel. We're working on making it possible, but at the moment there are some workarounds, which are presented here.

If your host has VDSO turned on you will get an error like this when trying to login to Scratchbox.

No directory, logging in with HOME=/
Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *)
ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!

64 bit kernel version 2.6.25 or newer

64 bit Linux kernels starting from version 2.6.25 enable VDSO by default and do not offer a /proc filesystem option to turn it off. Notably Debian Lenny and Fedora9 are using such kernels. It has been reported that with a kernel boot parameter it is possible to disable VDSO http://bugs.maemo.org/show_bug.cgi?id=3479 .

The kernel boot parameter option has been verified to work on a 64 bit system. In short;

add vdso32=0 to your kernel boot parameters

Older kernel versions

The status of VDSO support can be verified from the /proc filesystem. Only values 0 and 2 are compatible with Scratchbox.

Depending on the kernel version the VDSO support can most likely be found in /proc/sys/kernel/vdso or /proc/sys/vm/vdso_enabled. You can disable it for the current session by echoing a 0 to the given location under the /proc filesystem as root.

For example on Ubuntu Hardy/Intrepid:

   $ echo 0 | sudo tee /proc/sys/vm/vdso_enabled

2. Qemu and mmap minimum address

The QEMU used by Scratchbox is not compatible with mmap_min_addr value higher than 4096. This feature is not enabled in all kernels and the default value may differ. You can check the value of the mmap_min_addr from the /proc filesystem. The location for this setting is /proc/sys/vm/mmap_min_addr. You can set a desired value for the current session by echoing it to the given location as root.

For Ubuntu Hardy/Intrepid:

   $ echo 4096 | sudo tee /proc/sys/vm/mmap_min_addr

 

3.Fakeroot running out of local sockets

The fakeroot used in Scratchbox uses local tcp sockets to communicate with the faked daemon. During build time a package may handle so many files that the system runs out of sockets.

In these cases you will see the following kind of log writings during the build process:

libfakeroot: connect: Cannot assign requested address
libfakeroot: connect: Cannot assign requested address
...

You can increase the number of allowed local port allocations by modifying a setting under the /proc filesystem as root. The location for this setting is /proc/sys/net/ipv4/ip_local_port_range .

Example for Ubuntu Hardy/Intrepid:

   $ echo "1024 65535" | sudo tee /proc/sys/net/ipv4/ip_local_port_range

 

4. Tip: /etc/sysctl.conf

You can set all of these permanently by adding the following lines to /etc/sysctl.conf . The vdso_enabled option is not available in latest 64 bit kernels.

   vm.vdso_enabled = 0
   vm.mmap_min_addr = 4096
   net.ipv4.ip_local_port_range = 1024 65535

and running sysctl -p as root.

WARNING : You should try setting these values by echoing them to the given locations before adding them to sysctl.conf to see if they cause any problems. For example, in some Ubuntu Gutsy installations, it has been observed that changing the vdso settings will hang the system and thus making permanent changes in sysctl.conf may, in these cases, make your system unbootable.