Installing, Configuring and Porting XFLAT Shared Libraries


Table of Contents

Installing XFLAT Shared Libraries in the Toolchain

Toolchain Independence - One of the features of the XFLAT support, however, is that it does not depend on specifics of the toolchain. In principle, the XFLAT shared library support should be usable without change to the ARM GNU toolchain. Extension to non-GNU, non-ARM toolchains is also possible, but not without some changes to the base code.

Build Script - The following is a snippet from the Cadenux toolchain build script. This snippet illustrates how the XFLAT shared library support is built and installed into the Cadenux ARM7 toolchain:

Build Steps.

<<Table of Contents>>

Installing XFLAT Shared Libraries in the Target Filesystem

When the target system is built in the Cadenux BSP, two target platform images are produced: One that that contains the kernel and one that contains the contents of a read-only file system. All application logic (including kernel modules) must be installed into the read-only file system image when the Cadenux BSP is built and before the file system image is loaded into the target machine flash memory. This file build process consists of several steps:

  1. Creation of an copy of the target system file system on the host machine,
  2. Copying of applications into the correct directories in the file system copy, then
  3. Use of file-system-specific tools to convert the file system copy into something that can be loaded into, and used by, the target system.

In the preceding section, we saw that the installation of the XFLAT tool chain installed several ARM7 binaries into the Cadenux toolchain under /opt/Cadenux/${CADENUX_ARCH}/${CADENUX_KERNEL}/crossdev/arm-uclinux/lib. Subsequent installation of these XFLAT binaries into the target file system consists of copying these files from the tool lib directory into the target file system copy (during step #2 above). Here is the relevant snippet from the Cadenux BSP make logic:

Where TOOL_DIR is the location in the Cadenux tool chain where the XFLAT binaries were stored (same as /opt/Cadenux/${CADENUX_ARCH}/${CADENUX_KERNEL}/crossdev/arm-uclinux/lib), ${FSROOT_DIR} is the location of the root of the target file system copy, and ${KERNEL_MODULES} is the directory that the kernel will expect to find kernel modules at runtime.

Note that only copies of the XFLAT dynamic loader (, the XFLAT kernel module (binfmt_xflat.o) and shared libraries ( need be copied in to the target file system copy.

<<Table of Contents>>

Configuring XFLAT Shared Libraries

The XFLAT shared library logic was designed as part of the Cadenux toolchain. For this reason, it does not have extensive configuration tools. However, all configuration logic has been extracted and retained in a single file: ARM7 shared library support can be configured for a customized installation by modifying the single file xflat/Make.defs. This "makefile fragment" is included by every Makefile in the XFLAT directory tree; any changes made here will effect the generation of all XFLAT code.

The xflat/Make.defs contains definitions that characterize and make environment and many definitions that derive from these environmental definitions. It should be necessary only to modify this environmental definitions to customize the XFLAT source to work in most environments. The following table identifies the key environmental definitions provided in xflat/Make.defs:

ARCH_TOOL_DIR and ARCH_LIB_DIR Defines the path to the cross development tools
ARCH_INC_DIR, ARCH_INC1_DIR, and ARCH_INC3_DIR These are the default directory paths used by your compiler. This can be found by simply compiler something using the -v option.
ARCH_TOOL_PREFIX This is the prefix that when added to the beginning of a generic tool name (like gcc) will produce the fully qualified path to the specific cross-development tool
KERNEL_VERSION Identifies the Linux kernel version (only 2.0 and 2.4 are supported)
KERNEL_DIR Identifies the path to the Linux kernel
ARCHDEFINES, ARCHWARNINGS, ARCHOPTIMIZATION, ARCHDEBUGFLAGS, ARCHPICFLAGS, and ARCHCPUFLAGS These are used to generate various compiler flags as needed for the target platform.
ARCHLDFLAGS_FLAT, ARCHLLDFLAGS_FLAT, ARCHLDFLAGS1, and ARCHLLDFLAGS1 These are used to generate various linker flags as needed for the target platform.

<<Table of Contents>>

Porting XFLAT Shared Libraries

As of this writing, the XFLAT shared libraries have only been implemented for the ARM7 processor. However, the underlaying logic does not depend upon any characteristics of the ARM7 (other than its lack of an MMU). As a consequence, the XFLAT shared libraries should be portable to other MMU-less target platforms.

Provisions have been made in the XFLAT architecture to simplify some future port to another target platform. Only the following areas are likely to require modification:

<<Table of Contents>>

Copyright 2002 by Cadenux, LLC. All rights reserved.