I think "/lib/modules/$(uname -r)/build" points to incorrect folder
The /lib/modules/<version>/build
symlink should point to the build directory - ie, where the object files were placed during the kernel build. In your case, your source dir is the same as your build dir, so both symlinks will point to the same directory.
The solution is in make-kpkg
documentation:
You can look at other example in the examples directory:
/usr/share/kernel-package/examples/
to see if there are other example script you want tocp
into/etc/kernel
-- and you can create your own scripts.
For example, if you use
linux-headers-*
packages to compile third party modules so that you do not have to keep the sources directory around, you might be interested in:
/etc/kernel/header_postinst.d/link
/etc/kernel/header_postrm.d/link
/etc/kernel/header_prerm.d/link
/etc/kernel/postinst.d/force-build-link
/etc/kernel/postrm.d/force-build-link
These scripts will try to make sure that the symlink
/lib/modules/$VERSION/build
is sane -- that is points to the header packages whether you install the image packages first, or the header packages first -- and takes care of cleanup when either of the packages are installed.