neggles / cm4io-fan

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

support for Linux raspberrypi 6.1.x kernels #18

Open santiagobarros opened 1 year ago

santiagobarros commented 1 year ago

Upon running sudo ./install.sh

this is the output :

> Copying source to /usr/src/cm4io-fan-0.2.0...Done
> Running DKMS install...
> Error!  The /var/lib/dkms/cm4io-fan/0.2.0/6.1.21-v8+/aarch64/dkms.conf for module cm4io-fan includes a BUILD_EXCLUSIVE directive which
> does not match this kernel/arch.  This indicates that it should not be built.
> 

Iam running :

pi@raspberrypi:~/src/cm4io-fan $ uname -a Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

What do I need to update in order for the installation to succeed?

H-sw123 commented 1 year ago

Could you please let me know if there is a solution to this problem?

TomHW commented 1 year ago

I made a hack in install.sh

diff --git a/install.sh b/install.sh
index bfdbf33..ff5b34c 100755
--- a/install.sh
+++ b/install.sh
@@ -22,6 +22,7 @@ fi
 echo -n "Copying source to ${DRV_DIR}..."
 [[ -d ${DRV_DIR} ]] && rm -r ${DRV_DIR}
 mkdir -p ${DRV_DIR} && git archive HEAD | tar -x -C "/usr/src/${DRV_NAME}-${DRV_VERSION}"
+sed -i -e "s/^BUILD_EXCLUSIVE_KERNEL=.*$/BUILD_EXCLUSIVE_KERNEL=\^6\\.\.*/g" "/usr/src/${DRV_NAME}-${DRV_VERSION}/dkms.conf"
 echo "Done"

 # run dkms

The build was successful, but after reboot the fan stopped even when the cpu temperature increased.

alinjco commented 1 year ago

Same issue here.

Kernel: 6.1.21-v8+ (aarch64)

Even if I bypass the BUILD_EXCLUSIVE_KERNEL, the module does not work properly - the fan does not spin. Help?

TomHW commented 1 year ago

Have a Look at this. After blacklisting emc2305 it works for me.

alinjco commented 1 year ago

Works for me as well. Thanks for the tip.

ilg-ul commented 1 year ago

Andi @neggles, any plan to update the driver for the 6.x kernel?

Bypassing the BUILD_EXCLUSIVE_KERNEL makes the build pass, and the module is listed by the kernel (emc2301: loading out-of-tree module taints kernel.), but just that, the chip is not detected.

Arthur-Philip-Dent commented 1 year ago

Summer is almost over. And I ran into the same issue with a CM4-IO-BASE-C from WaveShare, which links to your repo. I'm not saying, You have to fix it. Just if you have time and there is nothing else to do... :-)

kbenyous commented 1 year ago

Hello,

@Arthur-Philip-Dent Summer is almost over. So cooling is no longer required ;-) I made it compile and run on a Waveshare CM4-IO-BASE-B, after a rpi-update that updated my kernel to version 6.1.32-v8+. The cm4io-fan driver was installed with dkms support. First, I had to comment the BUILD_EXCLUSIVE_KERNEL variable in dkms.conf, before running dkms install cm4io-fan/0.2.0 as specified in the README.

Then, I had to reinstall the kernel from RaspberryPiOS official sources :

apt install --reinstall raspberrypi-bootloader raspberrypi-kernel raspberrypi-kernel-headers

Then I removed any blacklist for emc2305 module in my modprobe configuration. The emc2301 is now supported by the new emc2305 driver. My RPI runs a 6.1.21-v8+ kernel. And reboot... The emc2301 module and the cm4io-fan is now visible in the dmesg logs :

[    5.546461] emc2301 10-002f: EMC2301 detected
[    5.546493] emc2301 10-002f: Have 1 fans configured in DT
[    5.546517] emc2301 10-002f: Fan 0 Cooling step is 500 RPM, minimum 1000, max 5000 RPM

It is also visible in the sensors output (package lm-sensors) :

root@mypi:~# sensors
emc2301-i2c-10-2f
Adapter: i2c-22-mux (chan_id 1)
fan1:        2685 RPM

cpu_thermal-virtual-0
Adapter: Virtual device
temp1:        +50.1°C  (crit = +110.0°C)

rpi_volt-isa-0000
Adapter: ISA adapter
in0:              N/A

By the way, thank you very much @neggles for your work.

Arthur-Philip-Dent commented 1 year ago

Hey @kbenyous, I‘m starting to „learn this stuff“, and I thought, it’s a good idea to leave this matter for the “pros”.

I‘m struggling currently on any part I pick up to make a CM4 module working to use it for a project (TeslaUSB) to make a “Pi 4B compatible” SBC running with a piece of software, running on a actual bullseye installation. Just saying “Gadget mode and M.2 SSD and suddenly WiFi doesn’t work anymore… the “silent fan” would help a but not to freak out. And yeah, not so hat at all anymore, we can save some energy. Right. ☺️

But thanks for all the instructions. Still I have questions. Will learn.

Best regards, Arthur

tht commented 10 months ago

Sorry for bringing up that old topic again but I'm struggling here too.

What I did:

git clone https://github.com/neggles/cm4io-fan.git /usr/src/cm4io-fan-0.2.0
cd /usr/src/cm4io-fan-0.2.0
# edit dkms.conf to remove BUILD_EXCLUSIVE_KERNEL
dkms install cm4io-fan/0.2.0

The Output I get:

Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Creating symlink /var/lib/dkms/cm4io-fan/0.2.0/source -> /usr/src/cm4io-fan-0.2.0

Building module:
Cleaning build area...
make -j4 KERNELRELEASE=6.1.0-rpi7-rpi-v8....(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.0-rpi7-rpi-v8 (aarch64)
Consult /var/lib/dkms/cm4io-fan/0.2.0/build/make.log for more information.

Looking at the referenced /var/lib/dkms/cm4io-fan/0.2.0/build/make.log I see this:

DKMS make.log for cm4io-fan-0.2.0 for kernel 6.1.0-rpi7-rpi-v8 (aarch64)
Wed 20 Dec 08:00:57 GMT 2023
echo "DKMS found at /usr/sbin/dkms"
make -C emc2301  KERNELRELEASE=6.1.0-rpi7-rpi-v8
make -C overlays  KERNELRELEASE=6.1.0-rpi7-rpi-v8
DKMS found at /usr/sbin/dkms
make[1]: Entering directory '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays'
make[1]: Entering directory '/var/lib/dkms/cm4io-fan/0.2.0/build/emc2301'
make -C /lib/modules/6.1.0-rpi7-rpi-v8/build M=$PWD
make -C /lib/modules/6.1.0-rpi7-rpi-v8/build M=/var/lib/dkms/cm4io-fan/0.2.0/build/overlays DTC_INCLUDE=/lib/modules/6.1.0-rpi7-rpi-v8/build/include
make[2]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make[2]: Entering directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
  CC [M]  /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.o
make[3]: *** No rule to make target '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/cm4io-fan.dtbo', needed by '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/'.  Stop.
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/usr/src/linux-headers-6.1.0-rpi7-common-rpi/Makefile:2039: /var/lib/dkms/cm4io-fan/0.2.0/build/overlays] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make[1]: *** [Makefile:13: all] Error 2
make[1]: Leaving directory '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays'
make: *** [Makefile:17: build-overlays] Error 2
make: *** Waiting for unfinished jobs....
  MODPOST /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/Module.symvers
  CC [M]  /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.mod.o
  LD [M]  /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.ko
make[2]: Leaving directory '/usr/src/linux-headers-6.1.0-rpi7-rpi-v8'
make[1]: Leaving directory '/var/lib/dkms/cm4io-fan/0.2.0/build/emc2301'

I'm lost here… the Linux-Headers for the current kernel-version are installed. It's a fresh downloaded ans installed 2023-12-11-raspios-bookworm-arm64-lite.

Anyone with an idea what I could be missing here?

TomHW commented 9 months ago

Hi @tht , I can reproduce your problem with bookworm. But during system setup it seems that that the file was built. I'm not able to reproduce it but the file's timestamp indicates that it happened at the beginning. I found a log file in the dkms folder:

DKMS make.log for cm4io-fan-0.2.0 for kernel 6.1.21-v8+ (aarch64)
Wed  3 Jan 14:52:54 CET 2024
echo "DKMS found at /usr/sbin/dkms"
make -C emc2301  KERNELRELEASE=6.1.21-v8+
make -C overlays  KERNELRELEASE=6.1.21-v8+
DKMS found at /usr/sbin/dkms
make[1]: Entering directory '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays'
make[1]: Entering directory '/var/lib/dkms/cm4io-fan/0.2.0/build/emc2301'
make -C /lib/modules/6.1.21-v8+/build M=$PWD
make -C /lib/modules/6.1.21-v8+/build M=/var/lib/dkms/cm4io-fan/0.2.0/build/overlays DTC_INCLUDE=/lib/modules/6.1.21-v8+/build/include
make[2]: Entering directory '/usr/src/linux-headers-6.1.21-v8+'
make[2]: Entering directory '/usr/src/linux-headers-6.1.21-v8+'
warning: the compiler differs from the one used to build the kernel
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Debian 10.2.1-6) 10.2.1 20210110
  The kernel was built by: gcc (Debian 10.2.1-6) 10.2.1 20210110
  You are using:           gcc (Debian 12.2.0-14) 12.2.0
  You are using:           gcc (Debian 12.2.0-14) 12.2.0
  CC [M]  /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.o
  DTCO    /var/lib/dkms/cm4io-fan/0.2.0/build/overlays/cm4io-fan.dtbo
  MODPOST /var/lib/dkms/cm4io-fan/0.2.0/build/overlays/Module.symvers
make[2]: Leaving directory '/usr/src/linux-headers-6.1.21-v8+'
make[1]: Leaving directory '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays'
  MODPOST /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/Module.symvers
  CC [M]  /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.mod.o
  LD [M]  /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.ko
make[2]: Leaving directory '/usr/src/linux-headers-6.1.21-v8+'
make[1]: Leaving directory '/var/lib/dkms/cm4io-fan/0.2.0/build/emc2301'

It seems that the kernel 6.1.21-v8+ was used, but after an upgrade I have kernel 6.1.0-rpi7-rpi-v8 and I'm no longer able to build the driver. I added these lines to config.txt:

dtparam=i2c_vc=on
dtoverlay=cm4io-fan,minrpm=500,maxrpm=5000,midtemp=45000,midtemp_hyst=2000,maxtemp=50000,maxtemp_hyst=2000

After Reboot the fan stopped and it starts cooling at 45°. Not satisfying for the moment but it works for me now. If I find time in the next few days I will try to do the installation again.

TomHW commented 9 months ago

Today I made the installation again, here my steps:

  1. Make a system upgrade with apt.
  2. Install dkms.
  3. Clone cm4io-fan repo.
  4. Fix install.sh (see my post from April).
  5. Run install.sh with no success.
  6. Reinstall kernel as mentioned by @kbenyous.

During kernel re-installation the driver will be built with success.

tht commented 9 months ago

Today I made the installation again, here my steps:

  1. Make a system upgrade with apt.
  2. Install dkms.
  3. Clone cm4io-fan repo.
  4. Fix install.sh (see my post from April).
  5. Run install.sh with no success.
  6. Reinstall kernel as mentioned by @kbenyous.

During kernel re-installation the driver will be built with success.

Can confirm… it works for me too after reinstalling the kernel. Strange…

/etc/kernel/postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.21-v8+.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
make -j4 KERNELRELEASE=6.1.21-v8+....
Signing module /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.ko

Running the post_build script:
cm4io-fan.dtbo:
 - Post build
   - Copying /var/lib/dkms/cm4io-fan/0.2.0/build/overlays/cm4io-fan.dtbo to /var/lib/dkms/cm4io-fan/0.2.0/6.1.21-v8+/aarch64/module/

Cleaning build area...

emc2301.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.1.21-v8+/updates/dkms/

Running the post_install script:
cm4io-fan.dtbo:
 - Installation
   - Installing to /boot/overlays/

depmod....
dkms: autoinstall for kernel: 6.1.21-v8+.

Thanks a lot, seems to be working just fine now.

rahra commented 9 months ago

I'm lost here… the Linux-Headers for the current kernel-version are installed. It's a fresh downloaded ans installed 2023-12-11-raspios-bookworm-arm64-lite.

Anyone with an idea what I could be missing here?

Same problem here. If you manually run sudo make --debug in /var/lib/dkms/cm4io-fan/0.2.0/build it reveals that the build process itself fails for some reason, but I couldn't yet figure out why.

GNU Make 4.3
Built for aarch64-unknown-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/' does not exist.
     File 'FORCE' does not exist.
    Must remake target 'FORCE'.
    Successfully remade target file 'FORCE'.
   Prerequisite 'FORCE' of target '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/modules.order' does not exist.
  Must remake target '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/modules.order'.
  Successfully remade target file '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/modules.order'.
  File '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/cm4io-fan.dtbo' does not exist.
 Must remake target '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/cm4io-fan.dtbo'.
make[3]: *** No rule to make target '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/cm4io-fan.dtbo', needed by '/var/lib/dkms/cm4io-fan/0.2.0/build/overlays/'.  Stop.
neggles commented 8 months ago

Hi all, sorry i've not had time to come back to this for quite a while partly because my CM4 carrier board doesn't have a module on it at the moment (and I don't have a spare)

There were quite a few changes to the way this driver has to hook into the kernel since i last updated it, and i've learned a few more things about how DKMS builds etc. work, so it'll need a bit of rework.

I'll try to come back to this in the near future and get it cleaned up (and updated with some of the other nice bits and pieces from the original author's newer versions, intended for another device)

Sorry for the trouble...

Arthur-Philip-Dent commented 8 months ago

Good things take a while! So all good! Thanks for your input!

lukweb commented 8 months ago

Just wanted to share my odyssey... maybe it helps someone.

Board: Waveshare CM4-IO-WIRELESS-BASE-B with CM4 (eMMC and wireless) OS: Raspberry Pi OS Lite, Release date: December 11th 2023, System: 64-bit, Kernel version: 6.1, Debian version: 12 (bookworm)

  1. Flashing image Kernel after flashing: 6.1.0-rpi7-rpi-v8 (6.1.63-1+rpt1)
  2. apt-get update && apt-get -y upgrade
  3. apt-get -y install dkms raspi-firmware linux-image-rpi-v8 linux-headers-rpi-v8 Note: new package names for raspberrypi-bootloader, raspberrypi-kernel and raspberrypi-kernel-headers
  4. reboot Kernel after reboot: 6.1.0-rpi8-rpi-v8 (6.1.73-1+rpt1)
  5. download and extract cm4io-fan-0.2.0 into /usr/src
  6. removing the line starting with "BUILD_EXCLUSIVE_KERNEL" in /usr/src/cm4io-fan-0.2.0/dkms.conf
  7. because the cm4io-fan.dtbo was never build I ended up modifing the file /usr/src/cm4io-fan-0.2.0/overlays/Makefile to this:
    
    KDIR ?= /lib/modules/${KERNELRELEASE}/build
    PWD := $(shell pwd)

COMMON_HEADERS := $(shell uname -r | sed 's/-rpi-.*/-common-rpi/g') DTS_INCLUDE := /usr/src/linux-headers-$(COMMON_HEADERS)/include

DTC_INCLUDE := $(KDIR)/include

dtbo-y += cm4io-fan.dtbo

targets += $(dtbo-y) always-y += $(dtbo-y) clean-files := $(dtbo-y)

all: cpp -nostdinc -I $(DTS_INCLUDE) -undef -x assembler-with-cpp cm4io-fan-overlay.dts cm4io-fan-overlay.dts.preprocessed dtc -@ -I dts -O dtb -o cm4io-fan.dtbo cm4io-fan-overlay.dts.preprocessed $(MAKE) -C $(KDIR) M=$(PWD) DTC_INCLUDE=$(DTC_INCLUDE)

clean: $(MAKE) -C $(KDIR) M=$(PWD) clean

install: $(modules_install) modules_install: cp $(dtbo-y) /boot/overlays/

Remarks:
     - DTS_INCLUDE points to the kernel header files
     - cpp 'preprocesses' the dts file to remove the include directive (by expanding the THERMAL_NO_LIMIT variable)
     - dtc 'builds' the dtbo file required by the make on the next line

8. dkms install cm4io-fan/0.2.0
9. create the file /etc/modules-load.d/cm4io-fan.conf with "emc2301" as content
10. enabling I2C and updated /boot/firmware/config.txt (moved from /boot/config.txt recently) with the dtoverlay=cm4io-fan,...
11. reboot
12. the noise is gone!

dmesg | grep emc2301

[ 4.668333] emc2301: loading out-of-tree module taints kernel. [ 4.677681] emc2301 10-002f: EMC2301 detected [ 4.677761] emc2301 10-002f: Have 1 fans configured in DT [ 4.677786] emc2301 10-002f: Fan 0 Cooling step is 562 RPM, minimum 500, max 5000 RPM [ 4.681411] emc2301 10-002f: registering a cooling device


I know, this is not a proper solution, but for the time being this works in my case and it might help someone more experienced to fix the "dtbo not build by make" issue.

Anyway, thanks for all the work @neggles and the hints by @sdwilsh in #6 (yes the warnings mentioned by him are still there with my approach)

### Update (23 Mar 2024):
Another issue came up after installing the latest Raspberry Pi OS...

/var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.c:475:21: error: initialization of 'int ()(struct i2c_client )' from incompatible pointer type 'int ()(struct i2c_client , const struct i2c_device_id *)' [-Werror=incompatible-pointer-types] 475 | .probe = emc2301_i2c_probe, | ^~~~~ /var/lib/dkms/cm4io-fan/0.2.0/build/emc2301/emc2301.c:475:21: note: (near initialization for 'emc2301_i2c_driver.probe')



I fixed it by changing line 344 in file: /usr/src/cm4io-fan-0.2.0/emc2301/emc2301.c
from:
`static int emc2301_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)`
to:
`static int emc2301_i2c_probe(struct i2c_client *i2c)`
VikingGer commented 2 months ago

I forked the project and implemented the fixes: https://github.com/VikingGer/cm4io-fan

TomHW commented 2 months ago

I forked the project and implemented the fixes: https://github.com/VikingGer/cm4io-fan

Thanks for your effort. But I'm not able to build it on my CM4 (6.1.0-rpi7-rpi-v8, Debian 1:6.1.63-1+rpt1 (2023-11-24)).

/var/lib/dkms/cm4io-fan/0.2.1/build/emc2301/emc2301.c:475:21: error: initialization of ‘int (*)(struct i2c_client *, const struct i2c_device_id *)’ from incompatible pointer type ‘int (*)(struct i2c_client *)’ [-Werror=incompatible-pointer-types]
  475 |         .probe    = emc2301_i2c_probe,
      |                     ^~~~~~~~~~~~~~~~~
/var/lib/dkms/cm4io-fan/0.2.1/build/emc2301/emc2301.c:475:21: note: (near initialization for ‘emc2301_i2c_driver.probe’)

The fix from @lukweb is installed, but the error is still there.

VikingGer commented 2 months ago

I forked the project and implemented the fixes: https://github.com/VikingGer/cm4io-fan

Thanks for your effort. But I'm not able to build it on my CM4 (6.1.0-rpi7-rpi-v8, Debian 1:6.1.63-1+rpt1 (2023-11-24)).

/var/lib/dkms/cm4io-fan/0.2.1/build/emc2301/emc2301.c:475:21: error: initialization of ‘int (*)(struct i2c_client *, const struct i2c_device_id *)’ from incompatible pointer type ‘int (*)(struct i2c_client *)’ [-Werror=incompatible-pointer-types]
  475 |         .probe    = emc2301_i2c_probe,
      |                     ^~~~~~~~~~~~~~~~~
/var/lib/dkms/cm4io-fan/0.2.1/build/emc2301/emc2301.c:475:21: note: (near initialization for ‘emc2301_i2c_driver.probe’)

The fix from @lukweb is installed, but the error is still there.

Thanks for pointing that out. Guess, I was bit too lazy. It seems, the probe function was changed somewhere between kernel 6.1 (yours) and 6.8 (mine), but I wasnt able to find the exact kernel version. So I fixed it for what I know. Please try to replace line 344 with the following and try to compile again. If it works I'll merge it into the git code.

if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)

static int emc2301_i2c_probe(struct i2c_client i2c, const struct i2c_device_id id)

else

static int emc2301_i2c_probe(struct i2c_client *i2c)

endif

TomHW commented 2 months ago

So I fixed it for what I know. Please try to replace line 344 with the following and try to compile again. If it works I'll merge it into the git code.

if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) static int emc2301_i2c_probe(struct i2c_client i2c, const struct i2c_device_id id) #else static int emc2301_i2c_probe(struct i2c_client *i2c) #endif

With that fix installed the build works perfectly. You can merge it into the git code. Great work, many thanks!

TomHW commented 2 months ago

Sorry, I was too happy too soon. The build was successful with the install.sh script, but after an apt upgrade the error was back. dkms status showed me an old installed module (0.2.0) that couldn't be removed with dkms. I have deleted the corresponding directories manually. After that an apt upgrade was successful for kernel 6.6 but it still shows the error during kernel 6.1 builds.

VikingGer commented 2 months ago

Thank you for testing. What you describe may be due to residual code somewhere in the system. Have you deinstalled via sudo dkms remove cm4io-fan/0.2.0 --all ?

TomHW commented 2 months ago

Have you deinstalled via sudo dkms remove cm4io-fan/0.2.0 --all ?

No, I tried it without the option --all and got the reply that it isn't installed. But the dkms status showed it. Then after deleting the directories the status only shows the 0.2.1 version:

cm4io-fan/0.2.1, 6.6.31+rpt-rpi-2712, aarch64: installed
cm4io-fan/0.2.1, 6.6.31+rpt-rpi-v8, aarch64: installed

But after an apt upgrade the dkms starts a build for the 6.1 kernel that fails:

linux-headers-6.1.0-23-arm64 (6.1.99-1) wird eingerichtet ...
/etc/kernel/header_postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.0-23-arm64.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
make -j4 KERNELRELEASE=6.1.0-23-arm64....(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.0-23-arm64 (aarch64)
Consult /var/lib/dkms/cm4io-fan/0.2.1/build/make.log for more information.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.0-23-arm64 failed!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 11
Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-6.1.
0-23-arm64.postinst line 11.
dpkg: Fehler beim Bearbeiten des Paketes linux-headers-6.1.0-23-arm64 (--configure):
 »installiertes post-installation-Skript des Paketes linux-headers-6.1.0-23-arm64«-Unter
prozess gab den Fehlerwert 1 zurück
dpkg: Abhängigkeitsprobleme verhindern Konfiguration von linux-headers-arm64:
 linux-headers-arm64 hängt ab von linux-headers-6.1.0-23-arm64 (= 6.1.99-1); aber:
  Paket linux-headers-6.1.0-23-arm64 ist noch nicht konfiguriert.

dpkg: Fehler beim Bearbeiten des Paketes linux-headers-arm64 (--configure):
 Abhängigkeitsprobleme - verbleibt unkonfiguriert
Fehler traten auf beim Bearbeiten von:
 linux-headers-6.1.0-23-arm64
 linux-headers-arm64
E: Sub-process /usr/bin/dpkg returned an error code (1)

Logfile: make.log

But the module for kernel 6.6 was built and and that is the main thing.

VikingGer commented 2 months ago

Hm...strange. I just had a look in the different kernel sources of i2c.h and they prepared a probe_new method in the i2c_driver class with the second parameter removed in kernel V6.1. However, that doesn't explain what you see. Anyway, they removed/replaced the probe method in kernel V6.6. I'll modify the code according to that and have to assume that it should work in general.