UNIX System Administration Handbook - Evi Nemeth [149]
Here’s a complete example:
config kernel root on wd0
The ability to build variant kernels is useful for disaster planning. An alternate root partition equipped with its own kernel can be of great help when your main root partition is damaged. If the alternate root is on the same disk drive or controller as the one that got trashed, be sure to verify the stability of the hardware before rebooting. Otherwise, you run the risk of destroying the alternate root, too.
On some systems, a floppy disk or CD-ROM controls the boot procedure. The floppy disk knows the location of the kernel and can control its invocation. If you maintain an alternate root partition, you may have to build a new boot floppy that uses it.
Hardware devices
The syntax for declaring devices is confusing, and the basic entries required to make the system run vary from machine to machine. Section 4 of the BSD manuals covers devices. Most man pages for device drivers list an example config line you can include in the kernel.
Take the following instructions with a grain of salt. We discuss the general syntax, but since we expect that you will mostly be paring down your system’s generic configuration, we don’t talk about how to write your own device specifications from scratch.
The basic form of a declaration is:
device-type device-name at connection-info port address [device-class] irq interrupt
Not all clauses are applicable to all devices.
device-type is the type of device you are declaring. A few types of devices, such as controller and disk, have special keywords. Others use the generic keyword device.
device-name is the standard name of the device (or more accurately, the name of the device driver), plus the logical unit number. For example, the name for the first IDE controller is wdc0. As you wade through the generic configuration, you can look up each device in section 4 of the manuals to find out what it is and whether it applies to you. Note that the logical unit number has no relationship to any hardware-specified selection number of the device.
The connection-info for a device tells the kernel where to find the device and what kind of device it is. For disk and tape drives, this connection info is usually the name of a controller. For controllers and devices, it’s the name of a bus or bus controller. For example, the following lines define the system’s ISA bus, an IDE controller that’s attached to it, and an IDE disk that’s attached to the IDE controller:
controller isa0
controller wdc0 at isa? port "IO_WD1" bio irq 14
disk wd0 at wdc0 drive 0
It is usually sufficient to state that a device is connected to a particular type of controller without specifying which one. For example, the location of the wdc0 IDE controller is indicated above not as isa0 or isa1, but as the more generic isa?.
The address parameter, the argument to the port keyword, represents the location of the device’s command and status registers in the address space of the bus or backplane to which it is connected. Controllers and devices connected directly to a bus often have this parameter filled in. Each kind of device has a certain number of address locations that it occupies in the bus’s address space. The values only need to be specified for ISA or EISA devices; PCI drivers can dynamically determine the address range a device is using.
Set the interrupt to the interrupt vector (IRQ) the device has been configured to use. This parameter only needs to be specified for ISA and EISA devices. PCI drivers can dynamically determine the interrupt a device is using.
For some device drivers, you must specify a device-class. This parameter is mainly used for network devices and some controllers. To see if a specific device needs a device class, refer to its man page.
Here’s the config line for an ISA NE200 network card that uses most of these options:
device ed0 at isa? port 0x360 net irq 10
This line says to locate the