July 28, 2010
This article was contributed by Koen Vervloesem
There are not a lot of source-based Linux distributions, so when one of them announces a new release, it's always a good opportunity to take a look. We're not talking about Gentoo Linux or Linux From Scratch now, but about a relatively unknown but nonetheless interesting distribution: T2 SDE. After years of development, the project published a new stable release, version 8.0 ("Phoenix").
Distribution build kit
As the project's home page hastens to stress, T2 SDE (which stands for "System Development Environment") is not just a Linux distribution, it's an open source distribution build kit. At the core of T2 lies an automated build system that manages the whole compilation process from fetching the sources of packages to creating a CD image for a desktop system or a ROM image for embedded use. After initial creation of the tool chain, all packages are built inside a sandbox environment.
When configuring the build system, users can choose from various pre-defined target definitions or create their own target definition. A target handles the selection of packages, C library (Glibc, dietlibc, uClibc), compiler (GCC or LLVM), and so on, and it even supports cross-compilation. Depending on the chosen target, the user can build a Linux distribution for an embedded system, a desktop system or a server. There is even an experimental target to build a T2 system to run on a wireless router (wrt2), but it is not yet fully done. If someone picks up development of this target, the result should be an OpenWRT-like embedded Linux system.
The principal developer of T2 SDE is René Rebe, CTO of the German software development company ExactCODE. They use T2 in commercial embedded systems, industrial computers and appliances. Hence, the real target audience of the distribution are developers of appliances and embedded systems. According to René, ExactCODE's clients are using T2 to power firewall products, greenhouse controllers, IPTVs, and a lot of other embedded devices. But T2 is also used as the base of general-purpose Linux distributions, such as Puppy Linux.
The Phoenix has landed
T2 SDE 8.0 is based on Linux kernel 2.6.34, GCC 4.5, Glibc 2.11 and
X.Org 7.5. In total there are around 3200 packages in the
repository. Users can download minimal ISO images
for i486, x86_64, powerpc and powerpc64 (PowerMac G5) or download the source and build their
own ISO image. The advantage of the latter is that it allows you to build an ISO file for another architecture (ARM, Blackfin, MIPS, Sparc and many others are supported) or optimized for a specific processor instruction set, and that other package sets are supported. By the way, these ISO images can be fully cross-compiled, as has been done with the minimal ISO images.
The website has extensive but a little out-of-date documentation, with the T2 Handbook as an excellent in-depth reference, and two short step-by-step guides for the impatient: one for building and one for installing T2.
In short, after checking out the T2 sources with Subversion, the user
starts the configuration of the build system as root with the command
./scripts/Config, which shows an ncurses interface. Then the user
chooses a target (generic,
embedded, and so on) and a package selection, as well as distribution
media, the CPU architecture and optionally some optimizations. There a lot
of advanced configuration options, for example for choosing another C
library, compiler, and so on. When the configuration is done, the build is
started with a ./scripts/Build-Target command. Multiple targets
can be built from the same T2 build system by specifying a configuration
file with the -cfg argument. Building T2 is obviously optimally
done on a T2 system, but with the right prerequisites it's also possible on
other Linux distributions.
Working with T2
T2 is obviously an excellent framework for building embedded Linux
systems. But is it also suitable as a desktop system? It depends on what
the user is looking for. The
target users are not the ones that want to have a completely preconfigured
operating system such as Ubuntu. In contrast, T2 is the ultimate
do-it-yourself distribution: users install the base system from the minimal
ISO image and install the packages they need. The operating system
installation and configuration tool stone is really bare-bones,
but it does the job. Just be sure to select "Full install"
when asked about the package set.
In contrast to many other distributions, T2 only applies patches to the original source files when absolutely necessary, and it follows the latest version of all packages. This means that users have a cutting-edge Linux distribution, but they have to configure a lot themselves. Moreover, all services are disabled by default. All this makes T2's philosophy closer to the BSD world than to most Linux distributions.
Building and installing a package on a T2 system is simply done with the
Emerge-Pkg script (after checking out the T2 source with
Subversion). This script not only builds and installs the named package, but
also its dependencies. The same command can be used to update an already
installed package. Removing a package is done with:
mine -r packagename
Where mine is T2's binary package manager. By
the way, T2 uses human-readable text files (found in
/var/adm) for package management. For example a list of all
installed files belonging to
packages can be found in /var/adm/flists/packagename. This makes it possible to query package information with normal UNIX tools. For example, grepping for the name of a header file in /var/adm/flists will give you the package which offers this file.
However, dependencies are currently a big hurdle for desktop use of
T2. Emerge-Pkg only installs direct dependencies, so a lot of the
builds fail. The user then has to Emerge-Pkg the failed
dependencies to try to build them directly, and if that doesn't work out
the error log files in /var/adm/logs can give some information
about which dependencies are missing. Then you should install these first
before trying to build the original package again. Emerge-Pkg has
an option to build all indirect dependencies, but this often builds way too
much, so it isn't advisable to use this. With the current approach, the
build system is not user-friendly enough to use T2 as a desktop system
without annoyances, but René is aware that the problem has been
neglected for too long and he is working on improving the experience.
T2 uses its own non-standard framework for network configuration, which
can be somewhat confusing at first, although it looks somewhat like
Debian's /etc/network/interfaces. The network configuration is
stored in /etc/conf/network and allows setups from very simple to
complex, even with multiple profiles and basic firewall rules. The T2
handbook is an invaluable resource to get a network running on a T2 system,
although the system configuration tool stone ("Setup Tool ONE")
can handle simple network configurations.
Development
There will always come a moment when a user wants
to install a package that T2 doesn't have. Luckily the package format (with
the .desc file extension) is quite easy to grasp: it's a simple
text file with some metainformation such as a description and a URL where
the source of the program can be downloaded. T2 understands a lot of build
systems (among others GNU autoconf, Makefiles, cmake, Python setup.py and
Perl Makefile.PL) and automatically fetches and extracts the source,
modifies the package build and compiles and installs the software. So in
most cases you only have to fill in some basic information to create a new
T2 package. In case this doesn't work, you have to add a separate
.conf file that modifies the build process or .patch
files with patches to the source. More information about the process can be
found in the T2 handbook, and there is also a simple package creation
tutorial.
When you have created a new package, contributing it to the T2 mailing list guarantees that it will be added to the repository. There is also the IRC channel #t2 on Freenode, where a small but helpful community is available. All in all, the process of writing your own packages is really straightforward: last year, your author contributed a handful of packages to T2 while evaluating the distribution, and it struck him how extremely readable and self-documenting the package format is.
The future
T2 SDE is not only a cross-architecture distribution, it also wants to become cross-platform. While currently the only platform it uses is the Linux kernel, a long-term goal is support for other open source kernels like MINIX, GNU Hurd, *BSD, Haiku, OpenDarwin or OpenSolaris. At the moment no work is being done in this domain, but the build system should make the task doable. According to René, who is especially interested in having a microkernel to run T2 on, it is not so difficult besides patching some of the packages:
If GCC can produce working executables for the platform, it's an easy game: you just have to package the kernel header and C library and you're already halfway. Most packages should already build, and then you just have to collect the kernel sources into a kernel package and maybe package some system control tools.
A first step into the direction of other kernels has already been made, and it is, surprisingly, support for Windows. More specifically, T2 added support for MinGW in August of last year. MinGW (Minimalist GNU for Windows) is a port of GCC and GNU Binutils for use in the development of Windows applications. This means that T2 can be used to cross-compile 32-bit Windows binaries on a Linux system. The work has been done by ExactCODE for a client who wanted to compile a Windows executable from a more automated (read: UNIX-like) environment.
Another important mid-term project is improved LLVM/Clang support, René says:
It is already pretty usable. I have one virtual machine that has most executables compiled by LLVM. However, there is still some work needed on cross-compiling and bootstrapping the base system, as well as compiling the Linux kernel, because LLVM has issues with some advanced inline assembly and 16-bit boot code.
Conclusion
If you want to use T2 SDE as a desktop system, expect to invest a lot of
time chasing dependencies and configuring a lot of details yourself. Because T2 SDE
doesn't have extensive documentation about the daily use of the system,
like Gentoo and Arch Linux have, it's no trivial task. However, its
source-based nature and its clean BSD-like philosophy will surely appeal to
do-it-yourself users.
These issues notwithstanding, T2 SDE is a powerful and flexible Linux distribution for all sorts of purposes. What's interesting is that it offers just one distribution build kit that can be used to create various targets, from embedded to desktop, while many other distributions have different versions for different targets. Moreover, T2's handbook covers extensively how to create packages and how to build your own distribution. If you want to build a special-purpose Linux distribution, T2 SDE should be one of the first places to look.
(
Log in to post comments)