1. Working Emdebian build environment

1.1. Introduction

This scratchbox-based environment is intended for building emdebian [1] packages. It uses a scheme based on the emdebian STAG framework ideas [2]. It can also be used for making root filesystem images out of emdebian packages.

This is an attempt to share the Nokia experience of Nokia 770 development and building bootable root filesystem images using the emdebian packaging scheme.

Embedded Debian(Emdebian) is a project to make Debian GNU/Linux a mainstream choice for embedded projects.

This was taken from emdebian website [4] as an explanation of one of the project's ideas: "We need a scheme that allows emdebian to stay in sync with Debian as much as possible, whilst having fine control over package generation. To do this we need to keep emdebian package modifications in each package, maintained by package maintainers as much as possible." [4]

The first implementation of this scheme is the STAG embedded framework [2] The idea is to have a separate emdebian directory included in the debian source package, i.e. to have the option to make both debian and emdebian packages out of the same source package. STAG proposes a patched version of dpkg and debhelper packaging tools using emdebian directory instead of debian.

This enviroment uses STAG ideas, but a slightly different way. It also offeres patched debian packaging tools, but modifications allow the developer to make both emdebian and debian packages using the same tools. This is done by changing the DEBIAN_DIR environment variable. Moreover, it's possible to have even more debian-like directories and have more than one type of package built from the same sources.

This implementation uses scratchbox as a cross-compilation environment. It includes modified scratchbox, emdebian development rootstrap, set of about 40 emdebianized debian packages and 3 root filesystems built out of these packages: minimal, dpkg+apt, dpkg+apt+xserver. Rootfses have been tested on Nokia 770 device. Only basic tests like booting, ability to log in and get working shell, working apt and dpkg and xserver depending on image.

The project infrastructure includes an svn source repository, a debian package repository filled with emdebianized packages and downloadable rootfs and rootstrap images.

Please note that this is a work in progress and any kind of help/feedback/suggestionsfrom emdebian developers is more than welcome. If you're interested in this you can look at the TODO list at the end of this document.

1.2. Initial setup

First of all it's assumed that you have Debian installalled on your PC. This is a requirement. At least all this environment was developed and tested on Debian.

All you need for building is to install and configure scratchbox environment, configure scratchobox target, install development rootstrap into this target. Below is explanations of the setup in details.

1.2.1. Setting up scratchbox environment Installing scratchbox packages

     deb http://repository.maemo.org/ emdebian/tools glibc
     deb-src http://repository.maemo.org/ emdebian/tools glibc

     $ sudo apt-get update

     $ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-debian scratchbox-doctools

     $ sudo apt-get install scratchbox-toolchain-arm-gcc3.4.cs-glibc scratchbox-toolchain-i686-glibc_0.9.8.5 scratchbox-toolchain-arm-gcc3.4.cs-uclibc

     $ sudo /scratchbox/sbin/sbox_adduser Creating new scratchbox target

     $ scratchbox

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

     [sbox-HOST: ~]> sbox-config -st 

     [sbox-target: ~]> sbox-config -cc
     [sbox-target: ~]> sbox-config -cf installing development rootstrap inside scratchobx:

     $ scratchbox

     [sbox-target: ~]> wget http://repository.maemo.org/emdebian/configurations/arm-glibc-emdebian-dev/arm-glibc-emdebian-dev-rootstrap.tgz

     [sbox-target: ~]> sbox-config -er arm-glibc-emdebian-dev-rootstrap.tgz

1.2.2. Svn source repository Repository location Repository layout How to check out source from repository:

     $ scratchbox

     [sbox-target: ~]> svn co https://stage.maemo.org/svn/emdebian/

1.3. Building packages

   $ scratchobox

   [sbox-target: ~]> export DEBIAN_DIR=emdebian

   [sbox-target: ~]> cd emdebian/target/trunk/

   [sbox-target: ~]> svn-buildpackage -rfakeroot -uc -us -sa -D

1.4. Root filesystem creation

1.4.1. initial setup

     $ sudo apt-get install rootimagescripts

1.4.2. Rootstrap creation using emdebian package repository

     $ scratchbox

     [sbox-target: ~]> cd emdebian/configurations/
     [sbox-target: ~]> make_rootimage.sh -p arm-glibc-nokia770-apt/packages -o arm-glibc-nokia770-apt/arm-glibc-nokia770-apt --jffs --rootfs --genlists -f

     [sbox-target: ~]> make_rootimage.sh -p arm-glibc-nokia770-minimal/packages -o arm-glibc-nokia770-minimal/arm-glibc-nokia770-minimal --jffs --rootfs --genlists --strip=all -f

1.4.3. Rootstrap creation using local directory with packages

     $ scratchbox
     [sbox-target: ~]> cd emdebian/configurations/

     [sbox-target: ~]> mkdir workarounds
     [sbox-target: ~]> cp *.deb workarounds/

1.5. TODO list

1.6. References