I rebuild the kernel based on the git sources. These are the steps that I take:
- git clone git://kernel.ubuntu.com/ubuntu/ubuntu-focal.git
- cd ubuntu-focal
- vi debian.master/changelog
- apply patches
- fakeroot debian/rules clean binary-headers binary-generic
If I then apply another patch and want to compile the same version again, I get an error because certain folders are not empty. I can issue 'fakeroot debian/rules clean' to solve that, but then I need to compile the whole kernel.
Is there a way to recompiling only the changed files and build the debs based on that? It seems a trivial thing I just haven't figured out yet.
So it is not exactly what I was looking for, but as I am mainly looking to save some time and can spare the diskspace I adopted ccache based on this guide.
I use the method described here to compile the kernel, with the exception that I pull in the sources from GregKH's stable tree.
I added this to .bashrc:
But it seems I have to add the parameter when invoking the build:
Results after 2 identical builds look good (starting with empty cache then doing a build with everything in cache equals 50% hit rate in total):
Regular Kernel builds took slightly over an hour. The first ccache run (filling the cache) took 95 minutes. The second build 30 minutes. I'm keeping it like this for now.