Compiling and Installing the Custom Kernel


After your config file is ready to go, building the kernel is a fairly simple process. In theory, the build requires at most three commands:

# cd /usr/src # make buildkernel KERNCONF=CUSTOM # make installkernel KERNCONF=CUSTOM


The KERNCONF argument specifies the kernel config file to use; if you omit it, the GENERIC config file will be assumed. The first make command parses the config file, sets up the build directory, builds the dependencies, and then builds the kernel itself. The second command installs it into /boot, moving the current kernel directory to /boot/kernel.old. (Prior to FreeBSD 5.0, these kernels were installed into /, the root.) You must then reboot (by typing shutdown -r now) to use the new kernel.

Note

The kernel has the schg (system-immutable) flag set on it, meaning that even root can't delete or overwrite it without first removing that flag. The make installkernel target attempts to remove the flag before installing the new kernel. However, if you're running with a securelevel setting of 1 or higher (a now-deprecated systemwide security setting that you select during installation or in /etc/rc.conf; see man securelevel for details), it won't be able to remove the flag. You'll have to reboot into single-user mode in order to complete the kernel installation; dropping to single-user mode via shutdown won't work.


Tip

If you're really sure of yourself, you can combine both the make lines into a single one, as shown here:

# make kernel KERNCONF=CUSTOM


However, this is for experts only; it's much better to be in the habit of building and installing the kernel separately, to minimize the chances of accidentally installing a flawed kernel.





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

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