16

I'm building a custom kernel based off 4.11 (for Mintx64, if it matters). I've already compiled and installed it to prove that it works. Now I've made a few small changes to a couple of files (in the driver and net subsystems, this is why I need to compile a custom kernel in the first place!)

Now I want to build the modified kernel. However when I run

fakeroot make -j5 deb-pkg LOCALVERSION=myname KDEB_PKGVERSION=1 

The build system appears to start by "clean"-ing a whole load of stuff, so I stopped it quickly. Unfortunately the computer I'm using is not blessed with a good CPU and takes many hours to build from scratch. Therefore I'd rather avoid doing it again if possible!

Is it possible to make just an incremental build without everything be "clean"d or is this a requirement of the kernel build system?

The output I got was:

CHK      include/config/kernel.release
make clean
CLEAN .
CLEAN arch/x86/lib
...
1
  • @jc__ see output from build above, I can't immediately find where the makefile for that target is, but I'm still looking :)
    – T Kilney
    Jun 2, 2017 at 19:28

3 Answers 3

19

The make clean is only for the deb-pkg target. Take a look at scripts/package/Makefile:

deb-pkg: FORCE
        $(MAKE) clean
        $(call cmd,src_tar,$(KDEB_SOURCENAME))
        $(MAKE) KBUILD_SRC=
        +$(call cmd,builddeb)

bindeb-pkg: FORCE
        $(MAKE) KBUILD_SRC=
        +$(call cmd,builddeb)

If you build the bindeb-pkg instead, it won't do a clean. You probably don't need the source packages anyway.

I suspect it does a clean because it doesn't want to tar up build artifacts in the source tarball.

3

You could try producing those deb packages with a different tool, make-kpkg that is installed by apt-get install kernel-package. Then for example

make-kpkg --rootcmd=fakeroot --initrd --uc --us -j2 kernel_image kernel_headers

This command should not do a make clean each time.

1

I fixed this by going into the makefile for the deb-pkg command and removing "make clean" from the script. This did not seem to cause any ill effects with the build and I have been running the custom kernel for a week or two now without problems. YMMV!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .