gpio-i2c disappear after upgrade to 6.1.54-rt15-v8+
davesliu opened this issue · comments
Describe the bug
I previous use the 6.1.21-v8+ kernel on raspberry pi 4B, and it has below configuration in /boot/config.txt
dtparam=i2c_arm=on,i2c_arm_baudrate=100000
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=23,i2c_gpio_scl=24,i2c_gpio_delay_us=4
the i2c-gpio is configured as i2c-3 adapter and can be seen as /dev/i2c-3 before I upgrade the kernel to 6.1.54-rt15-v8+.
After I upgrade the kernel to 6.1.54-rt15-v8+ and then reboot, I can only see /dev/i2c-1 now. (I didn't change the /boot/config.txt)
When I open the /boot/config.txt after the kernel is upgraded, it still has below content but /dev/i2c-3 disappear
dtparam=i2c_arm=on,i2c_arm_baudrate=100000
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=23,i2c_gpio_scl=24,i2c_gpio_delay_us=4
Could you help to comment how to fix this issue?
Thanks
Steps to reproduce the behaviour
- download and install the 6.1.54-rt15-v8+ with instructions in https://github.com/kdoren/linux/wiki/64-bit-kernel-with-32-bit-userland and https://github.com/kdoren/linux/wiki/Installation-of-kernel-from-deb-package-(Raspberry-Pi-OS)
- reboot the system and the /dev/i2-c disappear.
Device (s)
Raspberry Pi 4 Mod. B
System
pi@raspberrypi:~ $ cat /etc/rpi-issue
Raspberry Pi reference 2023-05-03
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 47eee1f0ddcf8811559d51eea1c1bb48335e3e88, stage5
pi@raspberrypi:~ $ vcgencmd version
Mar 17 2023 10:50:39
Copyright (c) 2012 Broadcom
version 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean) (release) (start)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.54-rt15-v8+ #1 SMP PREEMPT_RT Fri Sep 29 08:29:09 BST 2023 aarch64 GNU/Linux
Logs
No response
Additional context
No response
I found the root cause, the script in https://github.com/kdoren/linux/wiki/Installation-of-kernel-from-deb-package-(Raspberry-Pi-OS) will add below content in /boot/config.txt. The overlay_prefix will be redirected to the o directory, but in fact, there is no o directory. It only has 6.1.54-rt15-v8+/o directory.
[all]
kernel=vmlinuz-6.1.54-rt15-v8+
# initramfs initrd.img-6.1.54-rt15-v8+
os_prefix=6.1.54-rt15-v8+/
overlay_prefix=o/
arm_64bit=1
[all]
I manually changed the overlay_prefix=6.1.54-rt15-v8+/o/overlays/ in /boot/config.txt and then reboot system, the /dev/i2c-3 can be seen again.
@kdoren Could you update the script in https://github.com/kdoren/linux/wiki/Installation-of-kernel-from-deb-package-(Raspberry-Pi-OS)?
@davesliu Thanks for reporting.
Sorry to say that I introduced a bug when I updated the script. This is now fixed in the wiki page.
The "overlay_prefix=o/" is correct, the problem was that the "overlay" subdirectory wasn't being renamed to "o" because it already existed. The overlays should all be in "o", not "o/overlays".
The reason for using "o" instead of "overlays" is that there is (or was) a restriction on the total number of chars in an overlay filespec, which causes overlays with long names to fail. I don't know if that restriction has changed, if not it could be a bigger issue now that "/firmware" has been added to the path.
Glad you got it working, but your config is now strange, you might want to reinstall using the fixed script to avoid potential confusion later.
See here for more detail on how prefixes are supposed to work:
https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/config_txt/boot.adoc#overlay_prefix
Thanks,
Kevin