Customizing a FreeBSD Kernel for VMware

Một phần của tài liệu the book of vmware - the complete guide to vmware workstation (2002) (Trang 124 - 127)

Adding new device drivers for BSD involves creating a new kernel configuration, setting up a build directory, and then compiling and linking the new kernel. If you plan to use sound when running under VMware, you should create a new kernel; the generic kernel doesn’t include sound support. Furthermore, the generic kernel contains many drivers that you don’t need. If you remove them, the kernel uses less memory (and boots faster).

Creating a kernel is a fairly straightforward process. Suppose that you want to build a new kernel with the label VMWARE. Here’s how:

1.

Change to the kernel configuration directory and create a new configuration file from the GENERIC file:

cd /sys/i386/conf cp GENERIC VMWARE

2.

Edit the new VMWARE file. You’ll find numerous devices listed here, possibly with parameters if the driver can’t automatically probe for a device. For now, just add the driver for the sound card by appending these two lines to the end of the file:

device sbc0 at isa? port 0x220 irq 5 drq 1 flags 0x15 device pcm

3.

Set up the build directory and change to it with

config VMWARE cd ../../VMWARE

Note that the build directory is /sys/compile/VMWARE.

4.

The config command reminded you to issue a make depend command, so run this. The purpose of this command is to check the source code to see if it’s all there, and to see if you configured drivers with prerequisite drivers. For example, the de0 driver for a DEC Tulip−based Ethernet card requires miibus support.

5.

Run make to compile your new kernel. This may take a while, especially if you configured a large number of drivers.

6.

The build creates a new kernel called kernel in the directory where you ran make, and you can now install it. Do this to make a backup of your old kernel and put the new one in place:

mv /kernel /kernel.0 cp kernel /kernel

7.

Reboot your system to see if the new kernel works.

7.5.1 Help! My New Kernel Didn’t Work!

If you have problems with your new kernel, you can go back to the old kernel by interrupting the boot process. When FreeBSD’s boot manager starts, it displays these lines:

F1: FreeBSD Default: F1

(FreeBSD may be at somewhere other than F1 on your system.) Press F1 and then immediately press esc.

You’ll get a prompt similar to this:

>> FreeBSD/i386 BOOT

Default: 0:ad(0,a)/boot/loader boot:

Now you can type boot /kernel.0 to load your backup kernel. The keyboard may seem sluggish and unresponsive when you enter commands at the boot: prompt; this is normal.

7.5.2 FreeBSD Kernel Configuration Parameters

There’s a list of all configurable kernel parameters in /sys/i386/conf/LINT. This section summarizes important parameters you’ll need for a VMware Workstation kernel.

Disk and CD−ROM Drives

You’ll need the following in your kernel configuration for the ATA disk and ATAPI CD−ROM drivers:

device ata0 at isa? port IO_WD1 irq 14 device ata1 at isa? port IO_WD2 irq 15 device ata

device atadisk # ATA disk drives device atapicd # ATAPI CDROM drives

Almost every FreeBSD kernel has this support built in. The only exception is a system with no ATA devices (only SCSI disks, unless you’re particularly determined to run an entire system off a floppy disk, NFS, or

some other nondisk).

In addition, you’ll want the following options for filesystem support:

options FFS #Berkeley Fast Filesystem

options FFS_ROOT #FFS usable as root device [keep this!]

options NFS #Network Filesystem

options NFS_ROOT #NFS usable as root device, NFS required options MSDOSFS #MSDOS Filesystem

options CD9660 #ISO9660 Filesystem

options CD9660_ROOT #CD−ROM usable as root, CD9660 required options PROCFS #Process filesystem

options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!]

The generic kernel defines all of these. In addition, there are several others in the LINT file that you may take interest in, such as NTFS, CODA, and EXT2FS.

For the VMware SCSI controller and disk support, you’ll need the following:

device bt0 at isa? # BusLogic SCSI host controller device scbus # SCSI bus (required)

device da # Direct Access (disks)

There’s a SCSI delay option that waits for SCSI devices to finish their initial configuration before beginning the SCSI probe. The default delay is 15,000 ms, but you can set a much lower value for use under VMware so that your system boots a little faster. Take care with dual configuration systems; you may need to set this value higher with real SCSI hardware.

options SCSI_DELAY=1000

Ethernet Interfaces

You can configure VMware’s Ethernet interfaces with just one line:

device lnc0 at isa? port 0x280 irq 10 drq 0

If you have more than one interface, don’t worry that this line says lnc0. The driver’s probe also finds lnc1 and lnc2 under this setup. Don’t worry about the port and IRQ values, either.

You’ll also need these for proper networking support:

pseudo−device loop # Network loopback pseudo−device ether # Ethernet support

Serial Ports

FreeBSD doesn’t support IRQ sharing, so it’s useful only for configuring two serial ports:

device sio0 at isa? port IO_COM1 flags 0x10 irq 4 device sio1 at isa? port IO_COM2 irq 3

Parallel Ports

You’ll find FreeBSD’s all in one place:

device ppc0 at isa? irq 7

device ppbus # Parallel port bus (required) device lpt # Printer

device plip # TCP/IP over parallel

device ppi # Parallel port interface device

USB Devices

The following are necessary for basic USB support (controller, keyboard, mouse, and storage devices):

device uhci device usb device ugen device uhid device ukbd

device umass # (Requires scbus, da) device ums

There are several other parameters; check the LINT configuration file for all of them.

Floppy Disk, Keyboard, Mouse, and Sound Devices

Here are some miscellaneous drivers for use under VMware, including the sound driver, mentioned earlier:

# Floppy controller and drives

device fdc0 at isa? port IO_FD1 irq 6 drq 2 device fd0 at fdc0 drive 0

device fd1 at fdc0 drive 1

# Keyboard and PS/2−type mouse

device atkbdc0 at isa? port IO_KBD

device atkbd0 at atkbdc? irq 1 flags 0x1 device psm0 at atkbdc? irq 12

136

# Sound Support

device sbc0 at isa? port 0x220 irq 5 drq 1 flags 0x15 device pcm

Một phần của tài liệu the book of vmware - the complete guide to vmware workstation (2002) (Trang 124 - 127)

Tải bản đầy đủ (PDF)

(214 trang)