Just a few notes to self as I compiled a kernel on a x86_64 machine, targeting an i386. Kind-of cross-compilation, but with no need for a cross compiler.
Remember to update the (extra) version number in the Makefile.
After copying a known config file to .config:
$ make ARCH=i386 oldconfig $ time make ARCH=i386 -j 8 bzImage modules && echo Success
And as root (hey, the ARCH parameter wasn’t required!):
# make modules_install INSTALL_MOD_PATH=/path/to/
(this installs into /path/to/lib/modules/{version number}, so don’t write the “/lib/modules” part)
Remember to update the symbolic links to the source directory if necessary.
A depmod was required on the running machine as follows (after booting with the kernel, without modules loaded), even though a depmod ran on modules_install:
# depmod -a
Now, to retain the sources only, for the sake of allowing module compilation (this is a lot more than necessary, but I’ll waste a few GBs and save myself the bother of dieting the kernel tree):
$ make clean
Copy the source tree to the target, and on the target itself, go
$ make prepare scripts
(it won’t work if it’s done on the computer that compiled the kernel)