TX2开发环境搭建

Posted feisonzl

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TX2开发环境搭建相关的知识,希望对你有一定的参考价值。

1.sdk manager 安装

2.单独安装JetPack

https://developer.nvidia.com/embedded/jetpack-archive

3.同步源码:

cd <JetPack-root>/
./source_sync.sh -t tegra-l4t-r32.2.1
./source_sync.sh -k tegra-l4t-r32.2.1
./source_sync.sh -u tegra-l4t-r32.2.1

4.环境依赖安装

1.下载交叉编译器
http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-i686_aarch64-linux-gnu.tar.xz
2.安装交叉编译器

sudo mkdir /opt/l4t-gcc
sudo chown $USER:$USER /opt/l4t-gcc
cd /opt/l4t-gcc
mv ~/Downloads/gcc_xxxx.tgz ./
tar -xvf gcc_xxxx.tgz
echo "export CROSS_COMPILE=/opt/l4t-gcc/gcc-linaro-7.3/bin/aarch64-linux-gnu-" >> ~.bashrc

3.安装build-essential

sudo apt install build-essential bc
sudo apt install libncurses5 libncurses5-dev

5.内核编译

1.环境变量设置

export DEVDIR=/home/neousys/nvidia/nvidia_sdk/JetPack_4.2.2_Linux_GA_P3310/Linux_for_Tegra
export KERNEL_MODULES_OUT=$DEVDIR/images/modules
export TEGRA_KERNEL_OUT=$DEVDIR/images
export ARCH=arm64
export LOCALVERSION=-tegra
mkdir -p $TEGRA_KERNEL_OUT

2.生成.config文件

cd <kernel_source>
make mrproper
make O=$TEGRA_KERNEL_OUT tegra_defconfig
make O=$TEGRA_KERNEL_OUT menuconfig

3.编译内核,设备树,模块

make O=$TEGRA_KERNEL_OUT zImage
make O=$TEGRA_KERNEL_OUT dtbs
make O=$TEGRA_KERNEL_OUT modules
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT

make O=$TEGRA_KERNEL_OUT -j<n>

4.打包和刷机
4.1 替换内核镜像和DTB

cd $DEVDIR
cp $TEGRA_KERNEL_OUT/images/arch/arm64/boot/dts/*.dtb*.dtb ./kernel/dtb/
cp $TEGRA_KERNEL_OUT/images/arch/arm64/boot/Image ./kernel/

4.2 安装内核模块到跟文件系统

sudo make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$DEVDIR/rootfs/

4.3 打包安装的内核模块

cd $DEVDIR/images/modules/lib/modules/
tar --owner root --group root -cjf kernel_supplements.tbz2 lib/modules
mv kernel_supplements.tbz2 $DEVDIR/kernel/
sudo ./apply_binaries.sh

4.4 下载内核,dtb,根文件系统

sudo ./flash.sh jetson-tx2 mmcblk0p1
sudo ./flash.sh -k kernel jetson-tx2 mmcblk0p1
sudo ./flash.sh -k kernel-dtb jetson-tx2 mmcblk0p1

参考:
https://docs.nvidia.com/jetson/l4t/index.html
https://developer.nvidia.com/embedded/dlc/jetson_tx2_developer_kit_user_guide

以上是关于TX2开发环境搭建的主要内容,如果未能解决你的问题,请参考以下文章

markdown tx2中的tensor-rt和虚拟环境设置

jetson TX2

TX2系统安装

TX2在Turtlebot测试kobuki

TX2刷机指南

在Jetson TX2上构建TensorFlow