Kernel 5.11 and BMP280 kernel module
The latest kernel update changes something that makes the BMP280 driver fail when trying to instantiate a device: --8<---------------cut here---------------start------------->8--- Mar 07 09:53:29 Otto kernel: i2c i2c-1: new_device: Instantiated device bme280 at 0x76 Mar 07 09:53:29 Otto kernel: module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000ce203c91, val ffffffffc106808a --8<---------------cut here---------------end--------------->8--- Anybody has an idea what actually goes wrong and how to fix it? I've seen a few discussions on the net that suggest that the headers were mismatched with the kernel. I'm using the kernel source package as always and just change the config and compile the modules for these as always and there is nothing to suggest that this is somehow the wrong source tree. I usually compile the module while still running on the old kernel, but for good measure I've been doing a make clean and recompiled after booting into the new kernel, but I get the same result then. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Wavetables for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables
Achim Gratz writes:
The latest kernel update changes something that makes the BMP280 driver fail when trying to instantiate a device:
Mar 07 09:53:29 Otto kernel: i2c i2c-1: new_device: Instantiated device bme280 at 0x76 Mar 07 09:53:29 Otto kernel: module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000ce203c91, val ffffffffc106808a
Anybody has an idea what actually goes wrong and how to fix it?
Now entered as: https://bugzilla.opensuse.org/show_bug.cgi?id=1183198 Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ DIY Stuff: http://Synth.Stromeko.net/DIY.html
So this turned out to be pilot error mostly, although it is still unclear (to me at least) what exactly changed. Since the solution I've arrived at with the great help of Takashi Iwai is not very obvious (again, to me at least) and most how-to documents on the net will lead you towards the path that I had been taking earlier, here's what I'm doing now (I've skipped the SPI variant of the module since the sensors I'm using are connected via I²C): --8<---------------cut here---------------start------------->8--- KVER=5.11.4-1 KREL=${KVER}-default KMOD=/lib/modules/${KREL}/updates/ KSRC=/usr/src/linux-${KVER}/ KBLD=/usr/src/linux-${KVER}-obj/x86_64/default/ MPTH=drivers/iio/pressure echo $KMOD $KSRC $KBLD $MPTH rsync --delete -ai $KSRC/$MPTH/ bmp280-$KVER/ cd bmp280-$KVER make -C $KBLD M=$(pwd) \ CONFIG_BMP280=m CONFIG_BMP280_I2C=m \ bmp280.ko bmp280-i2c.ko && mkdir -p $KMOD && cp bmp*.ko $KMOD && depmod ${KREL} && ll ${KMOD} && echo Success… --8<---------------cut here---------------end--------------->8--- In other words, do not do the prepare, modules_prepare and modules steps that you will widely find described elsewhere as they'll either throw errors or modify the system trees in ways that Takashi said should not be done. Judicious deviation from that rule and a bit more reading of https://www.kernel.org/doc/Documentation/kbuild/modules.txt however gets rid of some annoying warning messages and obviates the need for the manual installation of the module files: --8<---------------cut here---------------start------------->8--- KVER=5.11.4-1 KREL=${KVER}-default KMID=updates KMOD=/lib/modules/${KREL}/${KMID}/ KSRC=/usr/src/linux-${KVER}/ KBLD=/usr/src/linux-${KVER}-obj/x86_64/default/ MPTH=drivers/iio/pressure echo $KMOD $KSRC $KBLD $MPTH rsync --delete -ai $KSRC/$MPTH/ bmp280-$KVER/ cd bmp280-$KVER unxz -c /boot/vmlinux-${KREL}.xz > ${KBLD}/vmlinux && make -C $KBLD M=$(pwd) \ CONFIG_BMP280=m CONFIG_BMP280_I2C=m \ bmp280.ko bmp280-i2c.ko && ln -sf /boot/System.map-${KREL} ${KBLD}/System.map && make -C $KBLD M=$(pwd) INSTALL_MOD_DIR=$KMID modules_install && rm ${KBLD}/System.map ${KBLD}/vmlinux && ll ${KMOD} && echo Success… --8<---------------cut here---------------end--------------->8--- It should be noted that you are unlikely to succeed in this manner with a module that requires support from elsewhere in the kernel that is not already enabled. In other words, if the iio subsystem was not already configured in I'd expect the compilation of a single module from that subsystem to fail and there may well be similar dependencies across subsystems. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptation for Waldorf rackAttack V1.04R1: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
participants (1)
-
Achim Gratz