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

From wiki_veye
Jump to navigation Jump to search
 
(33 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[VEYE CS Camera source for Jetson/zh|查看中文]]
 
[[VEYE CS Camera source for Jetson/zh|查看中文]]
  
= Nvidia Jetson platform VEYE and CS series camera driver source code compilation guide =
+
'''Nvidia Jetson platform VEYE camera driver source code compilation guide'''
  
 
=== Overview ===
 
=== Overview ===
 +
NVIDIA has released Linux developer guide for each Jetpack version. For example, L4T [https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/index.html 35.1] and [https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-325/#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html# 32.5].
 +
 +
This section is based on the official Kernel Customization section, so please refer to the official documentation for any lack of detail.
 +
 +
We use a host pc with Ubuntu installed and a Jetson board as our development environment.
 +
 +
* Jetpack 4.x
 +
 +
driver is compiled together with the linux kernel on the host pc. dtb is also compiled on the host pc.
 +
 +
* Jetpack5.x
 +
 +
The driver is compiled to modules, on the Jetson board. dtb compilation is done on the host pc.
  
 
==== Jetpack version VS. L4T version ====
 
==== Jetpack version VS. L4T version ====
Line 11: Line 24:
 
*Jetpack4.4,L4T r32.4.3
 
*Jetpack4.4,L4T r32.4.3
 
*Jetpack4.4.1,L4T r32.4.4
 
*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
 +
*Jetpack4.6.2, L4T r32.7.2
 +
*Jetpack4.6.3, L4T r32.7.3
 +
*Jetpack5.0.1DP,L4T r34.1.1
 +
*Jetpack5.0.2, L4T r35.1
 +
*Jetpack5.1, L4T r35.2.1
 +
*Jetpack5.1.1, L4T r35.3.1
 +
*Jetpack5.1.2, L4T r35.4.1
 +
*Jetpack5.1.3, L4T r35.5
  
 
====Check the current L4T version====
 
====Check the current L4T version====
Line 23: Line 48:
 
It means L4t Verion is 32.4.3
 
It means L4t Verion is 32.4.3
  
=== Setting Up the Host PC Environment ===
+
=== Set up the Host PC environment ===
Please refer to:[[VEYE CS Camera for Jetson TX2#Setting Up the Host PC Environment|3.5.1 Setting Up the Host PC Environment]].
+
The following operations are done in HOST PC.
 +
 
 +
==== Cross-compiling Toolchain ====
 +
 
 +
* Jetpack4.xPlease refer to this [https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fxavier_toolchain.html%23wwpID0ESHA link] to install toolchain on your Host PC.
 +
 
 +
* Jetpack5.x
 +
 
 +
Please refer to this [https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/text/AT/JetsonLinuxToolchain.html 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 [https://developer.nvidia.com/embedded/downloads directly download] to get source code. I recommend the direct download method.
 +
 
 +
Sync code as this if you use SDK Manager:
 +
 
 +
''- Jetpack4.2.2''
 +
 
 +
<code>./source_sync.sh -t tegra-l4t-r32.2.1</code>
 +
 
 +
''- Jetpack4.3''
 +
 
 +
<code>./source_sync.sh -t tegra-l4t-r32.3.1</code>
 +
 
 +
''- Jetpack4.4''
 +
 
 +
<code>./source_sync.sh -t tegra-l4t-r32.4.3</code>
 +
 
 +
''- Jetpack4.4.1''
 +
 
 +
<code>./source_sync.sh -t tegra-l4t-r32.4.4</code>
 +
 
 +
''- Jetpack4.5''
 +
 
 +
<code>./source_sync.sh -t tegra-l4t-r32.5</code>
 +
 
 +
''- Jetpack4.5.1''
  
The following operations are done in HOST PC.
+
<code>./source_sync.sh -t tegra-l4t-r32.5.1</code>
===Download our bsp package for Jetson===
 
<code>cd $L4T_DIR</code>
 
  
<code>git clone https://github.com/veyeimaging/nvidia_jetson_veye_bsp<nowiki/>.git</code>
+
''- Jetpack4.5.1''
  
<code>export RELEASE_PACK_DIR=$L4T_DIR/nvidia_jetson_veye_bsp</code>
+
<code>./source_sync.sh -t tegra-l4t-r32.5.1</code>
===Build kernel===
 
  
==== patch code ====
+
''- Jetpack4.6''
<code>cp $RELEASE_PACK_DIR/drivers_source/cam_drv_src/* $NVIDIA_PATH/drivers/media/i2c/</code>
 
  
''- r32.2.1''
+
<code>./source_sync.sh -t tegra-l4t-r32.6.1</code>
  
<code>cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.2.1 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig</code>
+
''- Jetpack4.6.1''
  
''- r32.3.1''
+
<code>./source_sync.sh -t tegra-l4t-r32.7.1</code>
  
<code>cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.3.1 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig</code>
+
''- Jetpack4.6.2''
  
''- r32.4.2''
+
[https://forums.developer.nvidia.com/t/source-sync-sh-fails-with-tegra-l4t-r32-7-2-tag/212787/5 Nvidia did not push sources to nv-tegra for this 32.7.2 release because there have been no changes in the kernel and DTS compared to 32.7.1 release.]
  
<code>cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.4.2 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig</code>
+
''- Jetpack5.0.1 DP''
  
''- r32.4.3''
+
<code>./source_sync.sh -t jetson_34.1.1</code>
  
<code>cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_32.4.3 $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig</code>
+
''- Jetpack5.0.2''
  
==== build ====
+
<code>./source_sync.sh -t jetson_35.1</code>
<code>cd $L4T_DIR/sources/kernel/kernel-4.9/</code>
 
  
<code>make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_veyecam_defconfig</code>
+
''- Jetpack5.1''
  
<code>make ARCH=arm64 O=$TEGRA_KERNEL_OUT Image -j4</code>
+
<code>./source_sync.sh -t jetson_35.2.1</code>
  
Completed Image file is $TEGRA_KERNEL_OUT/arch/arm64/boot/Image,could be used for Flashing or Upgrading.
+
''- Jetpack5.1.1''
  
Install Image for Flashing:
+
<code>./source_sync.sh -t jetson_35.3.1</code>
  
<code>sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $L4T_DIR/kernel/ -f</code>
+
''- Jetpack5.1.2''
  
*For xavier,need sign the file
+
<code>./source_sync.sh -t jetson_35.4.1</code>
  
<code>cd $L4T_DIR</code>
+
''- Jetpack5.1.3''
  
<code>./l4t_sign_image.sh --file kernel/Image --chip 0x19</code>
+
<code>./source_sync.sh -t jetson_35.5</code>
===Build DTS===
+
==== Setting Up the Environment ====
Patch code first.
+
Assume SDK install directory is <TOPDIR>,source code is in $L4T_DIR/sources directory.
  
==== Nano ====
+
<code>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/></code>
  
===== Nano@Jetpack4.2.2 =====
+
<code>export L4T_DIR=$TOP_DIR/Linux_for_Tegra</code>
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.2.2_Linux_GA_P3448/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/</code>
 
  
For VEYE-MIPI-327
+
<code>export LOCALVERSION=-tegra</code>
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.2.2_Linux_GA_P3448/dts\ dtb/VEYE-MIPI-327/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
<code>export LDK_ROOTFS_DIR=$TOP_DIR/Linux_for_Tegra/rootfs</code>
  
For CS-MIPI-IMX307
+
<code>export ARCH=arm64</code>
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.2.2_Linux_GA_P3448/dts\ dtb/CS-MIPI-IMX307/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
<code>export TEGRA_KERNEL_OUT=$L4T_DIR/sources/kernel/out_kernel</code>
  
=====Nano@Jetpack4.3=====
+
<code>export KERNEL_PATH=$L4T_DIR/sources/kernel/out_kernel</code>
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.3_Linux_P3448/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/</code>
 
  
For VEYE-MIPI-327
+
<code>export NVIDIA_PATH=$L4T_DIR/sources/kernel/nvidia</code>
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.3_Linux_P3448/dts\ dtb/VEYE-MIPI-327/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
<code>export NANO_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t210/</code>
  
For CS-MIPI-IMX307
+
<code>export TX2_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t18x</code>
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.3_Linux_P3448/dts\ dtb/CS-MIPI-IMX307/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
<code>export XAVIER_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t19x</code>
  
=====Nano@Jetpack4.4=====
+
<code>export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/</code>
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/</code>
 
  
For VEYE-MIPI-327
+
* Jetpack 4.x only
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/VEYE-MIPI-327/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
<code>export CROSS_COMPILE=aarch64-linux-gnu-</code>
  
For CS-MIPI-IMX307
+
<code>export CROSS32CC=arm-linux-gnueabihf-gcc</code>
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/CS-MIPI-IMX307/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
* Jetpack 5.x only
  
For CS-MIPI-SC132
+
<code>export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc</code>
  
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_4.4_Linux_JETSON_NANO_DEVKIT/dts\ dtb/CS-MIPI-SC132/tegra210-porg-plugin-manager.dtsi -r $NANO_DTS_PATH/porg/kernel-dts/porg-plugin-manager</code>
+
<code>export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-</code>
  
==== TX2 ====
+
<code>export CROSS_COMPILE=$CROSS_COMPILE_AARCH64</code>
  
===== Jetson TX2@Jetpack4.2.2 =====
+
<code>export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/nvidia</code>
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.2.2_Linux_GA_P3310/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/</code>
 
  
For CS-MIPI-IMX307
+
===Download our bsp package for Jetson===
 +
<code>cd $L4T_DIR</code>
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.2.2_Linux_GA_P3310/dts\ dtb/CS-MIPI-IMX307/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
<code>git clone https://github.com/veyeimaging/nvidia_jetson_veye_bsp<nowiki/>.git</code>
  
For VEYE-MIPI-327
+
<code>export RELEASE_PACK_DIR=$L4T_DIR/nvidia_jetson_veye_bsp</code>
 +
===Build kernel===
 +
For Jetpack version 4.x and for using MV series cameras under Jetpack version 5.x, the kernel needs to be compiled.
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.2.2_Linux_GA_P3310/dts\ dtb/VEYE-MIPI-327/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
==== 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.
  
===== TX2@Jetpack4.3 =====
+
This patch has two features:
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/</code>
 
  
For CS-MIPI-IMX307
+
# Added support for both Y10 and Y12 data formats for Mono cameras.
 +
# Added support for trigger mode.
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/CS-MIPI-IMX307/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
This patch package can be left out for VEYE series and CS series cameras.
  
For CS-MIPI-SC132
+
<code>cd $L4T_DIR/sources/kernel/</code>
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/CS-MIPI-SC132/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
<code>patch -p1 < [path to]veye_mv_l4t_[version].patch</code>
  
For VEYE-MIPI-327
+
==== For Jetpack 4.x, the camera driver is compiled into the Image ====
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.3_Linux_P3310/dts\ dtb/VEYE-MIPI-327/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
===== patch code =====
 +
<code>cp $RELEASE_PACK_DIR/drivers_source/cam_drv_src/* $NVIDIA_PATH/drivers/media/i2c/</code>
  
===== TX2@Jetpack4.4 =====
+
<code>cp $RELEASE_PACK_DIR/drivers_source/kernel_veyecam_config_<l4t_version> $L4T_DIR/sources/kernel/kernel-4.9/arch/arm64/configs/tegra_veyecam_defconfig</code>
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/</code>
 
  
For CS-MIPI-IMX307
+
===== Modify Kconfig and Makefile =====
 +
Modify the Kconfig and Makefile files under the <code>$NVIDIA_PATH/drivers/media/i2c/</code> directory to add the corresponding camera driver compilation options.
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/CS-MIPI-IMX307/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
===== build =====
 +
<code>cd $L4T_DIR/sources/kernel/kernel-4.9/</code>
  
For CS-MIPI-SC132
+
<code>make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_veyecam_defconfig</code>
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/CS-MIPI-SC132/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
<code>make ARCH=arm64 O=$TEGRA_KERNEL_OUT Image -j4</code>
  
For VEYE-MIPI-327
+
==== For Jetpack 5.x, there is no need to compile the camera driver into the Image ====
  
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_4.4_Linux_JETSON_TX2/dts\ dtb/VEYE-MIPI-327/tegra186-quill-p3310-1000-a00-00-base.dts $TX2_DTS_PATH/quill/kernel-dts/</code>
+
===== build =====
 +
<code>cd $L4T_DIR/sources/</code>
  
==== AGX Xavier ====
+
<code>./nvbuild.sh -o $TEGRA_KERNEL_OUT</code>
  
===== AGX Xavier@Jetpack4.2.2 =====
+
<code>nvbuild.sh</code> is only included in the <code>kernel_src.tbz2</code> tar file that is part of <code>public_sources.tbz2</code>. If the kernel sources were synced from the Git server, you need to manually copy <code>nvbuild.sh</code> from the tar file.
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.2.2_Linux_GA_P2888/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/</code>
 
  
For CS-MIPI-IMX307
+
==== Build completed ====
 +
Completed Image file is $TEGRA_KERNEL_OUT/arch/arm64/boot/Image,could be used for Flashing or Upgrading.
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.2.2_Linux_GA_P2888/dts\ dtb/CS-MIPI-IMX307/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
Install Image for Flashing:
  
For VEYE-MIPI-327
+
<code>sudo cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $L4T_DIR/kernel/ -f</code>
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.2.2_Linux_GA_P2888/dts\ dtb/VEYE-MIPI-327/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
*For Xavier and Orin,need sign the file
  
===== AGX Xavier@Jetpack4.3 =====
+
<code>cd $L4T_DIR</code>
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/</code>
 
  
For CS-MIPI-IMX307
+
<code>./l4t_sign_image.sh --file kernel/Image --chip 0x19</code>
 +
===Build modules(Jetpack5.x)===
 +
For version later than Jetpack 5.x, can compile the driver directly as modules to get the ko file. It is recommended to compile the driver directly on  Jetson Board.
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/CS-MIPI-IMX307/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
<code>cd $RELEASE_PACK_DIR/drivers_source/cam_drv_src/</code>
  
For CS-MIPI-SC132
+
<code>make -f Makefile</code>
 +
===Build DTS===
 +
Patch code first.
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/CS-MIPI-SC132/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
==== Nano ====
 +
<code>cp $RELEASE_PACK_DIR/Nano/JetPack_<ver>_Linux_JETSON_NANO_DEVKIT/dts\ dtb/common/t210/* -r $NANO_DTS_PATH/</code>
  
For VEYE-MIPI-327
+
For <camera model>
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.3_Linux_P2888/dts\ dtb/VEYE-MIPI-327/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
<code>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</code>
  
=====AGX Xavier@Jetpack4.4=====
+
==== TX2 ====
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/</code>
+
<code>cp $RELEASE_PACK_DIR/TX2/JetPack_<ver>_Linux_JETSON_TX2/dts\ dtb/common/t18x/* -r $TX2_DTS_PATH/</code>
  
For CS-MIPI-IMX307
+
For <camera model>
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/CS-MIPI-IMX307/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
<code>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/</code>
  
For CS-MIPI-SC132
+
<code>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</code>
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/CS-MIPI-SC132/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
==== AGX Xavier ====
 +
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_<ver>_Linux_JETSON_AGX_XAVIER/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/</code>
  
For VEYE-MIPI-327
+
For <camera model>
  
<code>cp $RELEASE_PACK_DIR/AGX-Xaviar/JetPack_4.4_Linux_JETSON_AGX_XAVIER/dts\ dtb/VEYE-MIPI-327/tegra194-p2888-0001-p2822-0000.dts $XAVIER_DTS_PATH/galen/kernel-dts/</code>
+
<code>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/</code>
  
 
==== NX ====
 
==== NX ====
 +
<code>cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_<ver>_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/</code>
 +
 +
For <camera model>
  
===== Xavier NX@Jetpack4.4 =====
+
<code>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/</code>
<code>cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/common/t19x/* -r $XAVIER_DTS_PATH/</code>
 
  
For CS-MIPI-IMX307
+
==== Orin ====
 +
<code>cp $RELEASE_PACK_DIR/Orin/JetPack_<ver>_Linux_JETSON_ORIN_TARGETS/dts\ dtb/common/t23x/* -r $ORIN_DTS_PATH/</code>
  
<code>cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/CS-MIPI-IMX307/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/</code>
+
For <camera model>
  
For CS-MIPI-SC132
+
<code>cp $RELEASE_PACK_DIR/Orin/JetPack_<ver>_Linux_JETSON_ORIN_TARGETS/dts\ dtb/<camera model>/tegra234-p3737-camera-modules.dtsi $ORIN_DTS_PATH/concord/kernel-dts/cvb/</code>
  
<code>cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/CS-MIPI-SC132/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/</code>
+
<code>cp $RELEASE_PACK_DIR/Orin/JetPack_<ver>_Linux_JETSON_ORIN_TARGETS/dts\ dtb/<camera model>/tegra234-p3768-0000-a0.dtsi $ORIN_DTS_PATH/p3768/kernel-dts/cvb</code>
  
For VEYE-MIPI-327
+
==== build ====
  
<code>cp $RELEASE_PACK_DIR/Xavier-NX/JetPack_4.4_Linux_JETSON_XAVIER_NX_DEVKIT/dts\ dtb/VEYE-MIPI-327/tegra194-p3509-0000-a00.dtsi $XAVIER_DTS_PATH/jakku/kernel-dts/common/</code>
+
* For Jetpack4.X
 +
 
 +
<code>export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts</code>
  
==== build ====
 
 
<code>cd $L4T_DIR/sources/kernel/kernel-4.9/</code>
 
<code>cd $L4T_DIR/sources/kernel/kernel-4.9/</code>
 +
 +
* For Jetpack5.X
 +
 +
<code>export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/nvidia</code>
 +
 +
<code>cd $L4T_DIR/sources/kernel/kernel-5.10/</code>
  
 
<code>make ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs</code>
 
<code>make ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs</code>
 +
 +
You can get the compiled DTB file in the following path.
  
 
===== Nano =====
 
===== Nano =====
<code>cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-a02.dtb $L4T_DIR/kernel/dtb/</code>
+
<code>$COMMON_DTS_PATH/tegra210-p3448-0000-p3449-0000-a02.dtb</code>
  
<code>cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-b00.dtb $L4T_DIR/kernel/dtb/</code>
+
<code>$COMMON_DTS_PATH/tegra210-p3448-0000-p3449-0000-b00.dtb</code>
 +
 
 +
<code>$COMMON_DTS_PATH/tegra210-p3448-0003-p3542-0000.dtb</code>  
  
 
===== TX2 =====
 
===== TX2 =====
<code>cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb $L4T_DIR/kernel/dtb/</code>
+
<code>$COMMON_DTS_PATH/tegra186-quill-p3310-1000-c03-00-base.dtb</code>
 
+
=====TX2 NX(p3509-0000 carrier board)=====
 +
<code>$COMMON_DTS_PATH/tegra186-p3636-0001-p3509-0000-a01.dtb</code>
 
===== AGX XAVIER =====
 
===== AGX XAVIER =====
<code>cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p2888-0001-p2822-0000.dtb</code>
+
<code>$COMMON_DTS_PATH/tegra194-p2888-0001-p2822-0000.dtb</code>
  
 
===== XAVIER NX =====
 
===== XAVIER NX =====
<code>cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/tegra194-p3668-all-p3509-0000.dtb $L4T_DIR/kernel/dtb/</code>
+
<code>$COMMON_DTS_PATH/tegra194-p3668-all-p3509-0000.dtb</code>
 +
 
 +
===== AGX Orin =====
 +
<code>$COMMON_DTS_PATH/tegra234-p3701-0000-p3737-0000.dtb</code>
 +
 
 +
===== Orin Nano =====
 +
<code>$COMMON_DTS_PATH/tegra234-p3767-0003-p3768-0000-a0.dtb</code>
 +
 
 +
<code>$COMMON_DTS_PATH/tegra234-p3767-0004-p3768-0000-a0.dtb</code>
 +
 
 +
===== Orin NX =====
 +
<code>$COMMON_DTS_PATH/tegra234-p3767-0000-p3768-0000-a0.dtb</code>
  
<br />
+
<code>$COMMON_DTS_PATH/tegra234-p3767-0001-p3768-0000-a0.dtb</code><br />

Latest revision as of 14:55, 22 May 2024

查看中文

Nvidia Jetson platform VEYE camera driver source code compilation guide

1 Overview

NVIDIA has released Linux developer guide for each Jetpack version. For example, L4T 35.1 and 32.5.

This section is based on the official Kernel Customization section, so please refer to the official documentation for any lack of detail.

We use a host pc with Ubuntu installed and a Jetson board as our development environment.

  • Jetpack 4.x

driver is compiled together with the linux kernel on the host pc. dtb is also compiled on the host pc.

  • Jetpack5.x

The driver is compiled to modules, on the Jetson board. dtb compilation is done on the host pc.

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
  • Jetpack4.6.2, L4T r32.7.2
  • Jetpack4.6.3, L4T r32.7.3
  • Jetpack5.0.1DP,L4T r34.1.1
  • Jetpack5.0.2, L4T r35.1
  • Jetpack5.1, L4T r35.2.1
  • Jetpack5.1.1, L4T r35.3.1
  • Jetpack5.1.2, L4T r35.4.1
  • Jetpack5.1.3, L4T r35.5

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.

2.1 Cross-compiling Toolchain

  • Jetpack4.xPlease refer to this link to install toolchain on your Host PC.
  • Jetpack5.x

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

2.2 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. I recommend the direct download method.

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

- Jetpack4.6.1

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

- Jetpack4.6.2

Nvidia did not push sources to nv-tegra for this 32.7.2 release because there have been no changes in the kernel and DTS compared to 32.7.1 release.

- Jetpack5.0.1 DP

./source_sync.sh -t jetson_34.1.1

- Jetpack5.0.2

./source_sync.sh -t jetson_35.1

- Jetpack5.1

./source_sync.sh -t jetson_35.2.1

- Jetpack5.1.1

./source_sync.sh -t jetson_35.3.1

- Jetpack5.1.2

./source_sync.sh -t jetson_35.4.1

- Jetpack5.1.3

./source_sync.sh -t jetson_35.5

2.3 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 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

export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/

  • Jetpack 4.x only

export CROSS_COMPILE=aarch64-linux-gnu-

export CROSS32CC=arm-linux-gnueabihf-gcc

  • Jetpack 5.x only

export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc

export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-

export CROSS_COMPILE=$CROSS_COMPILE_AARCH64

export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/nvidia

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

For Jetpack version 4.x and for using MV series cameras under Jetpack version 5.x, the kernel needs to be compiled.

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 For Jetpack 4.x, the camera driver is compiled into the Image

4.2.1 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.2 Modify Kconfig and Makefile

Modify the Kconfig and Makefile files under the $NVIDIA_PATH/drivers/media/i2c/ directory to add the corresponding camera driver compilation options.

4.2.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

4.3 For Jetpack 5.x, there is no need to compile the camera driver into the Image

4.3.1 build

cd $L4T_DIR/sources/

./nvbuild.sh -o $TEGRA_KERNEL_OUT

nvbuild.sh is only included in the kernel_src.tbz2 tar file that is part of public_sources.tbz2. If the kernel sources were synced from the Git server, you need to manually copy nvbuild.sh from the tar file.

4.4 Build completed

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 and Orin,need sign the file

cd $L4T_DIR

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

5 Build modules(Jetpack5.x)

For version later than Jetpack 5.x, can compile the driver directly as modules to get the ko file. It is recommended to compile the driver directly on Jetson Board.

cd $RELEASE_PACK_DIR/drivers_source/cam_drv_src/

make -f Makefile

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 Orin

cp $RELEASE_PACK_DIR/Orin/JetPack_<ver>_Linux_JETSON_ORIN_TARGETS/dts\ dtb/common/t23x/* -r $ORIN_DTS_PATH/

For <camera model>

cp $RELEASE_PACK_DIR/Orin/JetPack_<ver>_Linux_JETSON_ORIN_TARGETS/dts\ dtb/<camera model>/tegra234-p3737-camera-modules.dtsi $ORIN_DTS_PATH/concord/kernel-dts/cvb/

cp $RELEASE_PACK_DIR/Orin/JetPack_<ver>_Linux_JETSON_ORIN_TARGETS/dts\ dtb/<camera model>/tegra234-p3768-0000-a0.dtsi $ORIN_DTS_PATH/p3768/kernel-dts/cvb

6.6 build

  • For Jetpack4.X

export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts

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

  • For Jetpack5.X

export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/nvidia

cd $L4T_DIR/sources/kernel/kernel-5.10/

make ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs

You can get the compiled DTB file in the following path.

6.6.1 Nano

$COMMON_DTS_PATH/tegra210-p3448-0000-p3449-0000-a02.dtb

$COMMON_DTS_PATH/tegra210-p3448-0000-p3449-0000-b00.dtb

$COMMON_DTS_PATH/tegra210-p3448-0003-p3542-0000.dtb

6.6.2 TX2

$COMMON_DTS_PATH/tegra186-quill-p3310-1000-c03-00-base.dtb

6.6.3 TX2 NX(p3509-0000 carrier board)

$COMMON_DTS_PATH/tegra186-p3636-0001-p3509-0000-a01.dtb

6.6.4 AGX XAVIER

$COMMON_DTS_PATH/tegra194-p2888-0001-p2822-0000.dtb

6.6.5 XAVIER NX

$COMMON_DTS_PATH/tegra194-p3668-all-p3509-0000.dtb

6.6.6 AGX Orin

$COMMON_DTS_PATH/tegra234-p3701-0000-p3737-0000.dtb

6.6.7 Orin Nano

$COMMON_DTS_PATH/tegra234-p3767-0003-p3768-0000-a0.dtb

$COMMON_DTS_PATH/tegra234-p3767-0004-p3768-0000-a0.dtb

6.6.8 Orin NX

$COMMON_DTS_PATH/tegra234-p3767-0000-p3768-0000-a0.dtb

$COMMON_DTS_PATH/tegra234-p3767-0001-p3768-0000-a0.dtb