Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: zharr on June 12, 2025, 04:16:34 PM

Title: OV9281 DToverlay not loading kernel module
Post by: zharr on June 12, 2025, 04:16:34 PM
Hello,
I've been using piCore 13 with the OV9281, but with piCore 14 the module is not loaded even with
Code: [Select]
dtoverlay=ov9281,media-controller=0 in config.txt. It has been verified to be not loaded after boot with lsmod. I was able to manually load it with
Code: [Select]
sudo modprobe ov9281 but this does not make the /dev/video0 node appear. I've also tried piCore 15 (though I won't be able to use it long term due to missing packages for armv6 - Pi Zero 1). Same behaviour here, except the module has also been renamed to ov9282.ko (I expect the functionality would remain the same, but it doesn't work).
Perhaps this is not piCore related, but I cannot find any information about this for normal Raspberry Pi OS, which I would expect if it was a common issue.
Any ideas on how to further debug this? I'm not sure which dtbo the device tree file would have been compiled from and how to check them, but am willing to debug myself if pointed the right way.
Thanks!

PS: I'm currently exploring just cutting out the OV9281 driver altogether since it's too niche to rely on and I do some custom I2C commands already anyway. Just using base bcm2835-unicam would work too, though I am unsure if I can use it directly just to receive raw frames and setup the sensor via I2C in userspace. If anybody got any info on how to make unicam expose the raw data on /dev/video0, that's be amazing, too.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: patrikg on June 12, 2025, 04:42:51 PM
Have seen that config.txt has some groups in some os'es, maybe you have typed in dtoverlay at the wrong line. The groups are for what rpi model it's for.
and the gruop [ALL] is for them all.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 12, 2025, 04:43:55 PM
The overlay does not load the module, it purely configures the system.  The kernel has to detect the module to get the module loaded.

The fact that /dev/video does not get created after a manual modprobe probably mean something is no longer working or supported.   Or another dependency.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 12, 2025, 05:46:36 PM
Thanks both of you. It is under [ALL], and yeah I assume something broke. The camera system especially seems to be changing every few months, quite frustrating. Sadly I need to update because of wifi not being reliable on 13.

Will keep a lookout to eliminate the OV9281 driver as a dependency altogether and do it in userspace. No leads still.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 13, 2025, 08:06:33 AM
The overlay does not load the module, it purely configures the system.  The kernel has to detect the module to get the module loaded.

The fact that /dev/video does not get created after a manual modprobe probably mean something is no longer working or supported.   Or another dependency.
I'm having trouble finding any hints on developing kernel modules for piCore, can't even find a way to get the kernel headers.
Is it possible to develop and debug the modules on the device without recompiling the whole kernel?
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Juanito on June 13, 2025, 08:27:05 AM
The headers are supplied by linux-6.12.y_api_headers.tcz or similar.

After preparing the piCore kernel you should be able to compile an individual module using make -C

Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 14, 2025, 09:42:21 AM
EDIT: Nevermind
Do you know which packages I'd need? I got the api headers (which I'm not sure when they'll come into play yet), the picore-specific source + 6.1.68-piCore-v7l_Module.symvers (not sure if I need to rename that file), and ran make prepare / modules_prepare. So far so good
Title: Re: OV9281 DToverlay not loading kernel module
Post by: patrikg on June 14, 2025, 11:23:50 AM
Have you also see that picore 13 is very old it's now 15 or 16.

http://tinycorelinux.net/15.x/
 (http://tinycorelinux.net/15.x/)
And you can also get the precompiled modules in the modules package.
If this module is in the mainline.
http://tinycorelinux.net/15.x/aarch64/releases/RPi/src/kernel/
 (http://tinycorelinux.net/15.x/aarch64/releases/RPi/src/kernel/)
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 14, 2025, 11:34:55 AM
Yes, but we're in the embedded world - I'm using this for an embedded computer vision camera. Whether it's 5 or 10 years old doesn't really matter to me. What does matter is that 13 has a wifi problem, and 14 has a camera problem, and I see myself fixing a faulty driver module more than fixing a faulty kernel/wifi stack (and having to distribute that).
15 seems to have no packages for armv6, and I'd like to retain compatibility with pi zero 1s (since they are mostly sufficient for my purposes and it's a DIY-friendly project). Considering I didn't see any announcement of dropping og Pi Zero 1 support with 15, that might have been an oversight. Can explore that later, fact is 15 has the same broken ov9281 behaviour, so where I fix this first doesn't really matter.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 14, 2025, 11:44:51 AM
On that note, I compiled the unmodified ov9281 kernel module earlier, but have a problem
Code: [Select]
insmod: can't insert './ov9281.ko': invalid module formatI took the kernel source, .config, Module.symvers and System.map from here (http://www.tinycorelinux.net/14.x/armv7l/releases/RPi/src/kernel/) (latter 3 renamed without the prefix, in the source folder).
Then I ran in that kernel source folder:
Code: [Select]
sudo make prepare
sudo make modules_prepare
Then, in a separate module folder, where I extracted both ov9281 and ov9282, with stripped makefile, I ran
Code: [Select]
sudo make -C ../kernel M=$PWDAfter getting the above error for the first time, I saw with modinfo that my own module had a difference to the system module:
Code: [Select]
vermagic:       6.1.68-piCore-v7l SMP mod_unload modversions ARMv7 p2v8where the system one had:
Code: [Select]
vermagic:       6.1.68-piCore-v7 SMP mod_unload modversions ARMv7 p2v8So I cleaned everything, modified .config CONFIG_LOCALVERSION to match that "v7", recompiled, but still, "invalid module format"

Do I really need to compile and switch to that kernel, or what am I missing to be able to compile against the current kernel? uname -r does output "6.1.68-piCore-v7" as expected.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 14, 2025, 12:43:56 PM
Install the .config file first.  Then install/replace Module.symvers and System.map after you run modules_prepare.



Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 14, 2025, 01:51:56 PM
Hm it seems to want to "upgrade" the .config whenever I clean build. Maybe that's a hint?
By doing exactly what you said, not even replacing the localversion label, I get the same initial result
Code: [Select]
tc@trackcam:/mnt/mmcblk0p2/kernel$ sudo make clean
  CLEAN   .
tc@trackcam:/mnt/mmcblk0p2/kernel$ sudo cp /home/tc/6.1.68-piCore-v7l/.config .
tc@trackcam:/mnt/mmcblk0p2/kernel$ sudo make modules_prepare
  SYNC    include/config/auto.conf
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
*
* Restart config...
*
*
* GCC plugins
*
GCC plugins (GCC_PLUGINS) [Y/n/?] (NEW)
  Generate some entropy during boot and runtime (GCC_PLUGIN_LATENT_ENTROPY) [N/y/?] (NEW)
*
* Kernel hardening options
*
Randomize layout of sensitive kernel structures
> 1. Disable structure layout randomization (RANDSTRUCT_NONE)
  2. Fully randomize structure layout (RANDSTRUCT_FULL) (NEW)
  3. Limit randomization of structure layout to cache-lines (RANDSTRUCT_PERFORMANCE) (NEW)
choice[1-3?]:
  SYSHDR  arch/arm/include/generated/uapi/asm/unistd-oabi.h
  SYSHDR  arch/arm/include/generated/uapi/asm/unistd-eabi.h
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  LEX     scripts/dtc/dtc-lexer.lex.c
  YACC    scripts/dtc/dtc-parser.tab.[ch]
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
  HOSTCC  scripts/dtc/libfdt/fdt.o
  HOSTCC  scripts/dtc/libfdt/fdt_ro.o
  HOSTCC  scripts/dtc/libfdt/fdt_wip.o
  HOSTCC  scripts/dtc/libfdt/fdt_sw.o
  HOSTCC  scripts/dtc/libfdt/fdt_rw.o
  HOSTCC  scripts/dtc/libfdt/fdt_strerror.o
  HOSTCC  scripts/dtc/libfdt/fdt_empty_tree.o
  HOSTCC  scripts/dtc/libfdt/fdt_addresses.o
  HOSTCC  scripts/dtc/libfdt/fdt_overlay.o
  HOSTCC  scripts/dtc/fdtoverlay.o
  HOSTLD  scripts/dtc/fdtoverlay
  HOSTCC  scripts/genksyms/genksyms.o
  YACC    scripts/genksyms/parse.tab.[ch]
  HOSTCC  scripts/genksyms/parse.tab.o
  LEX     scripts/genksyms/lex.lex.c
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTLD  scripts/genksyms/genksyms
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sorttable
  HOSTCC  scripts/asn1_compiler
  SYSNR   arch/arm/include/generated/asm/unistd-nr.h
  GEN     arch/arm/include/generated/asm/mach-types.h
  SYSTBL  arch/arm/include/generated/calls-oabi.S
  SYSTBL  arch/arm/include/generated/calls-eabi.S
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CC      arch/arm/kernel/asm-offsets.s
  CALL    scripts/checksyscalls.sh
  CHKSHA1 include/linux/atomic/atomic-arch-fallback.h
  CHKSHA1 include/linux/atomic/atomic-instrumented.h
  CHKSHA1 include/linux/atomic/atomic-long.h
  LDS     scripts/module.lds
tc@trackcam:/mnt/mmcblk0p2/kernel$ sudo cp /home/tc/6.1.68-piCore-v7l/Module.symvers .
tc@trackcam:/mnt/mmcblk0p2/kernel$ sudo cp /home/tc/6.1.68-piCore-v7l/System.map .
tc@trackcam:/mnt/mmcblk0p2/kernel$ cd ../module
tc@trackcam:/mnt/mmcblk0p2/module$ ls
Kconfig   Makefile  ov9281.c  ov9282.c
tc@trackcam:/mnt/mmcblk0p2/module$ sudo make -C ../kernel M=$PWD
make: Entering directory '/mnt/mmcblk0p2/kernel'
  CC [M]  /mnt/mmcblk0p2/module/ov9281.o
  MODPOST /mnt/mmcblk0p2/module/Module.symvers
  CC [M]  /mnt/mmcblk0p2/module/ov9281.mod.o
  LD [M]  /mnt/mmcblk0p2/module/ov9281.ko
make: Leaving directory '/mnt/mmcblk0p2/kernel'
tc@trackcam:/mnt/mmcblk0p2/module$ sudo modinfo /lib/modules/6.1.68-piCore-v7/kernel.tclocal/drivers/media/i2c/ov9281.ko
filename:       /lib/modules/6.1.68-piCore-v7/kernel.tclocal/drivers/media/i2c/ov9281.ko
description:    OmniVision ov9281 sensor driver
license:        GPL v2
alias:          of:N*T*Covti,ov9281C*
alias:          of:N*T*Covti,ov9281
srcversion:     CE62C3BA7FC1699235EFB88
depends:        v4l2-async,videodev,v4l2-fwnode,mc
intree:         Y
vermagic:       6.1.68-piCore-v7 SMP mod_unload modversions ARMv7 p2v8
tc@trackcam:/mnt/mmcblk0p2/module$ sudo modinfo ./ov9281.ko
filename:       ./ov9281.ko
description:    OmniVision ov9281 sensor driver
license:        GPL v2
alias:          of:N*T*Covti,ov9281C*
alias:          of:N*T*Covti,ov9281
srcversion:     CE62C3BA7FC1699235EFB88
depends:        v4l2-async,videodev,v4l2-fwnode,mc
vermagic:       6.1.68-piCore-v7l SMP mod_unload modversions ARMv7 p2v8
tc@trackcam:/mnt/mmcblk0p2/module$ sudo insmod ./ov9281.ko
insmod: can't insert './ov9281.ko': invalid module format
tc@trackcam:/mnt/mmcblk0p2/module$ uname -r
6.1.68-piCore-v7
(Tried changing the label too but something this time didn't make it apply in modinfo, I assume it's from either Module.symvers or System.map?)

Maybe it's a problem that I'm compiling with a armv7 kernel when the precompiled files are for armv7l? Can I just change the config.txt so the pi zero 2 boots into armv7l (since it supports armv8 anyway)? Or do I need a Pi 4?
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 14, 2025, 03:38:59 PM
In the kernel versions

armv7 is for a pi2/3
armv7l is for a pi4 in 32 bit mode
armv8 is a 64 bit kernel

Everything needs to match the actual kernel you are running
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 14, 2025, 08:18:11 PM
Thanks, was being stupid and forgot there were different repos for each architecture (maybe because I played around with 15.x before)
Well, turns out I2C 10 is missing, only 1 and 11 are there, 0 and 10 (the camera one) are missing.

Config should allow for their access
Code: [Select]
# Enable access to camera I2C10, used to configure the OV9281
dtparam=i2c_vc=on
# Load built-in Kernel driver for OV9281 camera
dtoverlay=ov9281,media-controller=0

Comparing lsmod, there are two i2c-related modules loaded on piCore 13, but not on piCore 14
Code: [Select]
i2c_mux_pinctrl        16384  0
i2c_mux                16384  1 i2c_mux_pinctrl
(i2c_bcm2835 is loaded as expected on both)

Will investigate further tomorrow. From a quick look at 13.x and 14.x configs, I don't immediately see what's wrong, though I guess I will compile a bunch of modules that were removed and see if that changes anything
Thanks for the help so far!
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Juanito on June 15, 2025, 04:27:49 AM
Are your missing modules located here:

http://tinycorelinux.net/14.x/armv7/releases/RPi/src/kernel/

..in the modules-6.1.25-piCore-v7.tar.xz or modules-6.1.68-piCore-v7.tar.xz tarballs?

(there are similiar files for armv6 and armv7l)
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 15, 2025, 07:44:56 AM
Yep, missing a bunch of I2C ones:
Code: [Select]
kernel/drivers/i2c/busses/i2c-robotfuzz-osif.ko:
kernel/drivers/i2c/busses/i2c-tiny-usb.ko:
kernel/drivers/i2c/muxes/i2c-mux-gpmux.ko: kernel/drivers/i2c/i2c-mux.ko kernel/drivers/mux/mux-core.ko
kernel/drivers/i2c/muxes/i2c-mux-pca954x.ko: kernel/drivers/i2c/i2c-mux.ko
kernel/drivers/i2c/muxes/i2c-mux-pinctrl.ko: kernel/drivers/i2c/i2c-mux.ko
kernel/drivers/i2c/i2c-mux.ko:
my piCore 14 install only has.
Code: [Select]
kernel/drivers/i2c/algos/i2c-algo-bit.ko:
kernel/drivers/i2c/busses/i2c-bcm2708.ko:
kernel/drivers/i2c/busses/i2c-bcm2835.ko:
kernel/drivers/i2c/busses/i2c-gpio.ko: kernel/drivers/i2c/algos/i2c-algo-bit.ko
kernel/drivers/i2c/i2c-dev.ko:
am I missing some critical packets in the upgrade? I am manually specifying which packets to install with a custom install script, so that is very much possible, though I would expect device-drivers for I2C to be in the base image
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Juanito on June 15, 2025, 08:32:27 AM
Looking at piCore-16.x, all of the modules you mention as missing in piCore-14.x are in the base.

You could add them to the piCore-14.x analogy of /mnt/mmcblk0p1/modules-6.12.25-piCore-v7.gz?
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 15, 2025, 08:51:04 AM
mux drivers are rarely needed, and is likely not the cause of your problem
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 15, 2025, 09:31:12 AM
Well afaik the internal camera I2C is on a mux (I2C0 and I2C10). Even if the driver does not need that (and accesses it through VC somehow), I do need manual access to I2C10 in userspace for modifications to OV9281 registers.

Wrote a script that searches packages in repositories for files. And going through dependencies of modules, and trying to find them on the 14.x image, to see what's missing.
Made the following package from the modules:
Code: [Select]
#: unsquashfs -l i2c-modules-6.1.68-piCore-v7.tcz
squashfs-root
squashfs-root/lib
squashfs-root/lib/modules
squashfs-root/lib/modules/6.1.68-piCore-v7
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/busses
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/busses/i2c-robotfuzz-osif.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/busses/i2c-tiny-usb.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/i2c-mux.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/muxes
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/muxes/i2c-mux-gpmux.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/muxes/i2c-mux-pca954x.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/i2c/muxes/i2c-mux-pinctrl.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/mux
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/mux/mux-core.ko
squashfs-root/lib/modules/6.1.68-piCore-v7/kernel/drivers/mux/mux-gpio.ko
loaded it, then modprobed ov9281 - and it works! Well, /dev/video0 appears, will compile my program to see if anything else is missing.

I'd greatly appreciate if you could integrate that in the 14.x kernel - though it's easy enough to patch it back in in my setup scripts.

Also, unrelated, sorry: 15.x doesn't seem to supply armv6 packages, is Pi Zero 1 support dropped? Might try it out later, but I doubt it will work. Could switch straight to 15.x to see if everything works there (I do know the camera didn't work there either, I assume it's also missing the I2C mux packages)
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 15, 2025, 09:46:49 AM
Yes the pi0 is still supported, It’s all in the armhf folders.   We stoped creating 3 duplicate repos for the 32bit architectures.

FWIW, I’ll be spinning 16.0 release images today.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: zharr on June 15, 2025, 10:19:46 AM
Ohh, I just didn't see any v6 package files, but I guess those are renamed to not have the v6 suffix? Gotta fix that in my setup scripts then, but glad to see!

Edit. Will be waiting for the 16.x images then and test!
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 15, 2025, 10:33:12 AM
Kernel name still has v6, just the main repo name changed.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Rich on June 15, 2025, 01:16:56 PM
Hi zharr
Ohh, I just didn't see any v6 package files, but I guess those are renamed to not have the v6 suffix? ...
I don't think the module extensions ever had a v6 suffix.
No suffix means v6. These are the modules in TC14 armv6:
Code: [Select]
ls -1 *6.1.68*.tcz
alsa-modules-6.1.68-piCore.tcz
ax25-6.1.68-piCore.tcz
bluetooth-6.1.68-piCore.tcz
cdrom-6.1.68-piCore.tcz
filesystems-6.1.68-piCore.tcz
graphics-6.1.68-piCore.tcz
ipv6-netfilter-6.1.68-piCore.tcz
media-rc-6.1.68-piCore.tcz
net-bridging-6.1.68-piCore.tcz
net-usb-6.1.68-piCore.tcz
ppp-modules-6.1.68-piCore.tcz
raid-dm-6.1.68-piCore.tcz
rtc-6.1.68-piCore.tcz
touchscreen-6.1.68-piCore.tcz
usb-gadget-6.1.68-piCore.tcz
usbip-6.1.68-piCore.tcz
usb-serial-6.1.68-piCore.tcz
v4l-dvb-6.1.68-piCore.tcz
w1-6.1.68-piCore.tcz
wireguard-6.1.68-piCore.tcz
wireless-6.1.68-piCore.tcz
No v6 suffixes.
Title: Re: OV9281 DToverlay not loading kernel module
Post by: Paul_123 on June 15, 2025, 02:05:57 PM
I don't think the module extensions ever had a v6 suffix.

I use armv6 on my build system, because blank does not work well in scripts :)  but yes, x.x.x-piCore are the armv6 kernel modules.