Adding new camera sensor into kernel

I have created new camera sensor driver put it in:
/home/sitshost/l4t-sources/xavier-nx/Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/i2c/ directory.

Add into Makefile in this directory to compile my driver:
obj-$(CONFIG_VIDEO_IMX390) += imx390.o
obj-$(CONFIG_VIDEO_ECAMERA) += eCamera.o
the last line is my driver…

Add to Kconfig file in this directory the following:
config VIDEO_ECAMERA
tristate “ECAMERA camera sensor support”
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
—help—
This is a Video4Linux2 sensor-level driver for the Elbit
camera sensor

To compile this driver as a module, choose M here: the module
will be called eCamera.

Still when I’m compiling the kernel I don’t see in /home/sitshost/l4t-sources/xavier-nx/Linux_for_Tegra/source/public/modules/lib/modules/4.9.140-tegra/kernel/drivers/media/i2c/ directory my eCamera.ko file.

What else I have to do?

Try modify as below.

obj-y += eCamera.o

Didn’t help…
I didn’t add the driver to the device tree that can be the reason?
I wanted only to see if the driver is compiled…

Dudi

Doesn’t make sense that doesn’t help! Also device tree doesn’t matter with that.

You are right obj-y += eCamera.o compiled the driver and create eCamera.o file but not .ko file.
What I have to do in order to create the .ko file and to add the driver as part of the kernel (which config files to change)
I’m using this page to create the kernel:

OK solved I have added my new driver to those config files and compiled:
./Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/i2c/Makefile
./Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/i2c/Kconfig
./Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig
./Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/configs/tegra_android_defconfig
./Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/configs/tegra_gnu_linux_defconfig

I have again problem to compile driver for Deserializer DS90UB960:

  • I wrote the driver in and aff to Makefile : obj-$(CONFIG_I2C_IOEXPANDER_DESER_DS960) += eDS960drv.o
  • Add to Kconfig file in same format like MAX9296
  • Add to those config files line same as MAX9296:
    ./kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig:CONFIG_I2C_IOEXPANDER_DESER_MAX9296=y
    ./kernel/kernel-4.9/arch/arm64/configs/tegra_android_defconfig:CONFIG_I2C_IOEXPANDER_DESER_MAX9296=y

My driver don’t compiled when I’m adding as the above.
In addition I saw that there is no max9296.ko file crated what I have to do to create my eDS960drv.ko file