Customer Kernel problem of Jetson nano(OV2740)

Hi,

We did the following steps of making the driver to kernel:
Part1:
unzip public_source:
tar -xjf public_sources.tbz2
cd Linux_for_Tegra/source/public
tar -xjf kernel_src.tbz2
cd kernel/kernel-4.9
cp ~/Downloads/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz $(pwd)
tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
cp ~/Downloads/OV2740_R32.6.1/src/ov2740.c $(pwd)/kernel/nvidia/drivers/media/i2c/.

cp ~/Downloads/OV2740_R32.6.1/src/ov2740_mode_tbls.h $(pwd)/kernel/nvidia/drivers/media/i2c/.

cp ~/Downloads/OV2740_R32.6.1/src/ov2740.h $(pwd)/kernel/nvidia/include/media/.

  1. Add the following lines in nvidia/drivers/media/i2c/Kconfig

    config VIDEO_OV2740
    tristate “OV2740 camera sensor support”
    depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
    —help—
    This is a Video4Linux2 sensor-level driver for the OmniVision
    OV2740 camera.

     To compile this driver as a module, choose M here: the module
     will be called ov2740.
    
  2. Add the following lines in nvidia/drivers/media/i2c/Makefile

    obj-$(CONFIG_VIDEO_OV2740) += ov2740.o

  3. Prepare devicetree files

    $ cp tegra210-porg-camera-dual-ov2740.dtsi Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/porg/kernel-dts/prog-platforms/.
    $ cp tegra210-camera-dual-ov2740.dtsi Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/porg/kernel-dts/prog-platforms/.

    $ cp tegra210-p3448-all-p3449-0000-camera-ov2740-dual.dts Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/porg/kernel-dts/.
    $ cp tegra210-p3448-common-ov2740.dts Linux_for_Tegra/source/public/hardware/nvidia/platform/t210/porg/kernel-dts/.

  4. Add #include “porg-platforms/tegra210-porg-camera-dual-ov2740.dtsi” in the following files

    tegra210-p3448-0000-as-p3448-0003.dts
    tegra210-p3448-0000-p3449-0000-a00.dts
    tegra210-p3448-0000-p3449-0000-a01.dts
    tegra210-p3448-0000-p3449-0000-a02.dts
    tegra210-p3448-0000-p3449-0000-b00.dts
    tegra210-p3448-0002-p3449-0000-a02.dts
    tegra210-p3448-0002-p3449-0000-b00.dts

  5. Edit .config file

    $ export TEGRA_KERNEL_OUT=
    $ export CROSS_COMPILE=/bin/aarch64-linux-gnu-
    $ export LOCALVERSION=-tegra
    $ mkdir -p $TEGRA_KERNEL_OUT
    $ make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig

  6. Add following line in the $TEGRA_KERNEL_OUT/.config

    CONFIG_VIDEO_OV2740=y

  7. Build Kernel

    $ cd Linux_for_Tegra/source/public/kernel/kernel-4.9
    $ make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j6

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image /home/usr/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/kernel/Image

cp -r $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/* /home/usr/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/kernel/dtb

sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=/home/usr/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra/rootfs/

cd /home/usr/nvidia/nvidia_sdk/JetPack_4.6_Linux_JETSON_NANO_TARGETS/Linux_for_Tegra
sudo ./apply_binaries.sh -r rootfs

sudo ./tools/jetson-disk-image-creator.sh -o sdcard.img -b jetson-nano -r 300

After that I got an sdcard.img and flashed to SD card but the new system didn’t have an ov2740.dtbo file. But once i tried to copy it to rootfs/boot then it appeared, however I got the following error:

FATAL ERROR!
Failed to overlay
/boot/dtb/kernel_tegra210-p3448-0000-p3449-0000-b00.dtb with |
| /boot/tegra210-p3448-all-p3449-0000-camera-ov2740-dual.dtbo

Could you help give any suggestions on how to fix this problem? Thanks.

3 Likes

You can just copy your dtb file to Nano and modify the /boot/extlinux/extlinux.conf to add FDT like below to apply the device tree.

FDT /boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb

Also for sensor driver have check below.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/camera_sensor_prog.47.2.html#wwpID0E0XF0HA

2 Likes

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