Using ELBE to Build Debian Based Embedded Systems – Manuel Traut, Linutronix

When building for embedded systems, you don’t want to create and maintain yet another distro (yocto, buildroot), but rely on the maintainers of an existing one, e.g. Debian.

Create rootfs for Debian: debootstrap downloads from; second stage needs to run on the target; manual modifications (e.g. remove documentation); produce image from custom rootfs.

Several tools exist already. There are scripts that work with debootstrap, e.g. vmdebootstrap. isar uses yocto infrastructure with debootstrap. meta-yocto + debian source code: use Debian maintenance with yocto infrastructure, but still cross-build everything. ELBE is yet another thing.

ELBE has a project description in a single XML file. It only integrates Debian binary packages, but does allow to build your own software components. It allows to customize Debian’s configuration files. It creates flashable images from the rootfs (reinvention of genimage), it also outputs an SDK, a rebuild CD with all debian packages used, a source CD with all debian source images, and the license list. It makes sure that everything is reproducible.

To make things easy and reproducible, everything is done in a VM – both a host VM and a target VM, with qemu. ELBE sets up the VM itself and installs a specific Debian in it. Instead of downloading from the net it can also build from a rebuild CD.

ELBE stable 1.1 supports armel, armhf, i386, amd64 and powerpc. It generates MSDOSHD, GPT, tar.gz (for NFS), cpio (for initrd), squashfs and ubi/ubifs images.

Tuning the rootfs is done by specifying tuning commands in the XML file, and/or by extracting a tarball over the rootfs.

The SDK contains a sysroot for cross-compilation that contains all the -dev packages corresponding to the installed packages.

ELBE has some default modes to shrink targets, e.g. remove some essential packages like apt-get and its dependencies. Removing unneeded locales and man pages decreases size with about 80MB. The <norecommend> tag avoids installing not-strictly-required packages. “default” mode contains the entire output of debootstrap + custom package installation. “diet” mode calculates run-time dependencies of the explicitly requested packages, and installs only those. But this misses files that have been modified by a post-install script, e.g. /etc/passwd, so that has to be covered manually. “tighten” is the same as “diet” but doesn’t try to find runtime dependencies.

XML file also specifies: default console serial port, root password, partition information, fstab. The XML file should also specify the u-boot and kernel package to use, and copy the correct DTBs and U-Boot binaries to /boot. adduser and addgroup specifications.

ELBE-report.txt is an asciidoc file that lists all files and where they come from (deb package, debootstrap, finetuning or overlay).

New features for ELBE 2.0: ELBE-pbuilder for building custom debian packages. arm64 support. Show the build log. Generate SPDX files out of Debian license information. MSDOSHD can also create extended partitions.

On a Debian PC, ELBE can be installed by simply adding it to sources.list, but you can also install it locally in your homedir.

To add extra software. pbuilder entry with reference to a git repo to clone – the repo has to contain the debian/ directory. Use dh-make to construct the debian/ directory. The resulting package has to be explicitly added to the pkglist. It uses pdebuild + qemu, with the same apt sources as the rest of the system.

What is missing: generate a file with all packages that need update compared to previous version. Packages are not installed in a full VM, just with qemu-user, so some post-install commands will fail (e.g. mysql tries to create a default database).

Some source code for generating images should be shared with vmdebootstrap, or use genimage.

apt-cacher is not used by ELBE itself, but it’s recommended to set it up locally and use that rather than upstream debian repositories.

To integrate ELBE in the upstream Debian project, one thing certainly needs to be fixed: it now uses a patched version of debian-installer.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s