![]() |
|
||||
LynxOS User's Guide |
Linux ABI Compatibility
The Linux ABI (Application Binary Interface) compatibility feature of LynxOS allows Linux binary applications to run under LynxOS. This chapter provides a detailed overview of the Linux ABI feature.
Overview
LynxOS supports executing dynamically-linked Linux binary applications on LynxOS systems as if they were native LynxOS applications. There is no need to rebuild Linux applications with LynxOS tools, or even access the source code. Linux application binaries can be installed and executed on a LynxOS machine in the same manner as they are installed and executed on a Linux system. The Linux ABI feature adds a new level of flexibility by allowing users to use both Linux and LynxOS binaries in parallel on a single LynxOS system.
Linux ABI compatibility is made possible by adding a Linux ABI Layer that includes Linux libraries. "Native" LynxOS applications (applications built for LynxOS) are unaffected by the addition of the Linux ABI Layer.
Installing the Linux ABI Layer
The Linux ABI Layer is installed from the Additional Components CD-ROM. Refer to the LynxOS Installation Guide for installation instructions.
In addition to the basic set of standard Linux shared libraries (linuxabi.tar.gz), LynuxWorks provides a more comprehensive set of standard Linux shared libraries (linuxabi_advanced.tar.gz) for users who require libraries that may not be included in the basic set. Note that this file is See the LynxOS Installation Guide for more details on installing these libraries.
Linux ABI Layer
This section provides a brief overview of the Linux ABI software layer. The following diagram shows how a Linux binary runs on LynxOS under the Linux ABI Layer:
![]()
Linux ABI Software LayerA dynamically-linked application (built for either LynxOS or Linux), relies on the ld.so dynamic linker and loader to complete the process of linking all necessary references to shareable objects before the application is executed.
Linux application binaries are linked by ld.so into the shared libraries that compose the Linux ABI Layer. This Linux ABI layer translates Linux application shared object interface calls into calls that are binary-compatible with LynxOS kernel interfaces. Typically, implementation of standard interfaces are similar enough between Linux and LynxOS that only a simple translation (or none at all) is required before a call from a Linux application can go into the LynxOS kernel.
Interoperability with LynxOS Native Applications
The Linux ABI Layer relies on the LynxOS ld.so dynamic linker to resolve Linux application calls into shared objects using an appropriate set of Linux shared libraries. Native LynxOS applications are not affected by the Linux ABI feature in any way. LynxOS native applications continue to be linked into the LynxOS native shared libraries, and function as before.
Linux ABI Shared Libraries
The following table shows the shared libraries included in the Linux ABI Layer. The libraries are located in the same directories as they are on Linux (specified in the DT_RPATH field of the application ELF header). This allows the LynxOS ld.so dynamic linker and loader to link the Linux binary into the Linux ABI shared libraries.
Linux ABI Shared Libraries x86 Shared Libraries PowerPC Shared Libraries lib/libm-2.2.2.so usr/X11R6/lib/libXi.so.6.0
Adding Linux Shared Libraries to LynxOS
Additional shared libraries not included in the LynxOS Linux ABI distribution may be required in order to run certain Linux applications. For instance, the PERL library extensions are needed to run the Linux-built perl binary on LynxOS. Such additional libraries must be copied by the user from a Linux system and installed in the appropriate directory on LynxOS. The Linux shared libraries do not need to be rebuilt.
Determining Linux Application Library Dependencies
The shared libraries required by a particular Linux application can be viewed with the ldd command on a Linux system. For example, the Linux ls command requires the following libraries:
libtermcap.so.2 => /lib/libtermcap.so.2 (0x4002d000)
libc.so.6 => /lib/i686/libc.so.6 (0x40031000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Updating Linux ABI Layer Libraries
Linux shared libraries can easily be updated to accommodate the needs of particular Linux applications. New libraries can easily be added to the system simply by copying them from Linux to the appropriate directories on a LynxOS system. Updated versions of shared libraries can also be added to the system by copying over the current shared library.
However, it is important to note that users should copy over the actual reference file, and not symbolic links to the reference file. For example, users should not copy over the file libncurses.so.5.2 and rename it libncurses.so.5. The Linux convention is to create a symbolic link linbncurses.so.5 to the updated library libncurses.so.5.2. This allows any application that calls libncurses.so.5 to access the updated shared libraries.
Linux ABI Shared Libraries that Should Not Be Overwritten
User should not overwrite the following shared libraries installed from the Linux ABI distribution:
These are LynxOS-specific shared libraries that have the same names as Linux shared libraries. These LynxOS files are vital for the Linux ABI feature to function. If these LynxOS files are accidentally replaced by the Linux-based shared libraries, the Linux ABI environment will not function.
Specifying Linux ABI Shared Library Paths
The LD_LIBRARY_PATH environment variable specifies a search path for ELF shared libraries used by the ld.so dynamic linker. To ensure that ld.so locates all Linux ABI libraries required for a particular Linux application, LD_LIBRARY_PATH must include the path names to all the locations (directories) where respective Linux ABI libraries are located. LD_LIBRARY_PATH must be set up and exported before a Linux application can be executed.
The following example shows how to set up LD_LIBRARY_PATH for the Linux telnet binary (assuming that the Linux telnet binary is installed in /linux/bin):
$ /usr/bin/opera
Running Linux Applications
This section discusses additional features and functions of the Linux ABI Compatibility Layer.
Linux Reference Distribution
The term "Linux Reference Distribution" is used to identify a particular version of Linux that is compatible with the Linux ABI Layer on LynxOS. The Linux Reference Distribution is composed of specific versions of these components:
The Linux Reference Distribution is used to validate and test Linux ABI Compatibility. Applications built on a supported version of the Linux Reference Distribution are supported. As of this printing, Linux applications built on the following Linux Reference Distribution are supported:
Refer to the LynxOS Release Notes for updates or changes to the supported Linux Reference Distribution.
Support for Dynamically Linked Applications
The Linux ABI implementation relies on the dynamic linker (ld.so) to resolve calls made by Linux binaries into the shared libraries that comprise the Linux ABI library. Such resolution is performed at run-time, when an application is loaded and linked by ld.so.
Support for Versioned Symbols
Linux binaries built on earlier releases of a supported Linux distribution should function when run on LynxOS. For example, if Red Hat 7.1 is the supported Linux reference distribution, applications built on Red Hat 6.x will run on LynxOS. This is because the LynxOS ld.so dynamic linker supports resolution of versioned symbols in a shared library.
The Linux ABI libraries (such as the libc library) contain multiple, versioned definitions of an interface entry point. These multiple definitions provide backward binary compatibility for earlier releases of Linux. A defined version of an interface corresponds to a particular version of the library, and thus to a particular release of Linux. When ld.so resolves links into a library, the version information is available with each unresolved symbol. This allows ld.so to determine the version of a symbol that the application requires. By linking into an appropriate version of symbols, ld.so ensures that there are no version-dependent discrepancies between the definition of the interfaces and the shared libraries.
Exceptions and Limitations
Certain Linux binaries are not supported by the Linux ABI Layer. The following table provides a list of features that are not supported with the Linux ABI Layer.
Extracting RPMs with rpm2cpio
Linux binaries are sometimes distributed as RPM files. Because LynxOS does not support RPM, users must manually extract the contents of the RPM file on the Linux system. The Linux utility rpm2cpio extracts the contents of the RPM file, which can then be piped to cpio:
For more information on using rpm2cpio and cpio, see the respective man pages.
Example -- Running Opera
The following example provides instructions for running the Opera Web Browser on a LynxOS x86 system with the Linux ABI Layer.
Installing Linux ABI Layer
- On the LynxOS system, mount the Additional Components CD-ROM to an available mount point. For example,
Downloading Opera
- On the Linux system, download Opera from http://www.opera.com. Download the following version of the Opera Web browser:
- Download the Opera RPM file to a user's home directory: <user_dir>.
- Make a directory for Opera and copy the RPM to that directory.
- Transfer the opera_demo.tar file to the LynxOS system via FTP or RCP.
- On the LynxOS system, extract the opera_demo.tar file:
Configuring the Linux ABI Layer
# export LD_LIBRARY_PATH=/lib:/usr/X11R6/lib: \
/usr/lib/qt- 2.3.1/lib:/usr/lib
- Set the DISPLAY variable to display to a local X server (if X and Motif are installed), or display to a remote X server:
Where <Xserver_IP_address> is the IP address of the X server. On the remote X server, enable remote X access with the xhost command:
Opera Web Browser Running on LynxOS
![]() LynuxWorks, Inc. 855 Branham Lane East San Jose, CA 95138 http://www.lynuxworks.com 1.800.255.5969 |
![]() |
![]() |
![]() |
![]() |