Skip to content

Commit

Permalink
Update flash to check for Orin
Browse files Browse the repository at this point in the history
  • Loading branch information
jetsonhacks committed Feb 28, 2023
1 parent 974b21a commit 4c69720
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions flash_jetson_external_storage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash
#MIT License
#Copyright (c) 2021 Jetsonhacks
#Copyright (c) 2021-23 Jetsonhacks

JETSON_FOLDER=R35.2.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
Expand All @@ -14,33 +18,32 @@ declare -a device_names=(

)

# In a shell script, 0 is success (True)
function is_xavier() {
local input=$1
for device_name in "${device_names[@]}"; do
if [[ "$device_name" == "$input" ]] && [[ "$device_name" == *"xavier"* ]]; then
return true
return 0
fi
done
return false
return 1
}

function is_orin() {
local input=$1
for device_name in "${device_names[@]}"; do
if [[ "$device_name" == "$input" ]] && [[ "$device_name" == *"orin"* ]]; then
return true
return 0
fi
done
return false
return 1
}


# Sanity warning; Make sure we're not running from a Jetson
# First check to see if we're running on Ubuntu
# Next, check the architecture to make sure it's x86, not a Jetson

JETSON_FOLDER=R35.1.0
LINUX_FOR_TEGRA_DIRECTORY="$JETSON_FOLDER/Linux_for_Tegra"

function help_func
{
Expand All @@ -63,7 +66,7 @@ if [ -f /etc/os-release ]; then
;;
esac

else
elsenvme0n1p1
if [ $(arch) == 'aarch64' ]; then
echo 'This script must be run from a x86 host machine'
if [ -f /etc/nv_tegra_release ]; then
Expand Down Expand Up @@ -97,6 +100,8 @@ function check_board_setup
echo $PWD
# Check to see if we can see the Jetson
echo "Checking Jetson ..."



FLASH_BOARDID=$(sudo ./nvautoflash.sh --print_boardid)
if [ $? -eq 1 ] ; then
Expand All @@ -108,6 +113,12 @@ function check_board_setup
echo "a USB port and in Force Recovery Mode"
exit 1
else
# get the last line with trailing spaces removed
# echo "$FLASH_BOARDID" | sed -e 's/ *$//' | tail -n 1
last_line=$(echo "$FLASH_BOARDID" | sed -e 's/ *$//' | tail -n 1)
# remove the string "found." from the last line
FLASH_BOARDID=$(echo "$last_line" | sed -e 's/found\.$//')
echo $FLASH_BOARDID
if is_orin $FLASH_BOARDID || is_xavier $FLASH_BOARDID ; then
echo "$FLASH_BOARDID" | grep found
if [[ $FLASH_BOARDID == *"jetson-xavier-nx-devkit"* ]] ; then
Expand Down

0 comments on commit 4c69720

Please sign in to comment.