www.linuxbase.org -> Sample Implementation -> Building the LSB-si

Instructions for Building the LSB Sample Implementation

The LSB Sample Implementation (LSB-si), is a minimal LSB-conforming runtime environment used for testing purposes. Think of it as a mini Linux distro that you can build yourself.

Build Process

The LSB-si is built from clean upstream package sources. The build instructions are captured in a set of XML files which drive a tool called nALFS; the concept is derived from the Linux From Scratch project.

Source code for the LSB-si build environment can be obtained from the LSB bzr tree. The code can be checked out from either a stable or devel tree. (even if you're not an LSB developer, having a working directory can let you check developments more quickly by doing a "bzr upull"). For an example using a devel tree, see the build recipe below.

You can browse the bzr tree web interface. Currently the si is in only 3.1 and devel.

You will also need to check out (or export) the tools/nALFS directory to get the build tool. See the build recipe for an example.

Source code for the patches to the base tarballs are in the bzr tree in si/build/patches. These should be copied to the package source directory. The base tarballs must be obtained separately. Once the build area has been configured, a provided tool (entitycheck.py) can be used to populate the package source directory.

The same tool can be used to check if all the necessary files are present before starting a build. With a -c option, it will do a more rigorous test, checking md5sums, not just existence. Every effort has been made to describe reliable locations for the files, but sometimes a project chooses to move an old version aside after releasing a new one (if they have a history of doing so, the location where old versions are placed is probably already captured). The packages are also mirrored on http://ftp.linux-foundation.org/pub/lsb/impl/packages. Still, retrieval sometimes fails; entitycheck.py will inform of missing files and the expected locations are listed in extras/package_locations so it's possible to try to fetch the missing packages manually.

Build Recipe

  1. Obtain LSB-si sources from bzr, and if necessary, the nALFS tool.
      bzr branch http://bzr.freestandards.org/lsb/devel/si
      bzr branch http://bzr.freestandards.org/lsb/devel/nALFS
    Substitute '3.1' instead of 'devel' to grab the 3.1 version.

  2. From here on, you'll need to operate as superuser, as the build process does mounts and the chroot command, operations restricted to root in most environments.

  3. Configure the build environment: There's a simple configuration script that localizes the makefile, some of the entities, and other bits. The main question is where you're going to build the LSB-si. The default location is /usr/src/si. Make sure the build directory exists and is in a place that has enough space (see Notes below).
      $ cd si/build
      $ ./Configure
    	    

    ... and answer the questions ...

  4. Check that the package/patch area is up to date and populate if it isn't:
      # make check

    If make check reports any packages missing, do make update to fetch them from upstream:

      # make update

    Keep running make check until no missing files or bad checksums are reported.

  5. You're now ready to build the lsbsi:
      # make lsbsi

  6. If there's a problem, make lsbsi should resart the build where it failed. If the interruption happened during the lsbsi-intermediate phase, it is likely that the whole phase will be restarted - this is normal.

    Building the lsbsi will take anywhere from 3 to 8 hours depending on the configuration of the system being used.

  7. To build the add-on packages lsbsi-test, lsbsi-boot, lsbsi-graphics, lsbsi-desktop and lsbsi-uml requires an additional step. This step is not dependent on the lsbsi (phase 3) step having completed, but it is dependent on the lsbsi-intermediate (phase 2) step being complete.
      # make addons

    Building the addon packages will take anywhere from 1 1/2 to 4 hours depending on the configuration of the system being used.

  8. To build the buildenv tarball that provides a chroot build environment, another step is required. This step is only dependent on the bootstrap phase having completed.
      # make buildenv

    Building the buildenv package will take anywhere from 4 to 10 hours depending on the configuration of the system being used.

  9. Before the buildenv can be used it must be packaged into an rpm file.
      # cd si/build/packages/buildenv
      # make

  10. To build the UML installable package (ia32 build host/target only). This step is dependent on all of the other phases, including the addons, having completed.
      # cd si/build/rpm
      # make

Miscellaneous Notes

The build takes a lot of space (around 5 GB), and may take a lot of time. A full build on a fast x86_64 system is about 7.5 hours; depending on archictecture, memory and processor speed it may take as much as 20 hours.

If the build stops, voluntarily or through some problem, there should be a fair bit of support for restartability, but this is not perfect. In particular, be cautious about cleaning out any of the build areas, as the package directory may still be bind-mounted. Each of the team members has accidentally removed the packages directory more than once, causing lots of delay while it's refetched (it pays to make a copy of this directory somewhere else!). Be careful! The Makefile has a clear_mounts target that may be helpful.


Last modified 2008-05-16 stew benedict