| |
|
Domain Registration -
Domain registration & domain search service from just
$5.95/year only |
|
|
|
Webhosting Service -
Webhosting service for single or multiple domain names at affordable price. |
|
|
Back to Index
|
Linux binary compatibility is not turned on by default. The easiest way to enable this
functionality is to load the linux KLD object (``Kernel
LoaDable object''). You can load this module by simply typing linux at the command prompt.
If you would like Linux compatibility to always be enabled, then you should add the
following line to /etc/rc.conf:
linux_enable="YES"
The kldstat(8) command can
be used to verify that the KLD is loaded:
% kldstat
Id Refs Address Size Name
1 2 0xc0100000 16bdb8 kernel
7 1 0xc24db000 d000 linux.ko
If for some reason you do not want to or cannot load the KLD, then you may statically
link Linux binary compatibility into the kernel by adding options
COMPAT_LINUX to your kernel configuration file. Then install your new kernel as
described in Chapter 9.
This can be done one of two ways, either by using the linux_base port, or by installing
them manually.
This is by far the easiest method to use when installing the runtime libraries. It is
just like installing any other port from the ports collection. Simply do the following:
# cd /usr/ports/emulators/linux_base
# make install distclean
You should now have working Linux binary compatibility. Some programs may complain
about incorrect minor versions of the system libraries. In general, however, this does
not seem to be a problem.
Note: There may be multiple versions of the emulators/linux_base port available, corresponding to different
versions of various Linux distributions. You should install the port most closely
resembling the requirements of the Linux applications you would like to install.
If you do not have the ``ports'' collection installed, you can install the libraries
by hand instead. You will need the Linux shared libraries that the program depends on and
the runtime linker. Also, you will need to create a ``shadow root'' directory, /compat/linux, for Linux libraries on your FreeBSD system. Any
shared libraries opened by Linux programs run under FreeBSD will look in this tree first.
So, if a Linux program loads, for example, /lib/libc.so,
FreeBSD will first try to open /compat/linux/lib/libc.so, and
if that does not exist, it will then try /lib/libc.so. Shared
libraries should be installed in the shadow tree /compat/linux/lib rather than the paths that the Linux ld.so reports.
Generally, you will need to look for the shared libraries that Linux binaries depend
on only the first few times that you install a Linux program on your FreeBSD system.
After a while, you will have a sufficient set of Linux shared libraries on your system to
be able to run newly imported Linux binaries without any extra work.
What if you install the linux_base port and your application
still complains about missing shared libraries? How do you know which shared libraries
Linux binaries need, and where to get them? Basically, there are 2 possibilities (when
following these instructions you will need to be root on your
FreeBSD system).
If you have access to a Linux system, see what shared libraries the application needs,
and copy them to your FreeBSD system. Look at the following example:
ELF binaries sometimes require an extra step of ``branding''. If you attempt to run an
unbranded ELF binary, you will get an error message like the following:
% ./my-linux-elf-binary
ELF binary type not known
Abort
To help the FreeBSD kernel distinguish between a FreeBSD ELF binary from a Linux
binary, use the brandelf(1)
utility.
% brandelf -t Linux my-linux-elf-binary
The GNU toolchain now places the appropriate branding information into ELF binaries
automatically, so this step should become increasingly unnecessary in the future.
If DNS does not work or you get this message:
resolv+: "bind" is an invalid keyword resolv+:
"hosts" is an invalid keyword
You will need to configure a /compat/linux/etc/host.conf
file containing:
order hosts, bind
multi on
The order here specifies that /etc/hosts is searched first
and DNS is searched second. When /compat/linux/etc/host.conf is
not installed, Linux applications find FreeBSD's /etc/host.conf
and complain about the incompatible FreeBSD syntax. You should remove bind if you have not configured a name server using the /etc/resolv.conf file.
|
|
|
|
© 2002-2004 Active-Venture.com
Website Hosting
Service
|
| |
|
Disclaimer: This
documentation is provided only for the benefits of our website hosting customers.
For authoritative source of the documentation, please refer to http://www.freebsd.org
|
|
|