From a44322ee3f19f2b55f379c2756ed1009ae6c6336 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Thu, 28 Jun 2001 14:49:04 +0000 Subject: [PATCH] Apply the magic pixie dust of understanding to the "make the kernel" build process (and the choice of procedure). --- .../books/handbook/kernelconfig/chapter.sgml | 135 +++++++++++++----- 1 file changed, 97 insertions(+), 38 deletions(-) diff --git a/en_US.ISO8859-1/books/handbook/kernelconfig/chapter.sgml b/en_US.ISO8859-1/books/handbook/kernelconfig/chapter.sgml index f0580e87e8..0ebdba67cd 100644 --- a/en_US.ISO8859-1/books/handbook/kernelconfig/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/kernelconfig/chapter.sgml @@ -1,7 +1,7 @@ @@ -109,6 +109,26 @@ call it MYKERNEL for the purpose of this example. + + Storing your kernel config file directly under + /usr/src can be a bad idea. If you are + experiencing problems it can be tempting to just delete + /usr/src and start again. Five seconds after + you do that you realise that you have deleted your custom kernel + config file. + + You might want to keep your kernel config file elsewhere, and then + create a symbolic link to the file in the i386 + directory. + + For example: + + &prompt.root; cd /usr/src/sys/i386/conf +&prompt.root; mkdir /root/kernels +&prompt.root; cp GENERIC /root/kernels/MYKERNEL +&prompt.root; ln -s /root/kernels/MYKERNEL + + You must execute these and all of the following commands under the root account or you will get permission @@ -147,38 +167,87 @@ for those information than the handbook. - When you are finished, type the following to compile and install - your kernel if you are using FreeBSD prior FreeBSD 4.0 and don't - want to upgrade to FreeBSD 4.0 or higher with this step, - or if you are using a release-version of FreeBSD and your - /usr/src/ directory only contains the - sys/ sub-directory. + You must now compile the source code for the kernel. There are two + procedures you can use to do this, and the one you will use depends on + why you are rebuilding the kernel, and the version of FreeBSD you are + running. - - If you are trying to upgrade your kernel from an older version - of FreeBSD, you will probably have to get a new version of - &man.config.8; from the same place you got the new kernel sources. - It is located in /usr/src/usr.sbin, so you - will need to download those sources as well. Re-build and install - it before running the next commands. - + + + If you have installed only the kernel + source code, use procedure 1. + - &prompt.root; /usr/sbin/config MYKERNEL -&prompt.root; cd ../../compile/MYKERNEL -&prompt.root; make depend -&prompt.root; make -&prompt.root; make install + + If you are running a FreeBSD version prior to 4.0, and you are + not upgrading to FreeBSD 4.0 or higher using + the make world procedure, use procedure 1. + - If you have just upgraded to a newer version of 4.X or - higher (ie from 3.X to 4-STABLE, or even from 4-STABLE to a - later version of 4-STABLE), make sure you have built the world, and then run the - following commands: + + If you are building a new kernel without updating the source + code (perhaps just to add a new option, such as + IPFIREWALL) you can use either procedure. + - &prompt.root; cd /usr/src -&prompt.root; make buildkernel KERNCONF=MYKERNEL -&prompt.root; make installkernel KERNCONF=MYKERNEL + + If you are rebuilding the kernel as part of a make + world process, use procedure 2. + + + + + Procedure 1. Building a kernel the the <quote>traditional</quote> way + + + Run &man.config.8; to generate the kernel source code. + + &prompt.root; /usr/sbin/config MYKERNEL + + + Change in to the build directory. + + &prompt.root; cd ../../compile/MYKERNEL + + + + Compile the kernel. + + &prompt.root; make depend +&prompt.root; make + + + + Install the new kernel. + + &prompt.root; make install + + + + + Procedure 2. Building a kernel the <quote>new</quote> + way + + + Change to the /usr/src directory + + &prompt.root; cd /usr/src + + + + Compile the kernel. + + &prompt.root; make buildkernel KERNCONF=MYKERNEL + + + + Install the new kernel. + + &prompt.root; make installkernel KERNCONF=MYKERNEL + + + In FreeBSD 4.2 and older you must replace KERCONF= with KERNEL=. @@ -201,16 +270,6 @@ config, make depend, make, make install sequence. - - If you have upgraded your sources since your last kernel - build, you must use the make - buildkernel method to build your kernel. Otherwise, - old utilities will be used to build the kernel, which will - probably fail. Do not use the - config/make sequence to - build your kernel if you have updated the - sources! - kernel.old The new kernel will be copied to the root directory as