MirOS Manual: compat_openbsd(8)

COMPAT_OPENBSD(8)        BSD System Manager's Manual         COMPAT_OPENBSD(8)


     compat_openbsd - setup for running OpenBSD binaries under emulation


     MirOS supports running OpenBSD binaries. Most binaries for OpenBSD 3.8
     and below should work.

     The OpenBSD compatibility feature is active for kernels compiled with the
     COMPAT_OPENBSD option and the kern.emul.openbsd sysctl(8) enabled.

     A lot of programs are dynamically linked. This means that the OpenBSD
     shared libraries that the programs depend on and the runtime linker are
     also needed. Additionally, a "shadow root" directory for OpenBSD binaries
     on the MirOS system will have to be created. This directory is named
     /emul/openbsd. Any file operations done by OpenBSD programs run under
     MirOS will look in this directory first. So, if an OpenBSD program opens,
     for example, /etc/passwd, MirOS will first try to open
     /emul/openbsd/etc/passwd, and if that does not exist open the 'real'
     /etc/passwd file. It is recommended that OpenBSD packages that include
     configuration files, etc., be installed under /emul/openbsd, to avoid
     naming conflicts with possible MirOS counterparts. Shared libraries
     should also be installed in the shadow tree.

     Generally, it will only be necessary to look for the shared libraries
     that OpenBSD binaries depend on the first few times that OpenBSD programs
     are installed on the MirOS system. After a while, there will be a suffi-
     cient set of OpenBSD shared libraries on the system to be able to run
     newly imported OpenBSD binaries without any extra work.

Setting up shared libraries

     How to get to know which shared libraries OpenBSD binaries need, and
     where to get them? Basically, there are two possibilities. (When follow-
     ing these instructions, root privileges are required on the OpenBSD sys-
     tem to perform the necessary installation steps).

     1.   Access to an OpenBSD system: In this case temporarily install the
          binary there, see what shared libraries it needs, and copy them to
          the MirOS system. Example: ftp the OpenBSD binary of SimCity. Put it
          on the OpenBSD system, and check which shared libraries it needs by

                me@freebsd% ldd /usr/local/lib/SimCity/res/sim

                     -lXext.6 => /usr/X11R6/lib/libXext.so.6.0 (0x100c1000)
                     -lX11.6 => /usr/X11R6/lib/libX11.so.6.0 (0x100c9000)
                     -lc.2 => /usr/lib/libc.so.2.1 (0x10144000)
                     -lm.2 => /usr/lib/libm.so.2.0 (0x101a7000)
                     -lgcc.261 => /usr/lib/libgcc.so.261.0 (0x101bf000)

          All the files from the last column should be placed under
          /emul/openbsd. The following files would therefore be required on
          the MirOS system:


          Note that if an OpenBSD shared library with a matching major revi-
          sion number to the first column of the 'ldd' output is already
          present, it isn't necessary to copy the file named in the last
          column to the MirOS system; the one already there should work. It is
          advisable to copy the shared library anyway, if it is a newer ver-
          sion. The old one can be removed. So, if this library exists on the


          and the ldd output for a new binary is:

                -lc.2 => /usr/lib/libc.so.2.1 (0x10144000)

          it isn't necessary to copy /usr/lib/libc.so.2.1 too, because the
          program should work fine with the slightly older version. libc.so
          can be replaced anyway, and that should leave:


          Finally, the OpenBSD runtime linker and its config files must be
          present on the system. These files should be copied from the OpenBSD
          system to their appropriate place on the MirOS system (in the
          /emul/openbsd tree):


     2.   No access to an OpenBSD system: In that case, get the extra files
          from various ftp sites. Information on where to look for the various
          files is appended below.

          Retrieve the following files (from _one_ ftp site to avoid any ver-
          sion mismatches), and install them under /emul/openbsd (i.e. foo/bar
          is installed as /emul/openbsd/foo/bar):


          ldconfig and ldd don't necessarily need to be under /emul/openbsd,
          they can be installed elsewhere in the system too. Just make sure
          they don't conflict with their native MirOS counterparts. A good
          idea would be to install them in /usr/local/bin as ldconfig-openbsd
          and ldd-openbsd or adjust the environment variable PATH appropriate-
          ly to include /emul/openbsd/{{,usr.}{,s}bin}.

          Run the OpenBSD ldconfig program with directory arguments in which
          the OpenBSD runtime linker should look for shared libs. /usr/lib is
          standard. For example:

                me@openbsd% mkdir -p /emul/openbsd/var/run
                me@openbsd% touch /emul/freebsd/var/run/ld.so.hints
                me@openbsd% ldconfig-openbsd /usr/X11R6/lib /usr/local/lib

          Note that argument directories of ldconfig are mapped to
          /emul/openbsd/XXXX by MirOS BSD's compat code, and should exist as
          such on the MirOS system. Make sure
          /emul/openbsd/var/run/ld.so.hints exists when running FreeBSD's
          ldconfig; if not, MirOS BSD's /var/run/ld.so.hints could be lost.

          OpenBSD ldconfig should be statically linked, so it doesn't need any
          shared libraries by itself. It will create the file
          /emul/openbsd/var/run/ld.so.hints. The OpenBSD version of the ldcon-
          fig program should be rerun each time a new shared library is added.

          The MirOS system should now be set up for OpenBSD binaries which
          only need a shared libc. Test this by running the OpenBSD ldd on it-
          self. Suppose that it is installed as ldd-openbsd, it should produce
          something like:

                me@mirbsd% ldd-openbsd $(which ldd-openbsd)

                     -lc.2 => /usr/lib/libc.so.2.1 (0x1001a000)

          This being done, new OpenBSD binaries can now be installed. Whenever
          a new OpenBSD program is installed, it should be determined if it
          needs shared libraries, and if so, whether they are installed in the
          /emul/openbsd tree. To do this, run the OpenBSD version ldd on the
          new program, and watch its output. ldd (see also the manual page for
          ldd(1)) will print a list of shared libraries that the program
          depends on, in the form -l<majorname> => <fullname>.

          If it prints "not found" instead of <fullname> it means that an ex-
          tra library is needed. Which library this is, is shown in <major-
          name>, which will be of the form XXXX.<N>. Find a
          libXXXX.so.<N>.<mm> on an OpenBSD ftp site, and install it on the
          MirOS system. The XXXX (name) and <N> (major revision number) should
          match; the minor number(s) <mm> are less important, though it is ad-
          vised to take the most recent version.

Finding the necessary files

     Note: the information below is valid as of Oct 2004, but certain details
     such as names of ftp sites, directories and distribution names may have
     changed since then.

     OpenBSD distribution is available on a lot of ftp sites. Sometimes the
     files are unpacked, and individual files can be retrieved, but mostly
     they are stored in distribution sets, usually consisting of subdirec-
     tories with gzipped tar files in them. The primary ftp site for the dis-
     tribution is:


     Mirror sites are described at:


     This distribution consists of a number of tar-ed and gzipped files. Nor-
     mally, they're controlled by an install program, but the files can be re-
     trieved "by hand" too. The way to look something up is to retrieve all
     the files in the distribution, and "tar ztvf" through them for the files
     needed. Here is an example of a list of files that might be needed:

           Needed          Files

           ld.so           5.0-RELEASE/base/base.??
           ldconfig        5.0-RELEASE/base/base.??
           ldd             5.0-RELEASE/base/base.??
           libc.so.6       5.0-RELEASE/base/base.??
           libX11.so.6     5.0-RELEASE/packages/x11/XFree86-libraries-??
           libXt.so.6      5.0-RELEASE/packages/x11/XFree86-libraries-??

     The files called "base.??" are tar-ed, gzipped and split, so they can be
     extracted with "cat base.?? | tar zpxf -".

     The XFree86 libraries are compressed with bzip2 and can be extracted with
     "bzcat <file> | tar pxf -". Note: The bzip2 utilities are not part of a
     base MirOS system. bzip2 can be added via packages(7) or ports(7).

     Simply extract the files from these compressed tarfiles in the
     /emul/openbsd directory (possibly omitting or afterwards removing un-
     necessary files).


     compat_openbsd only works on the i386 architecture.


     The information about OpenBSD releases may become outdated. This manual
     page is too visibly derived from the freebsd one.

MirOS BSD #10-current          October 26, 2004                              3

Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.