neggles / cm4io-fan

CM4 IO board PWM fan controller driver
GNU General Public License v2.0
79 stars 16 forks source link

Support for Ubuntu 21.10 #11

Closed sdwilsh closed 2 years ago

sdwilsh commented 3 years ago

Context

Ubuntu stores overlays under /boot/firmware/overlays, instead of just /boot/overlays like many other operating systems for the Pi. The location of the folder where overlays can be found is defined in /etc/default/rpi-eeprom-update.

Ubuntu 21.10, which is the suggested version of Ubuntu Server to install for the CM4, uses kernel 5.13. This builds just fine on 5.13 (and probably 5.11 and 5.12 too).

Changes

Additional Notes

DKMS will build it, and place it under /lib/modules/5.13.0-1010-raspi/updates/dkms/emc2301.ko. At this point, the module can be manually loaded with insmod, and the fan is properly controlled. However, it does not load automatically at boot unless one tells Ubuntu to do so. I did so by adding a file under /etc/modules-load.d/ called cm4fan.conf with a single line in it containing the text emc2301.

sdwilsh commented 3 years ago

I figured out that Ubuntu doesn't auto-load the module, so you have to tell it to load automatically. I have updated the summary to reflect this, as I now have this working correctly under Ubuntu 21.10 with this set of changes.

sdwilsh commented 2 years ago

@neg2led, ping on review of this change since you mentioned elsewhere that your notifications got messed up and you missed some things :)

neggles commented 2 years ago

Thanks! I've been going through all of these now I've realized that GitHub failed me on the notification front...

Interesting on the lack of auto-load - did you do an update-initramfs -u, (assuming that works on Ubuntu ARM) so the driver/module is available when it's probed during boot? hwmon should trigger an automatic load of the module when the device tree is enumerated / parsed during early boot.

I used the same module target path that's used in some other DKMS drivers for things on Pis, as I'm told placing DKMS modules directly under kernel/ can make apt/dpkg unhappy when the kernel is upgraded and it tries to remove the old modules directory. That may explain the lack of autoloading, though.

Could I get you to drop the README.md changes & the dkms.conf version compatibility string change, then squash these commits together? This should build and load on any 5.10+ kernel without any trouble, and 2143df6e77d980492e8f235cb4338f89c6af3d94 limits it to only 5.10/5.13 (while what's currently in there should allow any 5.10+ to attempt a build). I'll be updating the README later today (once I'm off work) to say "Tested to work on 5.10.y and [other reported successes]" along with a couple of other things.

Apart from that, happy to merge this 😄

sdwilsh commented 2 years ago

It probably won't be until this weekend until I can give it a go with my hardware again. It's possible I did not run the update-initramfs -u, but I honestly don't remember :D

sdwilsh commented 2 years ago

Thanks for merging this. The project that I was working with this has been on hold for a bit, so I haven't had the chance to get back to addressing what you asked. Looks like you fixed it up such that it'll work for 22.04 as well, which is much appreciated.