[Techtalk] Compiling the kernel on a separate machine

Malcolm Tredinnick malcolm at commsecure.com.au
Sun Mar 31 09:55:45 EST 2002


On Sat, Mar 30, 2002 at 09:57:51PM +0100, Hans Tegnerud wrote:
> I'm about to recompile a 2.2.12 kernel (adding support for IPSec
> masquerading). Up until today I've always compiled kernels on the machine on
> which it's supposed to be used. Now, the machine is my 120MHz Pentium
> firewall, and rather than letting it work all night I thought I'd use my
> 1,6GHz machine for that...
> 
> Those of you who has done this before... how'd you go about?
> Obviously 'make install' is to be avoided :)
> 
> Can I just compile my patched 2.2.12 kernel on my 2.4-based RedHat 7.2
> machine? No incompatibilities with header files etc?

I've never tried to build 2.2 kernels on a more recent machine, but this
should work fine. The nice thing is that the kernel _cannot_ use
anything on the machine it's being built on, since it's the lowest layer
-- so glibc, etc, depend on the kernel, not the other way around. So,
for example, the kernel will only require headers from its own source
tree.

> How will I know I get everything I need (kernel, modules...) over to my
> firewall after compilation?

All you need to copy across are the kernel binary and the modules. The
easiest way to do this is to do 'make bzImage' and then the kernel
binary will be arch/i386/boot/bzImage at the end of the build. Just copy
that file to / or /boot or wherever lilo expects to find it.

To make sure you get all the modules, after doing 'make modules', run
the command

	INSTALL_MOD_PATH=~ make modules_install

The INSTALL_MOD_PATH variable is documented in the Linux Makefile and is
used to install the modules under a different root (normally, it is
'/'). Then just copy the contents of ~/lib/modules/2.2.12 to
/lib/modules/2.2.12 on the target machine.

Btw, I assume you have a good reason for using 2.2.12, instead of
2.2.19, although it would make me nervous on a firewall box, since there
have been significant security fixes between the two versions.

Cheers,
Malcolm




More information about the Techtalk mailing list