Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Absolute BSD - The Ultimate Guide To FreeBSD (2002).pdf
Скачиваний:
25
Добавлен:
17.08.2013
Размер:
8.15 Mб
Скачать

First, interrupt the boot, as discussed in the "Manually Configuring the Loader" section earlier in this chapter, by pressing any key. When you see the loader prompt, the kernel has already been loaded. You need to unload that kernel and any corresponding modules before you can load another kernel. To do so, run this command:

...............................................................................................

ok unload

ok

...............................................................................................

Your kernel should now be unloaded and your command prompt at the root directory. If you're not sure of the kernels you have, use ls to see everything under /.

Next, choose the kernel you want, then load it and boot. (Be sure to also load whatever kernel modules you require.)

...............................................................................................

ok load /kernel.good

ok load /modules/if_fxp.ko

ok boot

...............................................................................................

Your system should now start booting off your selected kernel.

Note If you didn't back up a good kernel, and both your new and old kernels are bad, don't despair yet. FreeBSD installs a GENERIC kernel in /kernel.GENERIC. It should at least get you back to a command prompt, or to single−user mode in the worst case.

Adding to the Kernel

At this point, if everything has gone well, you should have a minimal kernel that works well. Now you can add features and tweak it.

LINT

You'll find a list of all kernel features in the file /sys/i386/conf/LINT, including every kernel option and driver, as well as some documentation.

If you have hardware that doesn't appear to be supported in the GENERIC kernel, take a look at LINT. Some of these features are obscure, but if you have the hardware, you'll appreciate them. For example, FreeBSD supports the special features of the IBM BlueLightning CPU, which will allow both of you BlueLightning owners to use your CPU to its full extent.

Let's look at a typical entry from LINT:

...............................................................................................

# CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs. This option

92

#is useful when you use Socket 8 to Socket 370 converter, because most Pentium

#Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs.

options CPU_PPRO2CELERON

...............................................................................................

We're told that if you have a Socket 8 to Socket 370 converter on your mother−board, the CPU_PPRO2CELERON option will enable your L2 cache. Since FreeBSD runs so well on older hardware, this sort of hardware setup is not uncommon. Many people have taken older hardware and installed FreeBSD on it, and use adapters to augment this older hardware. While this situation isn't common enough to warrant inclusion in the GENERIC kernel, the option is there if you look for it. Skim through LINT some time, just to get an idea of what sorts of things are available.

NoteIf the LINT kernel configuration includes all possible options, why not just use it? Because some of the features in that configuration contradict each other. For example, there's the CPU_PPRO2CELERON option that tells the kernel you're running a Celeron on a Pentium Pro motherboard. Meanwhile, the kernel option CPU_RSTK_EN enables the return stack on the Cyrix 5x86 CPUs. There is no such thing as a Cyrix−made Celeron, and if it existed, it probably wouldn't use this motherboard adapter.

Fixing Errors with Options

You'll use certain options when you get an error. For example, a friend of mine has several Web servers built on low−end i386 hardware. When one became busy enough to start serving several hundred Web pages a second, he started getting errors on the console like this:

...............................................................................................

Jun 9 16:23:17 ralph/kernel: pmap_collect: collecting pv entries −− suggest increasing PMAP_SHPGPERPROC

...............................................................................................

When he ignored the error, the system crashed. He asked for my help.

By reading the error from the log and searching LINT, I found this:

...............................................................................................

#Set the number of PV entries per process. Increasing this can

#stop panics related to heavy use of shared memory. However, that can

#(combined with large amounts of physical memory) cause panics at

#boot time due the kernel running out of VM space.

#

#If you're tweaking this, you might also want to increase the sysctls

#"vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target".

#

# The value below is the one more than the default.

#

options PMAP_SHPGPERPROC=201

...............................................................................................

After reading this explanation, we set out to tackle this problem. First, we backed up the old kernel

93