Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3892

Advanced users • How to reproduce official kernel builds to get compatible in-tree modules?

$
0
0
I am trying to patch and rebuild an in-tree kernel module so that it's still compatible with official kernels. I want to avoid carrying around a fully custom-built kernel + modules for what amounts to a trivial 2-line patch. I am cross-compiling kernel from a desktop, mostly* following the official cross-compiling guide.

But when I try to insmod the patched module I get this:

Code:

[36120.186498] usb_f_uvc: disagrees about version of symbol module_layout
Where should I look for that? How do I reproduce the official kernel build at least to a degree enough for modules to be compatible?

* -- I am completely new to cross-compiling kernels, so I still don't have a good mental model of what's going on and what depends on what, and it's what I'm trying to figure out too.
  • I am pretty sure that I have the right kernel sources, hash 5f674bf90552 for 6.6.20+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.20-1+rpt1 (2024-03-07) armv7l GNU/Linux
  • I am not using Ubuntu, instead having a crossdev-built gcc 13. This also means that CROSS_COMPILE string is a bit different: armv7a-hardfloat-linux-gnueabihf-
  • .config difference between mine and the one in /boot mostly boils down to toolchain version differences (e.g. gcc-12 vs gcc-13) and CONFIG_GCC_PLUGINS=y, so it's virtually the same.
  • modprobe --dump-modversions returns a bunch of different versions, but some still match.
  • I had to patch some (seemingly benign and cosmetic) things in kernel build scripts to get exactly the same modinfo vermagic line. Specifically, I don't really understand what "rpt" portion stands for. Not sure if that's relevant for anything.
Is what I'm trying to do completely bonkers?

What do modversions depend on? Can they really be affected by gcc version? What else can affect them? What should I try next?

Thanks!

Statistics: Posted by provod — Wed Apr 03, 2024 4:34 am



Viewing all articles
Browse latest Browse all 3892

Trending Articles