WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: OV9281 DToverlay not loading kernel module  (Read 2142 times)

Offline zharr

  • Newbie
  • *
  • Posts: 45
OV9281 DToverlay not loading kernel module
« 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.
« Last Edit: June 12, 2025, 04:26:33 PM by zharr »

Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 771
Re: OV9281 DToverlay not loading kernel module
« Reply #1 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.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1432
Re: OV9281 DToverlay not loading kernel module
« Reply #2 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.

Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #3 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.

Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #4 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?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15239
Re: OV9281 DToverlay not loading kernel module
« Reply #5 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


Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #6 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

Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 771
Re: OV9281 DToverlay not loading kernel module
« Reply #7 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/

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/


Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #8 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.

Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #9 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 (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.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1432
Re: OV9281 DToverlay not loading kernel module
« Reply #10 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.




Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #11 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?
« Last Edit: June 14, 2025, 01:55:14 PM by zharr »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1432
Re: OV9281 DToverlay not loading kernel module
« Reply #12 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

Offline zharr

  • Newbie
  • *
  • Posts: 45
Re: OV9281 DToverlay not loading kernel module
« Reply #13 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!

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 15239
Re: OV9281 DToverlay not loading kernel module
« Reply #14 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)