Linux under FreeBSD
Michael Lucas
FreeBSD has several options for using software from other platforms, such as Wine for Win32 and dosemu for DOS. BSDI, NetBSD, and OpenBSD binaries will run unmodified, and source code from many UNIX or Linux programs can be compiled without modification on FreeBSD. Additionally, FreeBSD includes kernel modules for Linux, SCO, and SVR4. These modules allow you to run unmodified binaries for these platforms on your FreeBSD machine. FreeBSD's Linux module works well enough that several commercial software packages for Linux have been included in the FreeBSD ports system. Similarly, this article was written on Sun StarOffice 5.1 for Linux, on my FreeBSD-current box. Because the last version of RealVideo for FreeBSD is version 3.0, I run RealVideo 5.0 for Linux.
In FreeBSD 3.3-stable or higher, Linux mode has two components: the kernel system call module, and the runtime environment.
The Linux Kernel Module
The kernel-loadable module, or KLM, supports Linux-specific system calls. You can determine whether the Linux KLM is loaded on your system by using:
#kldstat -v | grep linux
2 1 0xc08dc000 e000 linux.ko
15 linuxelf
16 linuxaout
#
(kldstat -v provides other useful information about your kernel, and is generally informative on any FreeBSD system.) If the module is not loaded, you can load it by becoming root and typing:
# linux
You can make this automatic at boot by setting linux_enable="YES" in /etc/rc.conf. Strictly speaking, you don't have to compile a custom kernel to support the Linux module. You'll be more satisfied with your results, however, if your kernel includes the following options:
options "P1003_1B" #POSIX infrastructure
options "_KPOSIX_PRIORITY_SCHEDULING" #Built-in POSIX priority scheduling
options "_KPOSIX_VERSION=199309L" #POSIX version kernel is built for
options SYSVSHM #System V shared memory
options SYSVMSG #System V semaphores
options SYSVSEM #System V messaging
options USER_LDT #allow user-level control of i386 ldt
For full instructions on building a custom kernel, check:
http://www.F
|