diff --git a/flash_jetson_external_storage.sh b/flash_jetson_external_storage.sh index 6c26b9f..329b731 100755 --- a/flash_jetson_external_storage.sh +++ b/flash_jetson_external_storage.sh @@ -2,19 +2,18 @@ #MIT License #Copyright (c) 2021-23 Jetsonhacks -JETSON_FOLDER=R35.4.1 -LINUX_FOR_TEGRA_DIRECTORY="$JETSON_FOLDER/Linux_for_Tegra" - # Flash Jetson Xavier to run from external storage # Some helper functions. These scripts only flash Jetson Orins and Xaviers # https://docs.nvidia.com/jetson/archives/r35.4.1/DeveloperGuide/text/IN/QuickStart.html#jetson-modules-and-configurations + declare -a device_names=( "jetson-agx-orin-devkit" "jetson-agx-xavier-devkit" "jetson-agx-xavier-industrial" "jetson-orin-nano-devkit" + "jetson-orin-nano-devkit-super" "jetson-xavier-nx-devkit" "jetson-xavier-nx-devkit-emmc" @@ -51,6 +50,7 @@ function help_func { echo "Usage: ./flash_jetson_external_storage [OPTIONS]" echo " No option flashes to nvme0n1p1 by default" + echo " -v | --version - the version of the Jetson release files to use ex: R35.4.1" echo " -s | --storage - Specific storage media to flash; sda1 or nvme0n1p1" echo " -h | --help - displays this message" } @@ -90,12 +90,6 @@ else esac fi -if [[ ! -d $LINUX_FOR_TEGRA_DIRECTORY ]] ; then - echo "Could not find the Linux_for_Tegra folder." - echo "Please download the Jetson sources and ensure they are in $JETSON_FOLDER/Linux_for_Tegra" - exit 1 -fi - function check_board_setup { cd $LINUX_FOR_TEGRA_DIRECTORY @@ -210,30 +204,41 @@ function flash_jetson # Parse command line arguments storage_arg="nvme0n1p1" -# If no arguments, assume nvme -if [ "$1" == "" ]; then - flash_jetson "${storage_arg}" - exit 0 -fi - while [ "$1" != "" ]; do case $1 in - -s | --storage ) - shift - storage_arg=$1 - flash_jetson "${storage_arg}" - exit 0; - ;; - -h | --help ) - help_func - exit - ;; - * ) - echo "*** ERROR Invalid flag" - help_func - exit - ;; - esac + -v | --version ) + JETSON_FOLDER=${2:-R35.4.1} + LINUX_FOR_TEGRA_DIRECTORY="$JETSON_FOLDER/Linux_for_Tegra" + shift + shift + ;; + -s | --storage ) + shift + storage_arg=$1 + shift + ;; + -h | --help ) + help_func + exit + ;; + * ) + echo "*** ERROR Invalid flag" + help_func + exit + ;; + esac shift done + +if [[ ! -d $LINUX_FOR_TEGRA_DIRECTORY ]] ; then + echo "Could not find the Linux_for_Tegra folder." + echo "Please download the Jetson sources and ensure they are in $JETSON_FOLDER/Linux_for_Tegra" + exit 1 +fi + +#Swapping config xml or Xavier devices - without this change the system root is constrained to 14GB +sed -i 's/flash_l4t_t194_nvme.xml/flash_l4t_external.xml/' ./$JETSON_FOLDER/Linux_for_Tegra/nvsdkmanager_flash.sh + +flash_jetson "${storage_arg}" +exit 0 diff --git a/get_jetson_files.sh b/get_jetson_files.sh index 79ebd93..57ee989 100755 --- a/get_jetson_files.sh +++ b/get_jetson_files.sh @@ -10,12 +10,12 @@ # First check to see if we're running on Ubuntu # Next, check the architecture to make sure it's not aarch64, not a Jetson -JETSON_FOLDER=R35.4.1 function help_func { echo "Usage: ./get_jetson_files.sh [OPTIONS]" + echo " -v | --version - the version of the Jetson release files to get ex: R35.4.1" echo " -h | --help - displays this message" } @@ -57,6 +57,11 @@ fi while [ "$1" != "" ]; do case $1 in + -v | --version ) + JETSON_FOLDER=${2:-R35.4.1} + shift + shift + ;; -h | --help ) help_func exit @@ -72,22 +77,30 @@ done echo 'Ready to download!' -mkdir $JETSON_FOLDER +mkdir -p $JETSON_FOLDER cd $JETSON_FOLDER +MAJOR_VERSION=$(echo $JETSON_FOLDER | cut -d '.' -f 1 | tr -d 'R') +MINOR_VERSION=$(echo $JETSON_FOLDER | cut -d '.' -f 2) +PATCH_VERSION=$(echo $JETSON_FOLDER | cut -d '.' -f 3) +RELEASE_DIR="r${MAJOR_VERSION}_release_v${MINOR_VERSION}.${PATCH_VERSION}" +TEGRA_FILE="tegra_linux_sample-root-filesystem_r${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}_aarch64.tbz2" +JETSON_FILE="jetson_linux_r${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}_aarch64.tbz2" # Made it this far, we're ready to start the downloads -# Get the 35.4.1 Tegra system +#https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.4/release/Tegra_Linux_Sample-Root-Filesystem_r36.4.4_aarch64.tbz2# +#https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.4/release/Jetson_Linux_r36.4.4_aarch64.tbz2 +# Get the Tegra system # Get the L4T Driver Package - BSP -wget -N https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/release/jetson_linux_r35.4.1_aarch64.tbz2 +wget -N https://developer.nvidia.com/downloads/embedded/l4t/${RELEASE_DIR}/release/${JETSON_FILE} # Get the Sample Root File System (rootfs) -wget -N https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v4.1/release/tegra_linux_sample-root-filesystem_r35.4.1_aarch64.tbz2 +wget -N https://developer.nvidia.com/downloads/embedded/l4t/${RELEASE_DIR}/release/${TEGRA_FILE} # Unpack the files, creating the Linux_for_Tegra folder -sudo tar -xpvf jetson_linux_r35.4.1_aarch64.tbz2 +sudo tar -xpvf ${JETSON_FILE} cd Linux_for_Tegra/rootfs/ -sudo tar -xpvf ../../tegra_linux_sample-root-filesystem_r35.4.1_aarch64.tbz2 +sudo tar -xpvf ../../${TEGRA_FILE} cd ../.. cd Linux_for_Tegra/