The GENERIC kernel in 2.1-STABLE is not configured for linux compatibility so you must reconfigure your kernel for it. There are two ways to do this: 1. linking the emulator statically in the kernel itself and 2. configuring your kernel to dynamically load the linux loadable kernel module (LKM).
To enable the emulator, add the following to your configuration file (c.f. /sys/i386/conf/LINT):
options COMPAT_LINUX
If you want to run doom or other applications
that need shared memory,
also add the following.
options SYSVSHM
The linux system calls require 4.3BSD system call compatibility. So
make sure you have the following.
options "COMPAT_43"
If you prefer to statically link the emulator in the kernel rather than use the loadable kernel module (LKM), then add
options LINUX
Then run config and install the new kernel as described in the
kernel configuration section.
If you decide to use the LKM you must also install the loadable module. A mismatch of versions between the kernel and loadable module can cause the kernel to crash, so the safest thing to do is to reinstall the LKM when you install the kernel.
% cd /usr/src/lkm/linux
% make all install
Once you have installed the kernel and the LKM, you can invoke
`linux' as root to load the LKM.
% linux
Linux emulator installed
Module loaded as ID 0
%
To see whether the LKM is loaded, run `modstat'.
% modstat
Type Id Off Loadaddr Size Info Rev Module Name
EXEC 0 3 f0baf000 0018 f0bb4000 1 linux_emulator
%
You can cause the LKM to be loaded when the system boots in either of
two ways. In FreeBSD 2.2.1-RELEASE and 2.1-STABLE enable it in
/etc/sysconfig
linux=YES
by changing it from NO to YES. FreeBSD 2.1-RELEASE and earlier do not
have such a line and on those you will need to edit /etc/rc.local to
add the following line.
linux