准备源码和编译器
编译器
gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz
内核
Jetson_Linux_R32.5.1_aarch64.tbz2
https://developer.download.nvidia.cn/embedded/L4T/r32_Release_v5.2/T186/Jetson_Linux_R32.5.2_aarch64.tbz2?uobFhgLNHjkA5gGgWTdo5g4ige2UHmM0i1cSUZCpln_HWbs0VpiM3vHEXbNL6Y-4Nkh9IXjEN4OZm7Okj9tOUfoRyvJKhFJnauxdbXmI2WKu64ixfRY9LmH5CzRB9p8enxQdpN3QDaNPsES9dYvq3_nWDqd6nYb7Keksazfgiiw2nGE
public_sources.tbz2
https://developer.download.nvidia.cn/embedded/L4T/r32_Release_v5.2/sources/T186/public_sources.tbz2?_QOrN4-6EYrrfaYvE420W0Yxsqya_3JYgK0mO6N1bOvw-UBAFG3m5awD1b_eTzJmM5UwTgJM6SumgrjZ_vSPdySc96hye5dn3l22-0vwjUsdaQ2hkEmzZjFBAkMAq5SRna8BzvMv2B2TEr9c8vZP-gCS93_chVMZYBIOTK4
文件系统
Tegra_Linux_Sample-Root-Filesystem_R32.5.0_aarch64.tbz2
https://developer.download.nvidia.cn/embedded/L4T/r32_Release_v5.2/T186/Tegra_Linux_Sample-Root-Filesystem_R32.5.2_aarch64.tbz2?Ije4eojmvynhsLZ3MiT9j39loPqS4e9yBcuZ2W9tIWXeBlLwO01IIyVHm7f6qTF0jEOKq8yPPAZagdfreNoZygchvaSaD3RsXr00x-EdffxII7BSt9pQQlN39BxHrMXtwf1addKDmYZZAMtrUk3Pe7O_4APhmKSXGayJg2oF7S68WweQMxAgBPsn_3TDA4rjNQb4yWuCOMdE
源码解压,按照下面路径配置
tar xvf public_sources.tbz2 -C ~/JetsonAGXKernel
tar xvf Tegra186_Linux_R32.5.0_aarch64.tbz2 ~/JetsonAGXKernel
tar xvf Tegra_Linux_Sample-Root-Filesystem_R32.5.0_aarch64.tbz -C ~/JetsonAGXKernel/Linux_for_Tegra/rootfs
cd ~/nvidia/Linux_for_Tegra/source/public
tar xvf kernel_src.tbz2 #这个是内核源码
配置交叉编译环境
tar xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz -C ~/L4t_arm_compiler#路径自行决定
环境变量配置,配置到bash里,后面不用再删除
export TEGRA_AGX_KERNEL_OUT=/home/fuhua/JetsonAGXKernel/Linux_for_Tegra/source/public/kernel/output#路径可以自己定义,记住这个后面有用
export LOCALVERSION=-tegra
CROSS_TOOL_PATH=/home/fuhua/L4t_arm_compiler/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-#上面解压出来的交叉编译环境路径
export PATH=$PATH:$CROSS_TOOL_PATH
编译
生成配置文件
make ARCH=arm64 CROSS_COMPILE=$CROSS_TOOL_PATH O=$TEGRA_AGX_KERNEL_OUT tegra_defconfig
按需调整配置文件,不需要不管
make ARCH=arm64 CROSS_COMPILE=$CROSS_TOOL_PATH O=$TEGRA_AGX_KERNEL_OUT menuconfig
编译
make ARCH=arm64 CROSS_COMPILE=$CROSS_TOOL_PATH O=$TEGRA_AGX_KERNEL_OUT -j8
组成文件系统,从output,也就是编译好的文件路径里拷贝以下内容到指定路径
cd $TEGRA_AGX_KERNEL_OUT
cp arch/arm64/boot/Image /home/fuhua/JetsonAGXKernel/Linux_for_Tegra/kernel/Image
cp arch/arm64/boot/dts/* /home/fuhua/JetsonAGXKernel/Linux_for_Tegra/kernel/dtb/
在output路径下执行
sudo make ARCH=arm64 modules_install INSTALL_MOD_PATH=$TOP_PATH/rootfs/
烧录
cd /home/fuhua/JetsonAGXKernel/Linux_for_Tegra
1 关闭agx 所有电源
2 接好3个按键旁边的typeC口到PC
3 接上电源
4 按下中间的Recovery按键不放
5 按一下电源按键,灯亮
6 等待5秒中,放开中间的Recovery按键
7 查看是否进入强制恢复模式
lsusb
显示为nvidia corp设备即可,显示为L4T是正常连接,没有进入恢复模式
8 在pc上执行
sudo ./flash.sh jetson-agx-xavier-devkit mmcblk0p1