Chapter 4. The Composite Method

Embedded Development the Debian way.

Table of Contents

Summary of the composite method
How each packaging method is handled
Patch sequencing
emdebian patch files
Using emdebian-tools
emsource and Subversion

The composite method consists of an abstraction of previous models, retaining the key features with the aim of reusing as many existing Debian tools as possible, without patches, whilst retaining flexible support for cross-building. The composite method is as close as Emdebian currently gets to a formal Policy statement and is the basis of all programs in the emdebian-tools package. The net result of the method is that patches are applied to each Debian source package before each cross-build rather than to the Debian package management tools. This allows for fine control over individual package changes but does increase the workload.

The Debian package management system, including reprepro, apt, dpkg, cdbs, debhelper, dpatch and debconf is also used in Emdebian and the emdebian-tools scripts are tightly integrated with the Debian systems. This makes the transition from Debian to Emdebian as smooth as possible but necessarily raises the entry barrier for non-Debian contributors.

Emdebian is a sub-project of Debian and the composite method relies on the way that Debian manages packages in order to bring the benefits of a scalable, flexible and comprehensive cross-building platform and distribution to Debian. Whilst contributors to Emdebian do not have to be Debian developers, it is essential that Emdebian contributors have a thorough understanding of Debian package management before expecting to use emdebian-tools. Patching each source package means that Emdebian developers need to understand the package management tools - particularly debhelper and dpkg - as well as being confident in working with debian/rules and associated files.

The emdebian-tools package is not designed to be transferable to another base distribution, GNU/Linux or otherwise. (It is a native package in Debian.)

Whilst the emdebian-tools scripts are mainly written in Perl, there is no need for the cross-built packages to require Perl as an Essential package. This means that debconf will not be Essential either (cdebconf will be available instead).

Other tools within Emdebian are used to build, manage and update the binary toolchains for cross-building on i386, amd64 and powerpc which can be installed via emdebian-tools or separately. Developers who do not wish to use emdebian-tools directly can use these toolchains to support whatever cross-builds they wish to create. For this reason, Emdebian supports toolchains for gcc-3.3, gcc-3.4, gcc-4.0 and gcc-4.1. gcc-4.2 toolchains will be available in due course as emdebian-tools only uses the current default version of gcc in Debian unstable.

emdebian-tools depends on dpkg-cross and apt-cross (both native Debian packages) as well as a range of other tools such that installing emdebian-tools and subversion should ensure that all packages necessary for cross-building are available. subversion is optional (see later).

Summary of the composite method

  • All parameters are controlled in normal debian/ control files and all changes are prepared as patches, held in the Emdebian subversion repository.

  • Wrappers for existing build scripts (emdebian-tools) ensure that patches are applied in the correct sequence, update the apt-caches for the target architecture, cross-build the patched package and automate the management of emdebian patch files and build logs using subversion.

  • Emdebian patches remove unwanted build information, documentation and Debian installer information and add individual locale handling. This splits out the individual translation files from a single Debian package into a set of emdebian packages without any translation files and a series of emdebian locale packages, one per translation. This allows individual users to only install translation files for the specific locales supported by the device. Some packages have 70 translations, maybe 30kb each, resulting in a significant reduction in installation size requirements at the expense of more packages in the repository. Locale packages use a generated package name of ${source}-locale-${lang} and a generated description.

  • Packages are managed by a cross-built apt on the target and a new language tool: langupdate which reads the list of installed packages, reads the cache and offers the user a list of available translation files for the current user locale(s) which are not installed.

  • Normal Debian tools are used for installing and managing the packages on the development host. The Emdebian packages can be uploaded to a normal Debian repository and can be used with apt and dpkg without problems.

  • The package itself is essentially the same (only smaller).

  • Identify packages and build files using an emdebian version string: emN where "N" is a sequential digit. Version 1:2.3-4 in Debian becomes 1:2.3-4em1 in Emdebian. An Emdebian fix would be released as 1:2.3-4em2 and a new Debian release would be 1:2.3-5em1 or 1:2.4-1em1.

The composite method retains the ability to build debian and emdebian from the same source simply by applying or deapplying patches. Keeping compatibility means keeping the .deb filename so the .mdeb idea was dropped. Dependency changes may complicate installation on the development machine but a mixed system is possible.