Mar 191999

compiling a kernel on another machine

See also Build world on your fast box, install on your slow box, which also covers kernel building.

One machine can compile a single kernel and distribute it to other machines if all machines contain the same version of the operating system.  For instructions on how to create a new kernel, refer to the Configuring the FreeBSD Kernel section in the FreeBSD handbook.  Pay special attention to the section on Building and Installing a Custom Kernel.

Why do this?

Why would you want to compile a kernel on one machine and copy it to another?   Well, perhaps the machine in question has very little disk space and can’t take the sources.  Or it’s a slow box, and it would take hours to compile a kernel.  In my case, it’s the space.  I had just installed the system on a Windows 95 machine, and there wasn’t much space.  So I used another machine.

How to do this

Basically, you do the same as you would for any custom kernel.  I named the kernel after the name of the machine.  See Building and Installing a Custom Kernel for details.

After compiling the kernel, I used FTP to transfer it from one machine to the other.   Then I did the following:

cd /
chflags noschg kernel
cp kernel kernel.old
cp /var/ftp/incoming/kernel kernel
chflags schg kernel
shutdown -r now

The above will copy the old kernel out and copy the new kernel in.  It also reboots the machine.