Adding Packages Using tsrpm

Adding new cross tools or libraries and headers to the TimeSys-supplied toolchain is appropriate if you are adding a package for the benefit of all users on your build system. If you need additional headers and libraries in the toolchain temporarily, or for the benefit of a single user, you might be able to accomplish this more easily by adding a package to your local build environment.

Adding Packages to Installed Toolchains

If the package is a new cross-tool, it should already be available as a host RPM. If the package containing libraries and headers is a package that was built for the target, tsrpm can be used to transform the RPM into a host installable package via the --convert-to-host option. Then this package can be installed on the host by using either tsrpm or the normal RPM commands.

#convert to host
[root@host pkgs]# tsrpm --convert-to-host --target=ppc7xx  \
                            RPMS/target-glibc/popt-1.9.1-0.3.ppc7xx.rpm
 
#install
[root@host pkgs]# tsrpm --install --nodeps --target=ppc7xx  \
           /root/pkgs/i386-x-ppc7xx/RPMS/popt-ppc7xx-1.9.1-0.3.i386.rpm
*** finding rpms
   /root/pkgs/i386-x-ppc7xx/RPMS/popt-ppc7xx-1.9.1-0.3.i386.rpm
+ rpm -Uvh --noorder --dbpath /root/pkgs/ppc7xx/rpmdb --define \
                 _dbpath /root/pkgs/ppc7xx/rpmdb --relocate=/=/root/pkgs/ppc7xx/root \
                --nosignature --badreloc --ignorearch --ignoreos --force --nodeps 
                         /root/pkgs/i386-x-ppc7xx/RPMS/popt-ppc7xx-1.9.1-0.3.i386.rpm
Preparing...           ########################################### [100%]
   1:popt-ppc7xx       ########################################### [100%]
/opt/timesys/linux/6.1/ppc7xx/tools-host-linux/tsrpm/lib/rpm_install: 
*** Running /opt/timesys/linux/6.1/ppc7xx/tools-host-linux/tsrpm/lib/postinstall

Adding Packages to Your Build Environment

If you are porting a new package, or even rebuilding a package supplied with the distribution, you might need to add packages to your local package build environment. Adding a package is simple to do with tsrpm.

For example, if libpopt is not included in the standard toolchain, and is required to build a new package, it can be added to your local package build environment, as shown in the following example.

[juser@host oprofile2]$ tsrpm --target=mipsel --install-cross popt-1.9.1-0.3.mipsel.rpm

The headers and libraries get installed in the install-cross subdirectory of the current directory at an architecture-specific location. Subsequent tsrpm builds that are run in the directory will automatically pick up headers and libs from this area.

[juser@host oprofile2]$ find install-cross/ | grep mipsel |  grep popt
install-cross/mipsel-linux/manifest/popt
install-cross/mipsel-linux/manifest/popt-1.9.1-0.3
install-cross/mipsel-linux/include/popt.h
install-cross/mipsel-linux/lib/libpopt.a
install-cross/mipsel-linux/lib/libpopt.la
install-cross/mipsel-linux/lib/libpopt.so
install-cross/mipsel-linux/lib/libpopt.so.0
install-cross/mipsel-linux/lib/libpopt.so.0.0.0

Building Packages with Missing Dependencies

For some packages, the installed toolchain on your development host might not include all the headers and libraries needed to build a package successfully. In such a situation, you will need to add packages to the installed toolchains, or to extend your private build environment before building the package.

For instance, to build gdb for the target, the libraries from the ncurses package need to be present in the build environment – either in the toolchain or in your private build environment. The following example shows the build sequence for gdb. First, the ncurses package is built, then it is cross-installed in the user’s private build environment. After this, gdb can be built successfully.

[juser@host SRPMS] tsrpm --build --target=ppc440ep  rpm-sources/ncurses-5.4-5/*spec
[juser@host SRPMS] tsrpm --install-cross --target=ppc440ep ppc440ep/RPMS/ncurses-*rpm
[juser@host SRPMS] tsrpm --build --target=ppc440ep  rpm-sources/gdb-timesys-6.4-pre1/*spec

Determining Package Dependencies

If you are rebuilding a package for which you already have a binary RPM, determining package dependencies is as simple as querying the binary RPM by using the RPM --requires command, as shown in Installing Target Packages on the Host. Sometimes, the BuildReqs section in the .spec file captures this accurately. At other times, this is simply a matter of tracking configuration failures while building packages and then cross-installing packages, as shown in the section titled Adding Packages to Your Build Environment.