Linux i386 binary emulation on FreeBSD/amd64

Tim Robbins <tjrfreebsd.org>

FreeBSD users on the i386 and Alpha platforms have long been able to run their favourite binary-only Linux applications using the kernel's Linux emulation layer. This page provides patches and instructions on setting up Linux/i386 emulation on the amd64 platform, allowing popular applications such as Java, Acrobat Reader, OpenOffice.org, Netscape and RealONE Player to be run.

Note: The Linux base system and a significant number of Linux applications can now be installed more conveniently on AMD64 systems using the FreeBSD Ports Collection. The information on this page is provided for historical value only.

Rebuilding the kernel

  1. Add the following lines to your kernel configuration file:
      options 	LINPROCFS
      options 	COMPAT_43
      options 	COMPAT_LINUX32
    
  2. Build and install a new kernel. Reboot.

Creating the directory hierarchy & installing libraries

  1. Download the following files from the slackware-10.0/slackware directory on your local Slackware mirror:
  2. Run the following commands as root:
    mkdir /compat/linux
    cd /compat/linux
    tar xvpzf /somewhere/aaa_base-10.0.0-noarch-1.tgz
    sh install/doinst.sh
    rmdir dev home root tmp var/tmp
    tar xvpzf /somewhere/aaa_elflibs-9.2.0-i486-1.tgz
    sh install/doinst.sh
    tar xvpzf /somewhere/glibc-solibs-2.3.2-i486-6.tgz
    sed -e 's,/sbin/ldconfig,/nonexistent,g' -e 's,cp -a,cp -p,g' -i '' install/doinst.sh
    sh install/doinst.sh
    tar xvpzf /somewhere/x11-6.7.0-i486-4.tgz
    sh install/doinst.sh
    echo '/usr/X11R6/lib' >etc/ld.so.conf
    brandelf -t Linux sbin/ldconfig
    sbin/ldconfig
    
  3. Add the following line to your /etc/fstab file:
    none	/compat/linux/proc	linprocfs	rw	0	0
    
    Run mount -a or reboot to mount /compat/linux/proc.

Installing utilities and additional libraries (optional)

You may download other Slackware packages and install them with the same tar xvpzf foo.tgz && sh install/doinst.sh commands used above. The following packages are suggested for a fairly minimal POSIX-style userland: bash bzip2 coreutils cpio cxxlibs findutils gawk grep gzip less sed tar. None of these are required to install applications in the proceeding section.

Installing Applications

This section presents instructions for installing certain popular Linux applications that are not available for FreeBSD/amd64. All of the applications mentioned here are known to work reasonably well.

Acrobat Reader 5.0.9 (Adobe Systems Inc.)

  1. Download linux-509.tar.gz from the Adobe FTP site.
  2. Untar it into a temporary directory.
  3. Run the INSTALL script and follow the prompts. (Ignore the warning about FreeBSD not being supported.
  4. Run sed -i '' -e 's,Linux),Linux|FreeBSD),' /usr/local/Acrobat5/bin/acroread, adjusting the path if necessary.
  5. You're done! Run /usr/local/Acrobat5/bin/acroread as a normal user.

Java Development Kit 1.5.0 beta 2 (Sun Microsystems Inc.)

  1. Visit the Sun's Java 2 Platform Standard Edition 1.5.0 Beta 2 web page. Click the SDK download link. Read and agree to the license. Click on the Linux self-extracting file link. Download the jdk-1_5_0-beta2-linux-i586.bin file.
  2. Make the file executable with chmod and run it. Read and agree to the license.
  3. The JDK will be extracted to the jdk1.5.0 subdirectory of the current working directory. You may want to move it somewhere else (e.g. /usr/local/java) and add it to your PATH. You're done!

Note: The JVM crashes during heavy use of graphical apps (SwingSet2, Java2Demo). The i386 Linux emulation code has the same problem.

Netscape 7.1 (Netscape Communications Corp.)

To be written.

OpenOffice.org 1.1.2 (Sun Microsystems Inc./OpenOffice.org)

  1. Visit the OpenOffice.org 1.1.2 Downloads page. Choose your language (these steps assume English.) Choose the Linux (x86) operating system. Choose a local or fast mirror. Click the Continue to Download button. While you wait, read the "Invitation for Contributing" and consider donating to OpenOffice.org.
  2. You should now have OOo_1.1.2_LinuxIntel_install.tar.gz (if you chose English.) Untar it, change into the OOo_1.1.2_LinuxIntel_install directory and run setup. Ignore the warning about libc.so.6 not being found.
  3. Follow the prompts to install the program.
  4. You're done! You can now run ~/OpenOffice.org1.1.2/soffice (or wherever you installed it.)

RealONE Player 9.0 (RealNetworks)

  1. Visit the Real.com User Supported RealPlayer Download Page. Fill in the form. Click the button to download the alpha version of RealONE player.
  2. You should end up with a file called r1p1_linux22_libc6_i386_a1.bin; make it executable with chmod then run it as a normal user and follow the prompts to install it.
  3. RealONE Player will start automatically and has been installed to ~/RealPlayer9. You're done!