Building ov9282 into kernel

How do I configure the kernel build to include the ov9282 driver?

I want to include the ov9282 driver in the kernel so that I can use a DT overlay I created for the OV9282. I see the ov9282.c in the kernel source, however I can’t figure out how to build it. I have looked at the documentation Sensor Software Driver Programming — NVIDIA Jetson Linux Developer Guide 1 documentation however the Makefile specified only has .o files:

Add your .c file in the Makefile to build as loadable module:
/kernel/nvidia-oot/drivers/media/i2c/Makefile

But the file looks like this
source_build/Linux_for_Tegra/source/nvidia-oot/drivers/media/i2c/Makefile

# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

subdir-ccflags-y += -Werror

obj-m += max9295.o
obj-m += max9296.o
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
obj-m += max96712.o

ifdef CONFIG_MEDIA_SUPPORT
obj-m += ar1335_common.o
obj-m += lt6911uxc.o
obj-m += nv_imx185.o
obj-m += nv_imx219.o
obj-m += nv_imx274.o
obj-m += nv_imx318.o
obj-m += nv_imx390.o
obj-m += nv_imx477.o
obj-m += nv_ov5693.o
obj-m += nv_ov9282.o
obj-m += nv_ar0234.o
obj-m += nv_hawk_owl.o
endif

obj-m += pca9570.o
obj-m += virtual_i2c_mux.o
endif

This is how kernel build system works.
You just add whatever your driver code there, and replace .c with .o.

obj-m += <your driver>.o

Thanks. And I only need to rebuild the kernel? I didn’t see the ov9282 get compiled in the build output.

make  -C kernel

So after adding that line it will be included in the source_build/Linux_for_Tegra/source/kernel/kernel-jammy-src/arch/arm64/boot/Image. Is there a way to verify before I flash?

OOT drivers are always built as standalone kernel modules. (.ko)

NO, it will not.
Please follow this:
https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/Kernel/KernelCustomization.html#building-the-nvidia-out-of-tree-modules

Adding my driver and building the OOT drivers fails. I added obj-m += ov9282.o.

make modules

build_modules_out.txt (99.4 KB)

Oh I see now… the sources are in
source_build/Linux_for_Tegra/source/nvidia-oot/drivers/media/i2c/
eg

nv_ar0234.c
nv_imx219.c
nv_imx477.c
etc

And it looks like the ov9282.c which is in
source_build/Linux_for_Tegra/source/kernel/kernel-jammy-src/drivers/media/i2c/ov9282.c does not get built and the driver code is out of date.

Am I understanding this correctly?

Can you try naming the file differently?
Like nv_ov9282.c.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.