Line 4: |
Line 4: |
| | | |
| === 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 33: |
Line 46: |
| The following operations are done in HOST PC. | | The following operations are done in HOST PC. |
| | | |
− | *Cross-compiling Toolchain
| + | ==== 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. |
| | | |
− | Please 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 |
| | | |
− | *L4T source code and Rootfs
| + | 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. | | 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. | + | 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: | | Sync code as this if you use SDK Manager: |
Line 89: |
Line 105: |
| <code>./source_sync.sh -t jetson_34.1.1</code> | | <code>./source_sync.sh -t jetson_34.1.1</code> |
| | | |
− | *Setting Up the Environment
| + | ''- Jetpack5.0.2'' |
| | | |
| + | <code>./source_sync.sh -t jetson_35.1</code> |
| + | |
| + | ==== Setting Up the Environment ==== |
| Assume SDK install directory is <TOPDIR>,source code is in $L4T_DIR/sources directory. | | Assume SDK install directory is <TOPDIR>,source code is in $L4T_DIR/sources directory. |
| | | |
Line 102: |
Line 121: |
| | | |
| <code>export ARCH=arm64</code> | | <code>export ARCH=arm64</code> |
− |
| |
− | <code>export CROSS_COMPILE=aarch64-linux-gnu-</code>
| |
− |
| |
− | <code>export CROSS32CC=arm-linux-gnueabihf-gcc</code>
| |
| | | |
| <code>export TEGRA_KERNEL_OUT=$L4T_DIR/sources/kernel/out_kernel</code> | | <code>export TEGRA_KERNEL_OUT=$L4T_DIR/sources/kernel/out_kernel</code> |
Line 118: |
Line 133: |
| | | |
| <code>export XAVIER_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t19x</code> | | <code>export XAVIER_DTS_PATH=$L4T_DIR/sources/hardware/nvidia/platform/t19x</code> |
| + | |
| + | <code>export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/</code> |
| + | |
| + | * Jetpack 4.x only |
| + | |
| + | <code>export CROSS_COMPILE=aarch64-linux-gnu-</code> |
| + | |
| + | <code>export CROSS32CC=arm-linux-gnueabihf-gcc</code> |
| + | |
| + | * Jetpack 5.x only |
| + | |
| + | <code>export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc</code> |
| + | |
| + | <code>export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-</code> |
| + | |
| + | <code>export CROSS_COMPILE=$CROSS_COMPILE_AARCH64</code> |
| + | |
| + | <code>export COMMON_DTS_PATH=$TEGRA_KERNEL_OUT/arch/arm64/boot/dts/nvidia</code> |
| + | |
| ===Download our bsp package for Jetson=== | | ===Download our bsp package for Jetson=== |
| <code>cd $L4T_DIR</code> | | <code>cd $L4T_DIR</code> |
Line 124: |
Line 158: |
| | | |
| <code>export RELEASE_PACK_DIR=$L4T_DIR/nvidia_jetson_veye_bsp</code> | | <code>export RELEASE_PACK_DIR=$L4T_DIR/nvidia_jetson_veye_bsp</code> |
− | ===Build kernel=== | + | ===Build kernel(Jetpack4.x)=== |
| This chapter is for Jetpack4.x version. | | This chapter is for Jetpack4.x version. |
| | | |
Line 169: |
Line 203: |
| | | |
| <code>./l4t_sign_image.sh --file kernel/Image --chip 0x19</code> | | <code>./l4t_sign_image.sh --file kernel/Image --chip 0x19</code> |
− | ===Build modules=== | + | ===Build modules(Jetpack5.x)=== |
| 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 Jetson Board. | | 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 Jetson Board. |
| | | |
| <code>cd $RELEASE_PACK_DIR/drivers_source/cam_drv_src/</code> | | <code>cd $RELEASE_PACK_DIR/drivers_source/cam_drv_src/</code> |
| | | |
− | <code>make -f Makefile_local</code> | + | <code>make -f Makefile</code> |
| ===Build DTS=== | | ===Build DTS=== |
| Patch code first. | | Patch code first. |