Created attachment 2743 [details] Patch to keep the "source" and "build" directories in the linux tree. When buiding and installing a package that compiles an out-of-the-tree kernel module, it is necessary to have the "source" and "build" directories on the linux kernel tree. This patch avoids the deletion of these directories in linux.mk.
I think I see the problem, but I don't think it is the correct fix: those two symbolic links are intentionally being removed, because they point to directories that are outside of the target root filesystem, so on the target they do not make sense at all. The current solution to build an out-of-tree kernel module is to use directly the kernel source directory, whose location is in $(LINUX26_DIR). An example of an out-of-tree kernel module packaged in Buildroot is package/linux-fusion/. Another solution could be to do a "make modules_install" to the $(STAGING_DIR), but keeping the symbolic links in that case. But I'm not sure it gives a huge benefit compared to just using the kernel source code in $(LINUX26_DIR). What do you think ? Could you point us to the source code of the kernel module your are trying to build ?
I agree, although this is a method suggested in various places, those links are just a convenient way to find where are both the source and build directories given just the target directory. In buildroot we know those in advance, so there is really no need for the links. The kernel module is a piece of software made in my work, so there is no big deal changing it. With the help of the linux-fusion example, it was really easy to set up things. Maybe I didn't look at the right places, but I have missed this example completely. Thanks for your reply, it did help a lot. Please disregard my patch, I consider the issue closed.
Close issue.