Gentoo From Scratch



This talk is about decoupling package management systems from build
environments, making the decisions "what to build" and "how to build"


Embedded Linux developers create lean customized systems from source code,
which run on arbitrary hardware. But as these build systems grow to include
more packages, they’re faced with package management and repository
maintenance issues. This can of worms results in numerous “accidental
distributions” such as buildroot which spend the majority of their development
effort maintaining package repositories.

Modern Linux distributions have extensive and well-maintained package
repositories, combined with deeply ingrained assumptions about their
build environment. Modern Linux distributions are compiled under themselves;
Fedora builds under Fedora, Debian builds under Debian, and even installing
Gentoo (a distro designed around the idea of compiling everything from source)
requires a specific prebuilt root filesystem tarball as a starting point.
This makes it difficult to port these distributions to new hardware, customize
them to remove “always enabled” features such as audio support, and swap
out base packages for embedded versions such as busybox, uClibc, and dropbear.

So if embedded build systems are hard to scale up, and full distributions
are difficult to scale down, is there a way to mix and match them? Can we
reproduce a modern distro entirely from source code under a different build
environment, one which may not even use the same processor? Can we customize
the distribution’s base environment to use different packages, or build
individual packages from a distribution repository on top of an embedded

We’ve made this work using a combination of the “Firmware Linux” and
“Gentoo From Scratch” projects. The Firmware Linux stage is like an automated
Linux From Scratch, using BusyBox and uClibc and targeted at a wider variety
of hardware platforms. It creates a cross compiler toolchain for a target,
uses it to build a native development root filesystem for that target, and
packages the result to run under the emulator qemu. The Gentoo From Scratch
stage then natively builds additional packages to extend this minimal build
environment with the prerequisites for Gentoo’s “portage”, creating a
usable “Gentoo Stage 1” environment from a non-gentoo starting point.

This approach is designed as a series of orthogonal layers, each of which
can be swapped out with a different implementation. We’ll detail these
layers and how to swap them out. We picked Gentoo for its existing focus on
building from source, but will explain how to apply these same techniques to
RPM or dpkg based systems. We’ll also compare the ipkg and slackware
approaches, cross compiling vs native compiling under emulation, and so on.

The presenters are Rob Landley (author of Firmware Linux) and Mark Miller
(author of Gentoo From Scratch), with a potential guest appearance by
the maintainer of Gentoo Embedded.


gentoo, embedded, cross-compiling


  • Linucon-2004-ln2

    Rob Landley

    Impact Linux


    Rob Landley has been a geek since childhood, a Linux geek since 1998, and an embedded Linux geek since 2001. (This is because he breaks everything, and likes reducing the complexity in his system so there are less layers to drill through when debugging it.) He no longer maintains BusyBox, or his own fork of tinycc, but does still maintain Firmware Linux. He knits chain mail, co-founded two combination science fiction convention/Linux expos, has more cats than are strictly necessary, and sometimes refers to himself in the third person when writing biography entries.

  • Biography

    Embedded Linux Developer and SysAdmin

Leave a private comment to organizers about this proposal