Building older FreeBSD kernels on newer FreeBSD systems

Robert Watson

The purpose of this page is to document, at a high level, what sorts of changes are required to reliably build older FreeBSD kernels on newer FreeBSD installs. I use this information in my environment for back-benchmarking of older FreeBSD revisions in a netboot test environment.

It (should) go without saying that in order to build an older kernel, you actually need to build a complete FreeBSD world, in order to make sure that the compiler suite and other tools are in sync with the desired kernel version. Newer kernels frequently make use of newer compiler features, such as C99, and typically older kernels are not tested with newer compilers, which may cause different bugs to trigger. So begin by doing a complete buildworld, and make sure to use buildkernel to build the new kernel version, in order to avoid pollution or using the wrong toolchain.

The following changes must be made in order to build UP and SMP kernels on older versions, when compared to GENERIC as found in a 7.x system:

Version UP SMP
RELENG_6 No change No change
RELENG_5 No change No change
Note that prior to recent RELENG_6, "nooptions" is not a supported configuration keyword.
RELENG_5_4 No change No change
RELENG_5_3 Remove arcmsr, cdce Remove arcmsr, cdce
RELENG_5_2 Remove arcmsr, cdce, ADAPTIVE_GIANT, vge, mem, io, hptmv, twa, ixgb Remove arcmsr, cdce, ADAPTIVE_GIANT, vge, mem, io, hptmv, twa, ixgb
RELENG_5_1 Remove arcmsr, cdce, ADAPTIVE_GIANT, vge, mem, io, hptmv, twa, ixgb, ataraid, bfe, re, apic Remove arcmsr, cdce, ADAPTIVE_GIANT, vge, mem, io, hptmv, twa, ixgb, ataraid, bfe, re; rename "device apic" to "options APIC_IO"
RELENG_5_0 Remove arcmsr, cdce, ADAPTIVE_GIANT, vge, mem, io, hptmv, twa, ixgb, ataraid, bfe, re, apic, SCHED_4BSD, ips, wlan, axe, rue, ie Remove arcmsr, cdce, ADAPTIVE_GIANT, vge, mem, io, hptmv, twa, ixgb, ataraid, bfe, re; rename "device apic" to "options APIC_IO", SCHED_4BSD, ips, wlan, axe, rue, ie
RELENG_4 Not worth it, just use the native UP kernel Not worth it, just use the native SMP kernel

Note: some revisions of FreeBSD ship with debugging options, such as WITNESS, INVARIANTS, and INVARIANT_SUPPORT compiled into the kernel. These should be removed if performance comparisons will be made. Also, user space may have debugging options enabled, such as malloc debugging flags, which are not determined by the kernel build.