I've run into a problem installing 5.12 test kernels. When dkms tries to build a module invoked by kernel make install it cleans the linux tree and tries to do a make modules there (both by root). The dkms module is left unbuilt. I bisected to the above commit -- kbuild: parse C= and M= before changing the working directory This commit changes the main Makefile so that make doesn't parse the M= parameter if the variable sub_make_done is in the environment and set to 1. On my and on similar systems make install uses /sbin/installkernel to do the installation. /sbin/installkernel uses run-parts on /etc/kernel/postinst.d/ to perform various elements in the installation, e.g. boot loader configuration. One of these is dkms to build an out-of-tree module. dkms autoinstall then attempts to make clear and make build the module(s) in a source directory using the linux source tree. The sub_make_done=1 variable is still in the environment after all this and the above make commands therefore don't parse the necessary M= parameter pointing to the source tree. Thus the initiated make invocations, ignoring the two parameters, process against the linux source tree instead. I was able to get proper function by unsetting sub_make_done in either dkms or in arch/x86/boot/install.sh This kind of problem is obtuse enough I wonder if the optimization attempted in the above commit is worth the complexity. On the other hand if it produces meaningful performance improvement perhaps changes to the architecture Makefiles or install scripts could be patched. I'd be happy to test patches on my system. Are there any questions or issues I've neglected? Thanks.