I compile/create my own deb packages of kernel with:

make-kpkg --rootcmd fakeroot --initrd --append-to-version=$version --revision=1 kernel_image kernel_headers

But when I install both packages, in /lib/modules/(*name_kernel_compiled*) it creates two links, sources and build, pointing to folder with sources, from I've compiled.

sources link is correct but build should point to /usr/src/linux-(version kernel), don't you think?


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 to cp 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:


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.