Setting up and testing the development environment This section describes the development environment setup prerequisites and installation tasks. It also provides instructions for launching the application framework environment. Prerequisites ------------- When setting up the maemo SDK, the following hardware and software requirements must be met:: * Intel compatible x86 processor, 500 MHz or faster * 256 MB RAM or more * 2 GB free hard disk space * Linux OS (Debian or Ubuntu are recommended, but other fairly recent distributions mostly also work) When starting up the installation, the following software must be first downloaded: * Scratchbox cross-compilation toolkit and toolchains from http://scratchbox.org/download/scratchbox-apohis/. The recommended and supported version of Scratchbox is 1.0.7. * Maemo SDK rootstrap from Maemo downloads. Installation ------------ Note: The instructions in this section only cover the basic installation task and do not provide any detailed information. For the complete instruction, see the up-to-date Scratchbox installation documentation in http://scratchbox.org/documentation/. Note: To update your Scratchbox installation, see the Porting to maemo 2.2 "how to" document. Installing Scratchbox --------------------- 1. Download the following Scratchbox files from http://www.scratchbox.org/scratchbox-apophis/. Alternatively, install the corresponging debian binary packages. scratchbox-core-1.0.7.tar.gz scratchbox-devkit-debian-1.0.7.tar.gz scratchbox-libs-1.0.7.tar.gz scratchbox-toolchain-cs2005q3.2-glibc-arm-1.0.5.tar.gz scratchbox-toolchain-cs2005q3.2-glibc-i386-1.0.5.tar.gz 2. Extract the tar files (for each package) to the / directory as a root user using the following command: # tar zxf -C / Note: Double-check the packages you are extracting. Rootstraps must not be extracted to the / directory, only the Scratchbox packages. 3. Add users to Scratchbox with the following command: # /scratchbox/sbin/sbox_adduser username For 'username', use your Linux user login name. 4. To update the changes in the groups, restart your user session with the following command: $ groups adm dialout cdrom floppy audio video plugdev lpadmin scanner sbox 5. Start Scratchbox with the following command: $ /scratchbox/login Welcome to *Scratchbox*, the cross-compilation SDK! Scratchbox is a self-contained mini-distribution that contains all the tools needed to configure and cross-compile Open Source software using GNU make and *autoconf*. All the software configuration, compilation and installation is done in a sandbox environment exactly like on your target device. This is achieved by using chroot to limit system visibility for configuration scripts you run from this shell, into what exists inside the Scratchbox sandbox. The Scratchbox utilities are: sbox-config - Change your compilation target ps - List processes running inside your sandbox Completed writing configuration to: /targets/HOST.config libtool disabled [sbox-HOST: ~] > 6. After you have logged into Scratchbox, add the following two lines into your .bash_profile inside Scratchbox. There are both nano and vim editors available. export LANGUAGE=en_GB export PAGER=less The settings are necessary to be able to use the man command inside Scratchbox and for the localisation to work properly. The Scratchbox installation is now finished. Continue by installing the maemo rootstrap. Installing maemo rootstrap -------------------------- This section contains information about how to install the maemo SDK rootstrap to Scratchbox. While Scratchbox contains the toolchain to build software, rootstrap contains all the maemo software to run and build maemo applications. To test the maemo platform and applications, you need the i386 rootstrap. To be able to build packages for maemo devices, you also need the ARMEL rootstrap, whose installation is covered later. 1. Download the SDK rootstrap from Maemo downloads. 2. Copy the rootstrap to the /scratchbox/packages directory with the following command: # cp Maemo_Dev_Platform_v2.2_i386-rootstrap.tgz /scratchbox/packages/ Note: If you have just installed Scratchbox according to the instructions in the previous section and are already inside it, skip Steps 3 and 4. 3. If you have booted the computer after installing Scratchbox, start up Scratchbox with the following command: # /scratchbox/sbin/sbox_ctl start 4. Log in to Scratchbox as a normal user with another terminal window using the following command: $ /scratchbox/login Welcome to *Scratchbox*, the cross-compilation SDK! Scratchbox is a self-contained mini-distribution that contains all the tools needed to configure and cross-compile Open Source software using GNU make and *autoconf*. All the software configuration, compilation and installation is done in a sandbox environment exactly like on your target device. This is achieved by using chroot to limit system visibility for configuration scripts you run from this shell, into what exists inside the Scratchbox sandbox. The Scratchbox utilities are: sbox-config - Change your compilation target ps - List processes running inside your sandbox [sbox-HOST: ~] > 5. Create a new rootstrap target with the sbox-config -ct SDK_PC command and answer the questions as presented below. SDK_PC is the name of your new target. Note: If you already have a target with the same name, you have to choose some other string for your new target. For the PC target, select the available i386 compiler and to not use the host-gcc compiler. No CPU transparency is needed as the target CPU is same as the CPU of the host PC. Select "debian" from the available development kits to be able to use all Debian-specific tools. [sbox-HOST: ~] > sbox-config -ct SDK_PC Available compilers: 0) cs2005q3.2-glibc-arm 1) host-gcc 2) cs2005q3.2-glibc-i386 Enter compiler number: 2 Available CPU-transparency methods: sbrsh qemu-arm qemu-ppc Enter method name (none): none Available devkits: debian Enter list of devkit names (none): debian Completed writing configuration to: /targets/SDK_PC.config [sbox-HOST: ~] > 6. Select the newly created target with the following command: [sbox-HOST: ~] > sbox-config -st SDK_PC Restarting Scratchbox shell... Hangup Shell restarting... [sbox-SDK_PC: ~] > Note how the command line prompt changes according to the selected target. If you create a new target for the ARMEL rootstrap, this functionality allows you to constantly see which target is selected. You can also add a version number into the target name, if you install newer SDK rootstraps and want to keep the older ones for later use. 7. Extract the downloaded rootstrap inside your target. This can take a few minutes, since the tgz package is rather large. [sbox-SDK_PC: ~] > sbox-config -er \ /scratchbox/packages/Maemo_Dev_Platform_v2.2_i386-rootstrap.tgz Extracting /scratchbox/packages/Maemo_Dev_Platform_v2.2_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... [sbox-SDK_PC: ~] > The maemo development environment is now ready for use and you can start compiling maemo applications. To be able to also see and test the applications, install a graphical X server as described in the following section. Installing Xephyr ----------------- To run the maemo environment in a Linux PC, you need a graphical window in which to start it. For this purpose Xephyr is recommended, but alternative options are also available. Xephyr is a drive-based X server which targets a window on a host X server as its framebuffer. For more information about Xephyr, see http://www.freedesktop.org/wiki/Software_2fXephyr. Xephyr is pre-installed in the rootsrap. 1. To ease the Xephyr startup, create a start-xephyr.sh script. The following example illustrates the contents of the script. Replace the name of the target by the one you are using, the example uses "SDK_PC". #!/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 2. Make the created script executable with the following command: chmod +x start-xephyr.sh 3. Startup the Xephyr with the script, outside the scratchbox, using the following command: $ ./start-xephyr.sh & After running the script, the following empty Xephyr window opens. Xephyr window This concludes our installation instructions. For more information, please see http://maemo.org/platform/docs/howtos/Maemo_tutorial.html