toby63 / shiftfs-dkms

shiftfs kernel module via dkms
GNU General Public License v2.0
37 stars 10 forks source link

Add BUILD_EXCLUSIVE_KERNEL to dkms.conf of various kernel specific branches #10

Closed crass closed 3 years ago

crass commented 3 years ago

Adding the BUILD_EXCLUSIVE_KERNEL variable will tell dkms to only build the module for supported kernels. For instance, I added BUILD_EXCLUSIVE_KERNEL="^5.13.*" for the k513 branch because have this module installed in /usr/src so that it will be built every time I upgrade my kernel. I ran in to some file corruption and ended up needing to reinstall kernel headers for multiple kernels, which triggered a rebuilt for all dkms modules against all kernels which had headers reinstalled. Without the BUILD_EXCLUSIVE_KERNEL variable dkms would try to built the shiftfs-k513 against all the kernels, eg. 5.11 and 5.10, and would cause an error with non-5.13 kernels. This fixes that issue.


Todo:

Try and implement BUILD_EXCLUSIVE_KERNEL

toby63 commented 3 years ago

That is a good idea. I haven't really thought about this possibility, but you are right, if you install different kernel branches then error messages can occur, as some module builds will fail.

I will probably add this in the next two weeks.


One additional question: Did you try to install multiple versions of the shiftfs module at the same time and does that also work with this method? (Would be interesting to know, if people want to use shiftfs on multiple installed kernel branches)

toby63 commented 3 years ago

Fixed for k5.13.

crass commented 3 years ago

One additional question: Did you try to install multiple versions of the shiftfs module at the same time and does that also work with this method? (Would be interesting to know, if people want to use shiftfs on multiple installed kernel branches)

For reference, I'm testing on an Ubuntu system so some of this may be Ubuntu specific. I did not try installing multiple versions of the shiftfs module at the same time. In my setup, I put the shiftfs source at /usr/src/shiftfs-k513 for the kernel 5.13 code. Conceptually, I could have a k510 and k54 at /usr/src/shiftfs-k510 and /usr/src/shiftfs-k54 respectively, with the appropriate BUILD_EXCLUSIVE_KERNEL in each of those dkms.conf. Then upgrading 5.4, 5.10 and 5.13 kernels should work and build+install the modules for the newly updated kernels.

Using only the BUILD_EXCLUSIVE_KERNEL variable, I do not believe this can be done without using a separate directory for each. The variable is only for determining when to build the module for a given kernel. It will not, for instance, tell the build to build for a specific kernel version.

If I am understanding you correctly, you'd like to have one source which can build the module for various kernel versions. I haven't reviewed the code, but I believe all the version branches can be combined into one branch that will build the module for the specific kernel version (use #ifdef to include or exclude code depending on the version being built). In that case, there could be one branch for building against all supported kernels and the BUILD_EXCLUSIVE_KERNEL could be set to something like ^5.(13|10|4).* to only build against the supported kernels.

toby63 commented 3 years ago

Conceptually, I could have a k510 and k54 at /usr/src/shiftfs-k510 and /usr/src/shiftfs-k54 respectively, with the appropriate BUILD_EXCLUSIVE_KERNEL in each of those dkms.conf. Then upgrading 5.4, 5.10 and 5.13 kernels should work and build+install the modules for the newly updated kernels.

Yes, that was the potential way I had in mind. Maybe I will test this.

If I am understanding you correctly, you'd like to have one source which can build the module for various kernel versions.

No. As shiftfs support is running out anyway, I will just keep maintaining each version seperately. But I wanted to have BUILD_EXCLUSIVE_KERNEL for multiple branches, as e.g. the 5.10 version can support kernels 5.8.x to 5.10.x. So if ^5.(10|8).* works, that would solve this problem.

Thx so far.

toby63 commented 3 years ago

Implemented.