I am having trouble building external modules after compiling the linux kernel on an external device. It is the 4.19.103 kernel with the real time patch-4.19.103.
My onboard storage disk is <3Gb so I did the compilation and install from an external block device. By doing so, the kernel "build" and "source" directories necessary for building external modules now point to the mounted external device:
ll /lib/modules/4.19.103-rt42/
lrwxrwxrwx 1 root root 24 Feb 23 17:20 build -> /home/user/mnt/linux-4.19.103
lrwxrwxrwx 1 root root 24 Feb 23 20:15 source -> /home/user/mnt/linux-4.19.103
The build directory is 9Gb and I need it to be moved to the 3Gb onboard disk.
With a default kernel, external modules can easily be added by installing the kernel-devel
package which the the "build" directory would point to:
ll /lib/modules/4.18.0-147.5.1.el8_1.x86_64/
lrwxrwxrwx. 1 root root 44 Feb 4 18:07 build -> /usr/src/kernels/4.18.0-147.5.1.el8_1.x86_64
This directory is only 91Mb. (vs my 9Gb build directory)
Basically what I'm asking: is there a way to shrink the build directory down, similar to how the kernel-devel
package does with the /usr/src/kernels/4.xxx
direcory? It seems like this directory only has Makefiles/Kconfig and some headers, so can I just delete all the build object & source files from home/user/mnt/linux-4.19.103
and move it to my root file system? Is there a make option during installation? I currently use:
make modules_install headers_install install