<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>The Linux+FreeBSD mini-HOWTO: Running foreign binaries</TITLE> <LINK HREF="Linux+FreeBSD-7.html" REL=next> <LINK HREF="Linux+FreeBSD-5.html" REL=previous> <LINK HREF="Linux+FreeBSD.html#toc6" REL=contents> </HEAD> <BODY> <A HREF="Linux+FreeBSD-7.html">Next</A> <A HREF="Linux+FreeBSD-5.html">Previous</A> <A HREF="Linux+FreeBSD.html#toc6">Contents</A> <HR> <H2><A NAME="s6">6. Running foreign binaries</A><!--FreeBSD dualboot!foreign binaries--></H2> <H2><A NAME="ss6.1">6.1 Running FreeBSD binaries under Linux</A> <!--FreeBSD dualboot!foreign binaries!FreeBSD in Linux--></H2> <P>The <CODE>iBCS</CODE> package has support for running FreeBSD binaries under Linux; but it's old and unmaintained. I cannot get it to work. Please let me know if you have had better luck with this. <P> <H2><A NAME="ss6.2">6.2 Running Linux binaries under FreeBSD</A> <!--FreeBSD dualboot!foreign binaries!Linux in FreeBSD--></H2> <P>FreeBSD has the ability to run Linux binaries, both in a.out and ELF formats. To do this you have to take the following three steps: <P> <OL> <LI>You have to enable Linux compatibility. To do this (in FreeBSD 2.2.2 --- details may vary in other versions) you have to edit your <CODE>/etc/rc.conf</CODE> file and change <PRE> linux_enable="NO" </PRE> to <PRE> linux_enable="YES" </PRE> and reboot. Another way to load the Linux binary support is to execute the command <CODE>/usr/bin/linux</CODE>. This way you don't have to reboot, and you don't always have the Linux binary support loaded (i.e. you save memory.) Remember to add the line <PRE> options COMPAT_LINUX </PRE> to the FreeBSD kernel config file if you build a new FreeBSD kernel. </LI> <LI>You have to install the Linux shared libraries if your Linux binaries are dynamically linked. The libraries are included in FreeBSD 2.2.{2,5,6} as the package <CODE>linux_lib-2.4.tgz</CODE> (newer versions might be available.) Run the following command to install the package: <PRE> pkg_add <path_to_package>/linux_lib-2.4.tgz </PRE> <path_to_package> is the directory where the package is stored. You may also load it off the net by: <PRE> pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable/All/linux_lib-2.4.tgz </PRE> or by re-running <CODE>/stand/sysinstall</CODE>. Enter ``Configure'', ``Packages'' and use the menus. You should execute the following command if you are running statically linked Linux binaries: <PRE> brandelf -t Linux <name_of_statically_linked_linux_binary> </PRE> </LI> <LI>Install the Linux program(s) you want to run. The program(s) can be installed on either UFS or ext2fs filesystems. See section <A HREF="Linux+FreeBSD-5.html#ext2fs">Mounting ext2fs filesystems under FreeBSD</A> for more information about using ext2fs filesystems under FreeBSD. </LI> </OL> <P>I have successfully run the Linux versions of Applixware 4.3 and Netscape 3.01 (both ELF format) under FreeBSD 2.2.2 using this method (yes, I know there is a native FreeBSD version of Netscape 4.) The Linux versions of acroread and StarOffice 3 and 4 also work well under FreeBSD. StarOffice 5 depends on native Linux threads and currently do not work under FreeBSD. Read the FreeBSD documentation for more information on this topic. <P> <HR> <A HREF="Linux+FreeBSD-7.html">Next</A> <A HREF="Linux+FreeBSD-5.html">Previous</A> <A HREF="Linux+FreeBSD.html#toc6">Contents</A> </BODY> </HTML>