SCO
SCO Contact and feedback
SCO

Home > Developers > CoreDump > Volume 7

Linux Emulator Now Available for SCO Platforms

One of the main reasons many developers are attracted to UNIX® systems as a development and deployment platform is the "Open" nature of the operating system. Today there are many variants of UNIX systems available on the market. One of the more popular systems with developers is Linux®. It integrates well with most shareware tools, and its source code is freely available. SCO engineer Michael Davidson, in conjunction with a few individual developers has come up with a Linux emulator for SCO OpenServer™ and UnixWare® systems called "lxrun". The official lxrun home page is at http://www.ugcs.caltech.edu/~steven/lxrun/,  and the latest stable releases are also available on the SCO® Skunkware™ site.   Below is an excerpt of the lxrun FAQ, maintained by Ron Record of SCO and Steve Ginzburg, the current maintainer of the lxrun source.

Q: What is "lxrun"?

A: lxrun is a Linux emulator for SCO OpenServer and UnixWare machines.

Q: How does lxrun work?

A: It works by remapping system calls on the fly. As it turns out, there's not much difference between Linux and SCO binaries. The main difference is the way in which system calls are handled. In Linux, an "int $0x80" instruction is used, which jumps to the system-call-handling portion of the Linux kernel. On SCO systems, "int $0x80" causes a SIGSEGV signal. lxrun intercepts these signals and calls the SCO equivalent of the system call that the Linux program attempted. The result is that the Linux binary runs (with the help of lxrun) on the SCO platform with a small (usually negligible) performance penalty. All this is accomplished without modifying the kernel.

Q: How can I get started using lxrun!

A: Follow these steps:

1. Unpack the latest pre-compiled distribution, available at the lxrun home page

(http://dontask.foo.net/lxrun) and at the SCO Skunkware site http://www.sco.com/skunkware).

Do this as "root" from the root directory (/). Issue the commands (assuming you downloaded into /tmp) :

# cd /

# gzcat /tmp/lxrun-x.x.x.tar.gz | tar xf -

(where x.x.x is the version you downloaded.)

The lxrun distribution should extract into the /etc and /usr/local directories.

2.Copy a Linux binary to the /usr/local/linux/bin directory If you don't have a Linux system at hand, use one of the mirrors at ftp://sunsite.unc.edu/pub/Linux/welcome.html to download an app off the net. Let's say the Linux binary is called "lyap".

3. Create a symbolic link to "lxfront" as follows :

# ln -s /usr/local/linux/bin/lxfront /usr/local/bin/lyap

4. Type "/usr/local/bin/lyap" or simply "lyap" if

/usr/local/bin is in your execution search path.

4b. Optionally, set the environment variable LINUX_ROOT to "/usr/local/linux" and execute your Linux applications by running "lxrun (app-pathname)" where "(app-pathname)" refers to the Linux application path (lxfront does this for you).

Q: What binary formats does lxrun support?

A: lxrun understands Intel® Linux a.out and ELF format binaries.

Q: What does lxrun need in order to work?

A: To run most Linux programs, lxrun requires the help of the Linux dynamic loader (ld.so) and whatever Linux shared libraries are required by the program. Follow the steps above to set up lxrun.

Q: What sorts of Linux binaries work well with lxrun?

A: Most programs that do not rely on Linux specific quirks or deal directly with hardware should work under lxrun. Users of lxrun have reported success with raplayer (RealAudio client), xquake, the StarOffice suite, gcc (the GNU C compiler), and a myriad of smaller apps and utilities. While running most apps is usually straightforward, installing them and getting everything set up correctly can be tricky. See the official lxrun WWW site (http://dontask.foo.net/lxrun) for hints on getting some of the more troublesome apps working.

Q: How complete is lxrun?

A: Somewhat complete. Obviously, the more system calls lxrun is able to translate, the more complete its emulation capabilities. In recent releases of lxrun, there are still quite a few unimplemented system calls, but they are calls that are not used very often. So lxrun can successfully run _many_ Linux binaries.

Q: What if I find a Linux binary that lxrun doesn't support?

A: Follow these simple steps:

  1. Go to http://www.sco.com/skunkware and make sure you have the most recent version of lxrun. If not, download the latest one and try it. We are updating lxrun with new system calls all the time.
  2. Recompile lxrun with the TRACE option enabled. (This requires modifying one line in the Makefile.) This will cause lxrun to produce a history of all system calls used by the binary as it was run (similar to the "truss" and "trace" commands). The trace dump will be created in a file called "/tmp/lxrun.nnn" where "nnn" is the process id.
  3. Try to narrow down exactly which system call failed. Most likely, the failure will be due to a system call that has not yet been implemented in lxrun.
  4. Implement the system call mapping. This is usually pretty easy to do. The vast majority of lxrun's code does mappings of this sort, so you can pick out almost any source file to see how it is done. Chances are, the system call you need to remap is already in one of the lxrun source files, but its code looks something like this:

int lx_flock() { errno=ENOSYS; return -1; }

This means that you're the first person who has gotten around to mapping that particular system call.

5. After making your modification, recompile lxrun and see if it works. You may have to remap more than one system call to get your binary working!

6. E-Mail your changes to skunkware@sco.com. This way, we can put your changes into the next release of lxrun.

7. If steps 1-5 seem are beyond your programming ability, contact skunkware@sco.com  and maybe one of the Skunk team will have time to give you a hand with it. Make sure to tell us exactly what program you're having trouble with, and if possible, tell us where you got it.