Difference between revisions of "VEYE CS Camera source for Jetson"

From wiki_veye
Jump to navigation Jump to search
Line 154: Line 154:
  
 
<code>./l4t_sign_image.sh --file kernel/Image --chip 0x19</code>
 
<code>./l4t_sign_image.sh --file kernel/Image --chip 0x19</code>
 +
===Build modules===
 +
For version later than Jetpack 5.x, non-MV series products, can compile the driver directly as modules to get the ko file. It is recommended to compile the driver directly on top of Jetson Board.
 +
 +
<code>cd $RELEASE_PACK_DIR/drivers_source/cam_drv_src/</code>
 +
 +
<code>make -f Makefile_local</code>
 
===Build DTS===
 
===Build DTS===
 
Patch code first.
 
Patch code first.

Revision as of 18:10, 29 June 2022

查看中文

Nvidia Jetson platform VEYE and CS series camera driver source code compilation guide

1 Overview

1.1 Jetpack version VS. L4T version

  • Jetpack4.2.2,L4T r32.2.1
  • Jetpack4.3,L4T r32.3.1
  • Jetpack4.4,L4T r32.4.3
  • Jetpack4.4.1,L4T r32.4.4
  • Jetpack4.5,L4T r32.5
  • Jetpack4.5.1,L4T r32.5.1
  • Jetpack4.6, L4T r32.6.1
  • Jetpack4.6.1, L4T r32.7.1
  • Jetpack5.0.1DP,L4T r34.0.1

1.2 Check the current L4T version

First check the current L4T version and try to replace it with the same version.

cat /etc/nv_tegra_release

If it shows:

# R32 (release), REVISION: 4.3......

It means L4t Verion is 32.4.3

2 Set up the Host PC environment

The following operations are done in HOST PC.

  • Cross-compiling Toolchain

Please refer to this link to install toolchain on your Host PC.

  • L4T source code and Rootfs

Please download the Linux_for_Tegra SDK via SDK Manager first.

You could use SDK Manager or directly download to get source code.

Sync code as this if you use SDK Manager:

- Jetpack4.2.2

./source_sync.sh -t tegra-l4t-r32.2.1

- Jetpack4.3

./source_sync.sh -t tegra-l4t-r32.3.1

- Jetpack4.4

./source_sync.sh -t tegra-l4t-r32.4.3

- Jetpack4.4.1

./source_sync.sh -t tegra-l4t-r32.4.4

- Jetpack4.5

./source_sync.sh -t tegra-l4t-r32.5

- Jetpack4.5.1

./source_sync.sh -t tegra-l4t-r32.5.1

- Jetpack4.5.1

./source_sync.sh -t tegra-l4t-r32.5.1

- Jetpack4.6

./source_sync.sh -t tegra-l4t-r32.6.1

  • Setting Up the Environment

Assume SDK install directory is <TOPDIR>,source code is in $L4T_DIR/sources directory.

export TOP_DIR=<absolute path to top dir accroding to your jetpack version and board name;for example /home/xumm/nvidia/nvidia_sdk/JetPack_4.5_Linux_JETSON_XAVIER_NX_DEVKIT/>

export L4T_DIR=$TOP_DIR/Linux_for_Tegra

export LOCALVERSION=-tegra

export LDK_ROOTFS_DIR=$TOP_DIR/Linux_for_Tegra/rootfs

export ARCH=arm64

export CROSS_COMPILE=aarch64-linux-gnu-

export CROSS32CC=arm-linux-gnueabihf-gcc

export TEGRA_KERNEL_OUT=$L4T_DIR/sources/kernel/out_kernel

export KERNEL_PATH=$L4T_DIR/sources/kernel/out_kernel

export NVIDIA_PATH=$L4T_DIR/sources/kernel/nvidia

export NANO_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t210/

export TX2_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t18x

export XAVIER_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t19x

3 Download our bsp package for Jetson

cd $L4T_DIR

git clone https://github.com/veyeimaging/nvidia_jetson_veye_bsp.git

export RELEASE_PACK_DIR=$L4T_DIR/nvidia_jetson_veye_bsp

4 Build kernel

4.1 kernel patch for MV series

For MV series camera, besides adding the camera driver in Linux system, we also add a kernel patch - veye_mv_l4t_[version].patch.

This patch has two features:

  1. Added support for both Y10 and Y12 data formats for Mono cameras.
  2. Added support for trigger mode.

This patch package can be left out for VEYE series and CS series cameras.

cd $L4T_DIR/sources/kernel/

patch -p1 < [path to]veye_mv_l4t_[version].patch

4.2 patch code

cp $RELEASE_PACK_DIR/drivers_source/cam_drv_src/* $NVIDIA_PATH/drivers/media/i2c/

cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_<l4t_version> $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig

4.2.1 Modify Kconfig and Makefile

cp $RELEASE_PACK_DIR/drivers_source/cam_drv_src/Kconfig_<ver> $NVIDIA_PATH/drivers/media/i2c/

cp $RELEASE_PACK_DIR/drivers_source/cam_drv_src/Makefile_<ver> $NVIDIA_PATH/drivers/media/i2c/

4.3 build

cd $L4T_DIR/sources/kernel/kernel-4.9/

make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_veyecam_defconfig

make ARCH=arm64 O=$TEGRA_KERNEL_OUT Image -j4

Completed Image file is $TEGRA_KERNEL_OUT/arch/arm64/boot/Image,could be used for Flashing or Upgrading.

Install Image for Flashing:

sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $L4T_DIR/kernel/ -f

  • For xavier,need sign the file

cd $L4T_DIR

./l4t_sign_image.sh --file kernel/Image --chip 0x19

5 Build modules

For version later than Jetpack 5.x, non-MV series products, can compile the driver directly as modules to get the ko file. It is recommended to compile the driver directly on top of Jetson Board.

cd $RELEASE_PACK_DIR/drivers_source/cam_drv_src/

make -f Makefile_local

6 Build DTS

Patch code first.

6.1 Nano

cp $RELEASE_PACK_DIR/Nano/JetPack_<ver>_Linux_JETSON_NANO_DEVKIT/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/

For <camera model>

cp $RELEASE_PACK_DIR/Nano/JetPack_<ver>_Linux_JETSON_NANO_DEVKIT/dts\ dtb/<camera model>/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager

6.2 TX2

cp $RELEASE_PACK_DIR/TX2/JetPack_<ver>_Linux_JETSON_TX2/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/

For <camera model>

cp $RELEASE_PACK_DIR/TX2/JetPack_<ver>_Linux_JETSON_TX2/dts\ dtb/<camera model>/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/

cp $RELEASE_PACK_DIR/TX2/JetPack_<ver>_Linux_JETSON_TX2/dts\ dtb/<camera model>/tegra186-p3636-0001-p3509-0000-a01.dts $TX2_DTS_PATH/lanai/kernel-dts

6.3 AGX Xavier

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_<ver>_Linux_JETSON_AGX_XAVIER/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/

For <camera model>

cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_<ver>_Linux_JETSON_AGX_XAVIER/dts\ dtb/<camera model>/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/

6.4 NX

cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_<ver>_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/

For <camera model>

cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_<ver>_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/<camera model>/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/

6.5 build

cd $L4T_DIR/sources/kernel/kernel-4.9/

make ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs

6.5.1 Nano

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-a02.dtb $L4T_DIR/kernel/dtb/

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-b00.dtb $L4T_DIR/kernel/dtb/

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0003-p3542-0000.dtb $L4T_DIR/kernel/dtb/

6.5.2 TX2

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb $L4T_DIR/kernel/dtb/

6.5.3 TX2 NX(p3509-0000 carrier board)

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra186-p3636-0001-p3509-0000-a01.dtb $L4T_DIR/kernel/dtb/

6.5.4 AGX XAVIER

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb

6.5.5 XAVIER NX

cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p3668-all-p3509-0000.dtb $L4T_DIR/kernel/dtb/