Customizations Using tsrpm

Creating a custom toolchain or RFS is a common procedure in developing embedded Linux systems.

Creating a Custom Toolchain

A cross-development toolchain is a collection of cross-tools (such as gcc and ld) and cross-libs (such as glibc and zlib) that provide the binaries that run on the host as a part of the build, the headers that get referenced during compilation, and the libraries that get linked in as a part of the build.

You might want to create custom toolchains for a number of different reasons, including the following:

  • To integrate new patches for in-place upgrades, enhancements, or bug fixes
  • To reconfigure toolchain packages to meet your specific application needs
  • To add new cross-libs or cross-tools

Use the following procedure to create a custom toolchain:

  1. Build the cross-tools.
  2. Build the target packages corresponding to all the cross-libs.
  3. Repackage the target packages as host packages for cross-lib installation.
  4. Install the new target packages to create the custom toolchain.

For example, to create a toolchain with gcc, binutils, and glibc, that has zlib as the only additional cross-lib, do the following:

# Build the cross-tools
for f in binutils gcc glibc;
do
   tsrpm --build --target=ppc7xx --nocross-tool --cross-tool $f
done


# Build the cross lib packages
for l in zlib ;
do
   tsrpm --build --target=ppc7xx $l
   tsrpm --convert-to-host -target=ppc7xx $l
done


# Install the packages built above to create a new toolchain.
# Caution this might overwrite your current toolchain.
tsrpm --install  --target=ppc7xx <rpm list>

Creating a Custom RFS

Given a collection of binary RPMs, the simplest way of creating a custom root file system (RFS) is to do the following:

[root@host pkgs]# tsrpm --target=ppc7xx --install --root `pwd`/here RPMS/target-glibc/*

The previous example actually works if you have a collection of RPMs that is self-contained as far as installation dependencies are concerned, and that contains no conflicts among the features supplied by the packages. However, the typical outcome of this exercise will be the following:

error: Failed dependencies:
   mkinitrd < 4.0 conflicts with initscripts-7.84-1
   bash conflicts with timesys-init-busybox-1.0-1
   initscripts conflicts with timesys-init-busybox-1.0-1
   hotplug < 3:2002_01_14-2 conflicts with usbutils-0.11-6.1

In reality, the process of constructing a custom RFS entails the following steps:

  1. Identify the key packages needed in the RFS.
  2. Identify the supporting packages, based on an iterative dependency analysis.
  3. Identify the customizations that you want to perform on the packages, such as exclusions and removing installation scripts.
  4. Create a script that constructs the desired RFS.

RFS design tools such as TimeSys’s System Configurator provide intuitive interfaces for target RFS design and automatically generate RFS creation scripts.