📄 00000031.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: linuxrat (叫我老鼠错不了), 信区: Linux <BR>标 题: Linux under FreeBSD[Forward] <BR>发信站: BBS 水木清华站 (Mon Jan 3 15:07:35 2000) <BR> <BR> Original URL: <A HREF="http://www.samag.com/linux/articles/v09/i01/a1.shtml">http://www.samag.com/linux/articles/v09/i01/a1.shtml</A> <BR> ===============Begin============================ <BR> <BR> Linux under FreeBSD <BR> <BR> Michael Lucas <BR> _________________________________________________________________ <BR> <BR> lucas <BR> ________________________________________________________ <BR> <BR> FreeBSD has several options for using software from other platforms, <BR> such as Wine for Win32 and dosemu for DOS. BSDI, NetBSD, and OpenBSD <BR> binaries will run unmodified, and source code from many UNIX or Linux <BR> programs can be compiled without modification on FreeBSD. <BR> Additionally, FreeBSD includes kernel modules for Linux, SCO, and <BR> SVR4. These modules allow you to run unmodified binaries for these <BR> platforms on your FreeBSD machine. FreeBSD's Linux module works well <BR> enough that several commercial software packages for Linux have been <BR> included in the FreeBSD ports system. Similarly, this article was <BR> written on Sun StarOffice 5.1 for Linux, on my FreeBSD-current box. <BR> Because the last version of RealVideo for FreeBSD is version 3.0, I <BR> run RealVideo 5.0 for Linux. <BR> <BR> In FreeBSD 3.3-stable or higher, Linux mode has two components: the <BR> kernel system call module, and the runtime environment. <BR> <BR> The Linux Kernel Module <BR> <BR> The kernel-loadable module, or KLM, supports Linux-specific system <BR> calls. You can determine whether the Linux KLM is loaded on your <BR> system by using: <BR> <BR>#kldstat -v | grep linux <BR> 2 1 0xc08dc000 e000 linux.ko <BR> 15 linuxelf <BR> 16 linuxaout <BR># <BR> <BR> (kldstat -v provides other useful information about your kernel, and <BR> is generally informative on any FreeBSD system.) If the module is not <BR> loaded, you can load it by becoming root and typing: <BR> <BR># linux <BR> <BR> You can make this automatic at boot by setting linux_enable="YES" in <BR> /etc/rc.conf. Strictly speaking, you don't have to compile a custom <BR> kernel to support the Linux module. You'll be more satisfied with your <BR> results, however, if your kernel includes the following options: <BR> <BR>options "P1003_1B" #POSIX infrastructure <BR>options "_KPOSIX_PRIORITY_SCHEDULING" #Built-in POSIX priority scheduling <BR>options "_KPOSIX_VERSION=199309L" #POSIX version kernel is built for <BR>options SYSVSHM #System V shared memory <BR>options SYSVMSG #System V semaphores <BR>options SYSVSEM #System V messaging <BR>options USER_LDT #allow user-level control of i386 ldt <BR> <BR> For full instructions on building a custom kernel, check: <BR> <BR><A HREF="http://www.FreeBSD.org/handbook/handbook50.html">http://www.FreeBSD.org/handbook/handbook50.html</A> <BR> <BR> If you have the FreeBSD docs installed on your local system, see: <BR> <BR>/usr/share/doc/handbook/handbook50.html <BR> <BR> The kernel emulator does have a small overhead, but it is negligible. <BR> If you're interested in the details and don't feel like reading the <BR> source code, search for "overhead" in the freebsd-emulation mailing <BR> list archives (<A HREF="http://www.FreeBSD.org/search/).">http://www.FreeBSD.org/search/).</A> <BR> <BR> Runtime Environment <BR> <BR> Dynamically linked Linux binaries expect to have certain libraries <BR> available. Linux has a variety of library sets, such as libc4, libc5, <BR> and glibc2. Additionally, some Linux programs expect to have <BR> particular Linux userland programs available (sh, test, etc.) Because <BR> FreeBSD uses the same codebase as original UNIX, whereas Linux was <BR> written from scratch, these may not be 100% compatible. A selection of <BR> Linux userland utilities can also be helpful, especially when dealing <BR> with closed-source commercial software products. <BR> <BR> The dynamic libraries and Linux userland utilities are available as a <BR> port. Look under /usr/ports/emulators/linux_base for the latest stable <BR> version. Install these as you would any other port: <BR> <BR>#cd /usr/ports/emulators/linux_base <BR>#make install <BR> <BR> The port installs a subset of Red Hat Linux's userland under <BR> /compat/linux. <BR> <BR> The original source files (or "distfiles", in FreeBSD parlance) are <BR> quite large. You will probably want to load these from a FreeBSD CD, a <BR> Red Hat CD, or from behind a large Internet circuit. If you're <BR> downloading over a 56 Kb modem, I'd recommend doing this when you <BR> don't plan to use your 'Net connection for several hours. The <BR> linux_base port installs everything under /compat/linux. If you're <BR> curious, do an ls: <BR> <BR>#ls <BR>bin boot etc lib mnt proc sbin usr var <BR># <BR> <BR> This looks suspiciously like a subset of the root directory. <BR> /compat/linux contains resources for Linux binaries that expect to <BR> find different resources than those available on a FreeBSD machine. <BR> While it's not chrooted, it's built in a similar manner. <BR> <BR> For example, on a Linux machine the file /etc/nsswitch.conf contains <BR> vital configuration information. FreeBSD keeps that information <BR> elsewhere. Any program run under Linux mode will check <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -