lesslinux.org Development Blog

Just another WordPress weblog

Do it yourself: Build stage01 and stage02

I recently assembled the build script to compile a completely free and open version of the Rescue System that started life as “Computerbild Notfall-CD 2.0”. The free version is dubbed “LessLinux Search and Rescue” and can be easily modified to build your own derivates. In the next three days I will guide you through the whole build process (kind of real time).

Currently the only supported build environment is VMware, this means you must have either VMware Workstation, VMware Player (Win, Linux) or VMware Fusion (Mac OS X) installed. Player is sufficient, since the build environments are considered as some kind of “disposable environment”. Note that the VMware image expands to up to 80GB, to prevent fragmentation and reach best performance you might want to put it on a separate partition.

You might download the VMware image from: http://download.lesslinux.org/builder/vmware-images/. This howto uses the file LessLinux_Builder_20100504_Ubuntu_910.zip. Unpack it and run it by calling ubuntu.vmx. As soon as the virtualized Ubuntu is fully started up, you can log in as root with an empty password. Set the password with the command passwd (note that at this point an english keyboard is active – for german readers this means “z” and “y” are swapped!). Log out and log in again using ssh.

Building stage01

The build of stage01 closely ressembles this chapter of the Linux From Scratch handbook. We basically build a set of tools under /tools that are later used to build the system itself in the second stage. Since just glibc, the toolchain and some of the basic Linux utilities are build, this step takes usually one and a half to four hours.

When logged in, change your directory to /mnt/archiv/LessLinux, there create three new subdirectories:

    cd /mnt/archiv/LessLinux
    mkdir llbuild llbuilder src

Change to llbuilder and download and unpack the source/script tarball of the release you intend to build:

    cd /mnt/archiv/LessLinux/llbuilder
    wget http://download.lesslinux.org/src/lesslinux-search-and-rescue-uluru-20100507-000000-buildscripts.tar.bz2
    tar xvjf lesslinux-search-and-rescue-uluru-20100507-000000-buildscripts.tar.bz2

This results in a new directory lesslinux-builder, change to this directory and start building of the first stage:

    cd /mnt/archiv/LessLinux/llbuilder/lesslinux-builder
    ruby builder.rb -n -s 2,3

This command tells the script builder.rb to run no tests and to skip the second stage (build of software within the chroot) as well as the third stage (assembly of the live system). When finished a backup of the resulting chroot environment as well as of the database at this point will be made — we will refer to those later.

Building stage02

In stage02 all the software defined in the XML build definitions in /mnt/archiv/LessLinux/llbuilder/lesslinux-builder/scripts/stage02 will be built. Since two kernels, Firefox, Thunderbird and lots of “expensive” C++-stuff are built you should calculate between one and four days for this build:

    cd /mnt/archiv/LessLinux/llbuilder/lesslinux-builder
    ruby builder.rb -n -s 1,3

It is also possible to specify breakpoints. This means to interrupt the build procedure after a certain package is being built. This feature is usually intended to build package by package after large changes to the package versions or build parameters. For example to stop right after xz (before building the kernels):

    ruby builder.rb -n -s 1,3 -d xz

You might want to take a look at the XML files located in scripts/stage02 to determine where to take breaks.

That’s it. As soon as you (and my stage02) build is complete, I will tell you how to assemble an actual working live system in stage03!


  • If a FTP download hangs, you might interrupt it by pressing Ctrl+C, then the download should try again via HTTP
  • If the build cannot start due to missing files you might either remove the stage02 build definition that uses the missing file or you manually download the file
  • VMware will suspend if you work on a nearly full file system, to prevent a dropped SSH connection from interrupting a build, use screen
  • If you started with lesslinux-search-and-rescue-uluru-20100413-192604-buildscripts.tar.bz2 the build fails at gnutls, in this case unpack lesslinux-search-and-rescue-uluru-20100507-000000-buildscripts.tar.bz2 in /mnt/archiv/LessLinux/llbuilder (this will replace scripts/stage02/5282_gnutls.xml and scripts/pkg_content/gnutls-2.8.6.xml), then run again builder.rb, the build will now continue and finish.

Comments are closed.