BeardOverflow / msi-ec

GNU General Public License v2.0
134 stars 41 forks source link

Conflict between the in-tree and the out-of-tree driver #71

Open teackot opened 10 months ago

teackot commented 10 months ago

Since Linux 6.4, when the less functional version of the driver has been merged into the kernel, if users try to install and load the github version of this driver the in-tree version loads instead. To load the github version, user has to manually load the msi-ec.ko file.

teackot commented 10 months ago

Example: https://github.com/BeardOverflow/msi-ec/issues/16#issuecomment-1624734761

glpnk commented 10 months ago

Temporary one-time solution is loading git build version with sudo make load-debug or sudo make load. Works until reboot.

Cycle of install-uninstall-load-unload in random sequence made driver successfully installable but also works until reboot.

I think permanent solution is renaming git version to msi-ec-git and blacklisting kernel version. Or see how this issue solved in other kernel-merged modules

UPD: This might be helpful https://man7.org/linux/man-pages/man5/depmod.d.5.html

UPD2: You can try to replace in-kernel module with self-built, but I think it's not good method (it works)

glpnk commented 9 months ago

@teackot DKMS has "fancy" way to deal with in-kernel module replacement. Source

During regular installation .ko file being placed in /lib/modules/<kernelversion>/extra, but in-kernel drivers are placed in /lib/modules/<kernelversion>/kernel/drivers/platform/x86, so by setting DEST_MODULE_LOCATION in dkms.conf we can set directory where module will be replaced.

UPD: after some tests of custom dkms.conf and Makefile I figured that DKMS works in current configuration. (if you got error please reply)

sudo make dkms-install
sudo modprobe -v msi-ec

It will backup in-kernel module, build and replace it with newer and load it.

teackot commented 9 months ago

I just tested it and yes, installing the driver with DKMS allows me to load the driver. Thanks for your research!