Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bookworm kernel headers for camera driver kernel module #6326

Open
pbaetens opened this issue Aug 27, 2024 · 7 comments
Open

bookworm kernel headers for camera driver kernel module #6326

pbaetens opened this issue Aug 27, 2024 · 7 comments

Comments

@pbaetens
Copy link

pbaetens commented Aug 27, 2024

LINK TO FORUM:
https://forums.raspberrypi.com/viewtopic.php?p=2248093#p2248093

for a custom camera driver I'm trying to build a dkms module.
For sake of simplicity, let's reproduce it with the imx219 driver.
basically I have a folder structure like this:

    pi@raspberrypi:~/ams_rpi_kernel/imx219/src $ tree
    .
    ├── imx219.c
    ├── imx219.dtsi
    ├── imx219-overlay.dts
    ├── Kbuild
    └── Makefile 

pi@raspberrypi:~/ams_rpi_kernel/imx219/src $ make -C /lib/modules/6.6.31+rpt-rpi-v8/build  M=$PWD CPATH=/usr/src/linux-headers-6.6.31+rpt-common-rpi/include/ 
make: Entering directory '/usr/src/linux-headers-6.6.31+rpt-rpi-v8'
  CC [M]  /home/pi/ams_rpi_kernel/imx219/src/imx219.o
make[2]: *** No rule to make target '/home/pi/ams_rpi_kernel/imx219/src/imx219-overlay.dtbo', needed by '/home/pi/ams_rpi_kernel/imx219/src/'.  Stop.
make[1]: *** [/usr/src/linux-headers-6.6.31+rpt-common-rpi/Makefile:1938: /home/pi/ams_rpi_kernel/imx219/src] Error 2
make: *** [/usr/src/linux-headers-6.6.31+rpt-common-rpi/Makefile:246: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.6.31+rpt-rpi-v8'

on older kernel versions, this command worked fine for me. (6.1.y headers + imx219.c from that kernel)


pi@raspberrypi:~/ams_rpi_kernel/imx219/src61 $ make -C /lib/modules/6.1.21-v8+/build/  M=$PWD CPATH=/usr/src/linux-headers-6.1.21-v8+/include/
make: Entering directory '/usr/src/linux-headers-6.1.21-v8+'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Debian 10.2.1-6) 10.2.1 20210110
  You are using:           gcc (Debian 12.2.0-14) 12.2.0
  CC [M]  /home/pi/ams_rpi_kernel/imx219/src61/imx219.o
  DTCO    /home/pi/ams_rpi_kernel/imx219/src61/imx219.dtbo
  MODPOST /home/pi/ams_rpi_kernel/imx219/src61/Module.symvers
  CC [M]  /home/pi/ams_rpi_kernel/imx219/src61/imx219.mod.o
  LD [M]  /home/pi/ams_rpi_kernel/imx219/src61/imx219.ko
make: Leaving directory '/usr/src/linux-headers-6.1.21-v8+'

more info:
I'm using pi4b, 64bit, bookworm. kernel 6.6.31.


pi@raspberrypi:~/ams_rpi_kernel/imx219/src $ uname -a
Linux raspberrypi 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux

contents of the files:
Kbuild


obj-m  := imx219.o
dtbo-y += imx219.dtbo
targets += $(dtbo-y)
always  := $(dtbo-y)
always-y        := $(dtbo-y)

@raspberrypi raspberrypi deleted a comment Aug 27, 2024
@pbaetens
Copy link
Author

simplified version linked here:
https://forums.raspberrypi.com/viewtopic.php?t=375795

@pbaetens pbaetens reopened this Aug 28, 2024
@pbaetens
Copy link
Author

pbaetens commented Sep 2, 2024

@davidplowman any experience w this? thanks!

@davidplowman
Copy link
Contributor

@davidplowman any experience w this? thanks!

Sorry, I'm afraid I don't know anything about this. Other folk who monitor these issues would know more.

@6by9
Copy link
Contributor

6by9 commented Sep 9, 2024

make[2]: *** No rule to make target '/home/pi/ams_rpi_kernel/imx219/src/imx219-overlay.dtbo', needed by '/home/pi/ams_rpi_kernel/imx219/src/'.  Stop.

The rule is at https://github.com/raspberrypi/linux/blob/rpi-6.6.y/scripts/Makefile.lib#L429-L445

For some reason that doesn't appear to have been copied through to the version in /usr/lib/linux-kbuild-6.6.47+rpt/scripts, which is part of the package linux-kbuild-6.6.47+rpt and symlinked into /usr/src/linux-headers-6.6.47+rpt-rpi-[v8|2712].

@XECDesign how is linux-kbuild-6.6.47+rpt built, and is it sourcing a stock kernel tree rather than our tree?

@XECDesign
Copy link
Contributor

I suspect it's here somewhere, which runs without any rpi patches applied.

So yeah, I think you've hit the nail on the head and it's a packaging issue. I'm not sure what the best way of fixing it is, but I'll give it a go.

@pbaetens
Copy link
Author

pbaetens commented Sep 11, 2024

any quick workaround you can think of?
would upgrading to a newer kernel help?
@XECDesign

@XECDesign
Copy link
Contributor

I believe I have a fix which should be in the next apt kernel update. It also makes the linux-source package match what's actually shipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants