Startup Messages


One common question is,"What hardware did your kernel find when it booted?" If the kernel handles all device drivers and other hardware support, the list of devices it found should include all the hardware in the system. Kernel messages are temporarily stored in the system message buffer. You can view the contents of this system message buffer with dmesg(8). This buffer is "circular," however; as it fills up, the oldest messages are deleted to make room for new messages. This means that the boot messages are the first to go!

Fortunately, OpenBSD saves the boot-time system messages in the file /var/run/dmesg.boot. Let's take a look at the dmesg from our test system. It starts with a kernel notification:

 OpenBSD 3.1 (GENERIC) #59: Sat Apr 13 15:28:52 MDT 2002     deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC 

This identifies the version of OpenBSD we are running, the name of the kernel, the kernel version, the date the kernel was compiled, and the machine and directory where the kernel was built.

 cpu0: F00F bug workaround installed cpu0: Intel Pentium/MMX ("GenuineIntel" 586-class) 166 MHz cpu0: FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,MMX 

The first item on almost every line describes the device driver or hardware component. In this case, the hardware component is the CPU. Each piece of hardware of a type is numbered, starting with zero.

Further detail on each line tells us something about the hardware. Some of this might mean nothing to you, but it's good to have the information available. If you've been kicking around the computer world for a while, you might remember the "Pentium F00F" bug. OpenBSD has a workaround for this, which it activated on this machine. Similarly, OpenBSD identifies the exact sort of CPU this is, and which model and speed it is. Finally, it identifies instruction sets available on the CPU.

Other messages don't describe particular pieces of hardware, but instead aggregate other information.

 real mem = 83472384 (81516K) avail mem = 71708672 (70028K) 

This computer has 81,516KB of physical memory. Of that, 70,028KB are available to programs other than the kernel.

Device Attachments

One of the more interesting things about the boot-time message buffer is that you can see where each piece of hardware is attached.

 pci0 at mainbus0 bus 0: configuration mode 1 (bios) pchb0 at pci0 dev 0 function 0 "Intel 82439HX" rev 0x03 pcib0 at pci0 dev 7 function 0 "Intel 82371SB PCI-ISA" rev 0x01 

Here, OpenBSD found a PCI bus. The kernel then found a device it identifies as pchb0, attached to the PCI bus, and it gives a part model number. If you wanted to know exactly what this device driver did, you could check section 4 of the manual, which would tell you that pchb is a "PCI-Host Bridge." Similarly, a bit of digging would tell you that pcib means a PCI-ISA bridge.

The information in quotes is chosen by the device driver developer as a name for the device and may not always be completely accurate. While it's rare for this information to be completely wrong, it might only describe one aspect of a chipset and not others.

If you keep reading the dmesg on an OpenBSD system, you start to see that every piece of hardware plugs into some other piece of hardware. On this test system, the ISA bus is attached to the PCI-ISA bridge:

 isa0 at pcib0 

If you keep looking, you'll see various pieces of equipment plugged into the ISA bus.

 pckbc0 at isa0 port 0x60/5 

Here's our keyboard controller, plugged into the ISA bus. Later, we find the actual keyboard.

 pckbd0 at pckbc0 (kbd slot) 

So, the keyboard is plugged into the keyboard controller, which resides on the ISA bus, which is plugged into the PCI-ISA bridge, which is plugged into the PCI bus, which is plugged into the main bus.

Dmassage

I find the dmassage script useful to identify exactly what's attached to what interfaces on a computer. (Dmassage is an add-on available at http://www.sentia.org/projects/dmassage/, not part of OpenBSD itself.) We'll look at some other functions of dmassage in a little bit, but the one we care about here is "-t." This shows a "tree" of system devices and where they are attached.

 # ./dmassage -t root  \-mainbus0     |-bios0     |  \-pcibios0     \-pci0        |-dc0        |  \-dcphy0 ... 

While this isn't directly useful, it can help you get a better idea of how devices are interconnected in your particular system.

Device Numbering

If you have multiple devices of a single type in your system, each is numbered. Because we're in the computer world, the first unit is number zero, the second number one, and so on. For example, our test system has two hard drives. Early in dmesg.boot we'll see:

 wd0 at pciide0 channel 0 drive 0: <QUANTUM BIGFOOT_CY2160A> wd0: 32-sector PIO, LBA, 2014MB, 4092 cyl, 16 head, 63 sec, 4124736 sectors wd0(pciide0:0:0): using PIO mode 4, DMA mode 2 

The wd device driver is for IDE hard disks. Here we see the disk size, and a whole bunch of characteristics about this drive. A little later on, we'll see the second hard drive.

 wd1 at pciide0 channel 1 drive 1: <WDC AC38400L> wd1: 16-sector PIO, LBA, 8063MB, 16383 cyl, 16 head, 63 sec, 16514064 sectors 

As the second IDE hard drive, this is called wd1. Subsequent IDE hard drives would be numbered wd2, wd3, and so on.

Each piece of hardware that uses a particular device driver is separately numbered. For example, SCSI hard drives use the "sd" drive. If the SCSI drive is the third hard drive, it is numbered sd0.

The important thing to remember is that every piece of hardware has a unique instance of the device driver. If you have 31 SCSI hard drives in your web server, they will be labeled sd0 through sd30.

Note

At times, you'll need to know the device name to use a piece of hardware correctly. Take a moment to review /var/run/dmesg.boot on your OpenBSD system. Start to get a feel for how your hardware shows up. Most device drivers have a man page in section 4 and are worth reviewing for a thorough education.




Absolute Openbsd(c) Unix for the Practical Paranoid
Absolute OpenBSD: Unix for the Practical Paranoid
ISBN: 1886411999
EAN: 2147483647
Year: 2005
Pages: 298

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net