Compiling driver on JP6.2.1 Orin NX

Hi,

I have downloaded the sources for JP 6.2.1 with source_sync.sh and i see that the kernel to be built lies in kernel/kernel-jammy-src/

I want to compile nv_ov5693.c ov5693_mode_tbls.h and these files are in nvidia-oot

When i do make menuconfig in kernel-jammy-src i see that OV5693 is not there by default.

What is the easiest way to edit my driver and depmod in $(uname-r)
When i try building it independently in nvidia-oot/
I face issues like nvidia/conftest.h not found
And:

make: Entering directory '/usr/src/linux-headers-5.15.148-tegra-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source' CC [M] /home/u/nvidia-oot/drivers/video/tegra/camera/tegra_camera_platform.o MODPOST /home/u/nvidia-oot/drivers/video/tegra/camera/Module.symvers ERROR: modpost: "emc_bw_to_freq" [/home/u/nvidia-oot/drivers/video/tegra/camera/tegra_camera_platform.ko] undefined! make[1]: *** [scripts/Makefile.modpost:133: /home/u/nvidia-oot/drivers/video/tegra/camera/Module.symvers] Error 1 make[1]: *** Deleting file '/home/u/nvidia-oot/drivers/video/tegra/camera/Module.symvers' make: *** [Makefile:1830: modules] Error 2 make: Leaving directory '/usr/src/linux-headers-5.15.148-tegra-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source'

Please assist.
The procedure for JP5 series was straight forward.

Hello @san1998,

Sorry to hear you are facing issues when building nv_ov5393 camera driver.

Really what make menuconfig does is setting environment variables for the compiler to later build your modules with different configurations.

For example, on JP6.2.1 sources if you check the Makefile inside nvidia-oot/drivers/media/i2c you will see that the ov5693 driver builds depending on an env var called CONFIG_MEDIA_SUPPORT. Which you should be able to find under:

Linux Kernel Configuration

└─>Device Drivers

└─>Multimedia support

So I would suggest you try 2 things:

  1. Using make menuconfig try enabling the CONFIG_MEDIA_SUPPORT option. Then building the kernel and modules since they build on 2 different steps.

  2. If 1 des not work I would try taking the ov5693 option from the nvidia-oot/drivers/media/i2c/Makefile out of the CONFIG_MEDIA_SUPPORT check, just to see if the build system ties to build the driver.

Please keep us posted.
And don’t hesitate to reach out if you need further support.

best regards,
Andrew
Embedded Software Engineer at ProventusNova

1 Like

HI @proventusnova

I see that in make menuconfig - CONFIG_MEDIA_SUPPORT is enabled.
CONFIG_MEDIA_SUPPORT=m

But i do not see OV5693 sensor to be enabled directly there.

In nvidia-oot/drivers/media/i2c THE makefile too seems correct that is

ifdef CONFIG_MEDIA_SUPPORT
obj-m += nv_ov5693.o

my question here is how do i build this driver under $(uname-r) when all the dependencies are in nvidia-oot/ but even building independently is expecting me to build tegra-camera drivers first.

And in $(uname-r) i see nv_ov5693.ko is placed in - ./updates/drivers/media/i2c/nv_ov5693.ko

What do you mean?

@ShaneCCC

I want to build nv_ov5693 driver on JP6.2.1 and It does not exist by default under Media support → Camera drivers under kernel/kernel-jammy-src/

But this driver is in nvidia-oot/drivers/media/i2c.

Suppose the nv_ov5693 is default enable you should able get nv_ov5693.ko while you follow the document to build the kernel.

@ShaneCCC

IN jp 5 series it used be there in make menuconfig by default..
in JP 6.2.1 ov5693 camera driver is not there while i do make menuconfig

I think you have get the point in your previous comment.

@ShaneCCC

I edit nv_ov5693 drivers in nvidia-oot/

and make modules , Image in kernel/kernel-jammy-src/

am i correct?

That’s correct.

@ShaneCCC

I did the same.. but i see the driver is not updated.

sudo make modules
sudo make modules_install

DEPMOD /lib/modules/5.15.148-tegra

t@ubuntu:/lib/modules/5.15.148-tegra/updates$ cd ../
t@ubuntu:/lib/modules/5.15.148-tegra$ find . | grep ov5693
./updates/drivers/media/i2c/nv_ov5693.ko
t@ubuntu:/lib/modules/5.15.148-tegra$ ll ./updates/drivers/media/i2c/nv_ov5693.ko
-rw-r–r-- 1 root root 48225 Oct 11 12:17 ./updates/drivers/media/i2c/nv_ov5693.ko

What’s I do is build the ko file on my host and copy it to Jetson Orin.

@ShaneCCC

I want to build on Orin NX itself.. it is possible right? I have seen discrepancies while building on host so i want to build on jetson.

I edited the driver in nvidia-oot and now i do not see it being built under $(uname -r)
please assist.

Building natively works. Do not name a cross compiler, do not name the ARCH. Configure to match the running system, including CONFIG_LOCALVERSION (the suffix to “uname -r”). Then only add the module config using a config editor (e.g., menuconfig or nconfig, which understand dependencies).

I’d recommend then building the full kernel as an “acid test”, plus this propagates configuration. Or you could just make the “modules_prepare” target and build modules. Use the full source which matches your running kernel.

@ShaneCCC @linuxdev

I have taken out nv_ov5693.c separately in my /home/user/ with my makefile with just
obj-m += nv_ov5693.o

and when i do

make -C /lib/modules/$(uname -r)/build M=$PWD modules

make: Entering directory ‘/usr/src/linux-headers-5.15.148-tegra-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source’
CC [M] /home/user/OV5693/nv_ov5693.o
/home/user/OV5693/nv_ov5693.c:19:10: fatal error: media/tegra-v4l2-camera.h: No such file or directory
19 | include <media/tegra-v4l2-camera.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:295: /home/user/OV5693/nv_ov5693.o] Error 1
make: *** [Makefile:1912: /home/user/OV5693] Error 2
make: Leaving directory ‘/usr/src/linux-headers-5.15.148-tegra-ubuntu22.04_aarch64/3rdparty/canonical/linux-jammy/kernel-source’

Even when i add EXTRA CFLAG with include directories it never ends. all the path has to be manually included. some or the other internal header file is not found.

pls assist.

Why just build the .ko file by your host machine?

@ShaneCCC

I do not understand. I am trying both ways to build ov5693 but it has header dependencies in different paths. Can you suggest what i should do.

Follow below to get the source code to build on your host.

Btw, don’t edit the Makefile directly. That can break dependencies. The CONFIG_LOCALVERSION can be edited directly because it has no dependencies. The obj-m +=... seems likely to fail.

I am also wondering why not use the full kernel source? This is available along with the “out of tree” NVIDIA components such that they would unpack into the right location. The official docs are for cross-compile, which is what @ShaneCCC is mentioning. If you just unpack everything together (regardless of whether it is on a cross-compile host PC or directly on the Jetson) then it won’t need to find headers. Both the configuration and source have to work together, and although I don’t really know what the failure was in this specific case I’m thinking it can be avoided by not using the separate headers. Or the full source configured for your system could be placed at the location where it wants headers.

@ShaneCCC @linuxdev

I was able to build on host PC
When i do a insmod nv_ov5693.ko

and sudo dmesg | grep ov5693

$ sudo dmesg | grep ov5693
[ 43.843338] nv_ov5693: no symbol version for module_layout
[ 43.843578] nv_ov5693: module verification failed: signature and/or required key missing - tainting kernel

$ modinfo nv_ov5693.ko
filename: /home/tonbo/nv_ov5693.ko
license: GPL v2
author: NVIDIA Corporation
description: Media Controller driver for OmniVision OV5693
alias: of:NTCovti,ov5693C*
alias: of:NTCovti,ov5693
alias: i2c:ov5693
depends: tegra-camera
name: nv_ov5693
vermagic: 5.15.148-tegra SMP preempt mod_unload modversions aarch64
parm: test_mode:int

~$ uname -a
Linux ubuntu 5.15.148-tegra #1 SMP PREEMPT Mon Jun 16 08:24:48 PDT 2025 aarch64 aarch64 aarch64 GNU/Linux