This is a random collection of things I want to note down about Linux kernel compilation, so that I don’t forget them. One is how to compile a kernel and output to a different directory than the kernel source path. If you Google this, most answers tell you to do something like this (in this example, we’re using ~/linux/build as the output directory:
However one big caveat here is all invocations to
make need to add the output path parameter, including when we do the
make config part. That caught me by surprise when I first attempted it.
Another handy tip is that it is possible to make Debian (and other formats) packages right from the kernel makefile. To make a Debian package, do:
The build script will plop out a bunch of handy packages ready to install. This is handy if you want to build a kernel on your workstation but want to install it somewhere else (just copy over the packages). There are also other compilation options and running make help in the kernel source tree will show you different package options.
Finally, you can compile just parts of the kernel by selectively compiling the target directory:
Of course this doesn’t build a complete kernel, but it’s useful if you’re working on just one bit and need to quickly test if it compiles.