├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── LICENSE ├── README.md ├── jetsonInfo.py └── scripts ├── jetson_libraries.sh └── jetson_variables.sh /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Issue report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the issue** 11 | Please describe the issue 12 | 13 | **What version of L4T/JetPack** 14 | L4T/JetPack version: 15 | 16 | **Which Jetson** 17 | Jetson: 18 | 19 | **To Reproduce** 20 | Steps to reproduce the behavior: 21 | For example, what command line did you run? 22 | 23 | **Expected behavior** 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE REQUEST]" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2018 Jetsonhacks 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------- 24 | 25 | 26 | jetson_variables.sh 27 | See scripts/jetson_variables.sh for full copyright info 28 | Copyright (c) 2020 Raffaello Bonghi. 29 | jetson_libraries.sh 30 | See scripts/jetson_libraries.sh for full copyright info 31 | Copyright (c) 2020 Raffaello Bonghi. 32 | Part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it). 33 | 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jetsonUtilities 2 | This repository holds utilities for working with NVIDIA Jetson Development Kit 3 | 4 | # jetsonInfo 5 | Get information about the NVIDIA Jetson OS environment on NVIDIA Jetson Development Kits (TX1, TX2, AGX Xavier, Xavier NX, Nano, Nano 2GB) 6 | 7 | The information about the NVIDIA Jetson Development Kit operating system is spread over a few files. This is a handy tool to use for reference. 8 | 9 | The Python script jetsoninfo.py will list the hardware, version of L4T that is running, Ubuntu version, and the Linux kernel revision. To execute: 10 | ``` 11 | $ python jetsonInfo.py 12 | ``` 13 | or 14 | ``` 15 | $ python3 jetsonInfo.py 16 | ``` 17 | or 18 | ``` 19 | $ ./jetsonInfo.py 20 | ``` 21 | The hardware designator is derived from the file: '/proc/cpuinfo' 22 | 23 | The L4T version is derived from the file: '/etc/nv_tegra_release' 24 | 25 | The Ubuntu version is derived from the file: '/etc/os-release' 26 | 27 | The Linux kernel version is derived from the file: '/proc/version' 28 | 29 | Thank you Raffaello Bonghi @rbonghi for jetson_variables and jetson_libraries scripts 30 | 31 | ### Release Notes: 32 | 33 | ### August, 2021 34 | * v2.4 35 | * Add support for JetPack 5 36 | * Update to @rbonghi jetson_variables, jetson_libraries 37 | 38 | ### August, 2021 39 | * v2.3 40 | * Add support for JetPack 4.6 41 | * Update to @rbonghi jetson_variables 42 | 43 | ### May, 2021 44 | * v2.2 45 | * Add support for JetPack 4.5 46 | * Add support for Python3 - Thank you Patti Vacek! @pattivacek 47 | * Add Vulcan version 48 | * Update to @rbonghi jetson_variables 49 | 50 | ### July, 2020 51 | * v2.1 52 | * Add support for JetPack 4.4 53 | * Fix issue with TX1/Nano identification 54 | Thank you Manu Seth! @mseth10 55 | * Update to @rbonghi jetson_libraries and jetson_variables 56 | 57 | ### January, 2020 58 | * v2.0 59 | * Add support for JetPack 4.3 60 | 61 | ### November, 2018 62 | * v1.1.2 63 | * Add support for JetPack 4.1.1 (L4T 31.1.0) 64 | 65 | ### October, 2018 66 | * v1.1.1 67 | * Add support for JetPack 4.1 (L4T 31.0.2) 68 | 69 | ### September, 2018 70 | * v1.1 71 | * Add support for JetPack 3.3 (L4T 28.2.1) 72 | * Add support for Jetson AGX Xavier 73 | * Add support for JetPack 4.0 (L4T 31.0.1) 74 | 75 | ### July, 2018 76 | * v1.0 77 | * Add support for JetPack 3.2.1 (L4T 28.2.1) 78 | 79 | Original shell script jetson_variables is derived from jetson_easy: https://github.com/rbonghi/jetson_easy ; Now in jtop package 80 | 81 | Copyright (c) 2015-2021 Raffaello Bonghi 82 | 83 | See license for jetson_easy in scripts folder 84 | 85 | -------------------------------------------------------------------------------- /jetsonInfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: UTF-8 -*- 3 | # MIT License 4 | # Copyright (c) 2017-2022 Jetsonhacks 5 | # Please see accompanying license information 6 | from __future__ import print_function 7 | import os,sys 8 | 9 | class terminalColors: 10 | WARNING = '\033[93m' 11 | FAIL = '\033[91m' 12 | ENDC = '\033[0m' 13 | 14 | import pprint 15 | import subprocess 16 | 17 | command = ['bash', '-c', 'source scripts/jetson_variables.sh && env'] 18 | 19 | proc = subprocess.Popen(command, stdout = subprocess.PIPE) 20 | environment_vars = {} 21 | for line in proc.stdout: 22 | (key, _, value) = line.partition(b"=") 23 | environment_vars[key.decode()] = value.decode() 24 | 25 | proc.communicate() 26 | 27 | # Jetson Model 28 | print("NVIDIA " + environment_vars["JETSON_MODEL"].strip()) 29 | 30 | #L4T Version 31 | print(' L4T ' + environment_vars['JETSON_L4T'].strip() + ' [ JetPack ' +environment_vars['JETSON_JETPACK'].strip()+' ]') 32 | # Ubuntu version 33 | if os.path.exists('/etc/os-release'): 34 | with open('/etc/os-release', 'r') as ubuntuVersionFile: 35 | ubuntuVersionFileText=ubuntuVersionFile.read() 36 | for line in ubuntuVersionFileText.splitlines(): 37 | if 'PRETTY_NAME' in line: 38 | # PRETTY_NAME="Ubuntu 16.04 LTS" 39 | ubuntuRelease=line.split('"')[1] 40 | print(' ' + ubuntuRelease) 41 | else: 42 | print(terminalColors.FAIL + 'Error: Unable to find Ubuntu Version' + terminalColors.ENDC) 43 | print('Reason: Unable to find file /etc/os-release') 44 | 45 | # Kernel Release 46 | if os.path.exists('/proc/version'): 47 | with open('/proc/version', 'r') as versionFile: 48 | versionFileText=versionFile.read() 49 | kernelReleaseArray=versionFileText.split(' ') 50 | print(' Kernel Version: ' + kernelReleaseArray[2]) 51 | else: 52 | print(terminalColors.FAIL + 'Error: Unable to find Linux kernel version' + terminalColors.ENDC) 53 | print('Reason: Unable to find file /proc/version') 54 | 55 | 56 | command1 = ['bash', '-c', 'source scripts/jetson_libraries.sh && env'] 57 | 58 | proc1 = subprocess.Popen(command1, stdout = subprocess.PIPE) 59 | # environment_vars = {} 60 | for line in proc1.stdout: 61 | (key, _, value) = line.partition(b"=") 62 | environment_vars[key.decode()] = value.decode() 63 | 64 | 65 | 66 | print(' CUDA ' + environment_vars['JETSON_CUDA'].strip()) 67 | print(' CUDA Architecture: ' + environment_vars['JETSON_CUDA_ARCH_BIN'].strip()) 68 | print(' OpenCV version: ' + environment_vars['JETSON_OPENCV'].strip()) 69 | print(' OpenCV Cuda: ' + environment_vars['JETSON_OPENCV_CUDA'].strip()) 70 | print(' CUDNN: ' + environment_vars['JETSON_CUDNN'].strip()) 71 | print(' TensorRT: ' + environment_vars['JETSON_TENSORRT'].strip()) 72 | print(' Vision Works: ' + environment_vars['JETSON_VISIONWORKS'].strip()) 73 | print(' VPI: ' + environment_vars['JETSON_VPI'].strip()) 74 | print(' Vulcan: ' + environment_vars['JETSON_VULKAN_INFO'].strip()) 75 | 76 | 77 | -------------------------------------------------------------------------------- /scripts/jetson_libraries.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it). 3 | # Copyright (c) 2020 Raffaello Bonghi. 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU Affero General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU Affero General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Affero General Public License 16 | # along with this program. If not, see . 17 | 18 | 19 | # Read CUDA version 20 | if [ -f /usr/local/cuda/version.txt ]; then 21 | JETSON_CUDA=$(cat /usr/local/cuda/version.txt | sed 's/\CUDA Version //g') 22 | elif [ -f /usr/local/cuda/bin/nvcc ]; then 23 | JETSON_CUDA=$(/usr/local/cuda/bin/nvcc --version | egrep -o "V[0-9]+.[0-9]+.[0-9]+" | cut -c2-) 24 | else 25 | JETSON_CUDA="NOT_INSTALLED" 26 | fi 27 | # Jetson CUDA version 28 | export JETSON_CUDA 29 | 30 | # Read from OpenCV if is installed CUDA 31 | opencv_read_cuda() 32 | { 33 | # Red if use CUDA or not 34 | local OPENCV_VERSION_VERBOSE=$(opencv_version --verbose | grep "Use Cuda" ) 35 | if [ ! -z "$OPENCV_VERSION_VERBOSE" ]; then 36 | # Read status of CUDA 37 | local OPENCV_CUDA_FLAG=$(echo $OPENCV_VERSION_VERBOSE | cut -f2 -d ':' | tr -s ' ' | cut -d' ' -f2 ) 38 | if [ "$OPENCV_CUDA_FLAG" == "NO" ]; then 39 | # Set NO if cuda is not installed 40 | echo "NO" 41 | else 42 | # Set YES if cuda is installed 43 | echo "YES" 44 | fi 45 | return 46 | fi 47 | # read NVIDIA CUDA version 48 | OPENCV_VERSION_VERBOSE=$(opencv_version --verbose | grep "NVIDIA CUDA" ) 49 | if [ ! -z "$OPENCV_VERSION_VERBOSE" ]; then 50 | # get information 51 | local OPENCV_CUDA_FLAG=$(echo $OPENCV_VERSION_VERBOSE | cut -f2 -d ':' | tr -s ' ' | cut -d' ' -f4 | cut -d',' -f1 ) 52 | OPENCV_CUDA_FLAG=${OPENCV_CUDA_FLAG//[[:blank:]]/} 53 | # Set YES if cuda is installed 54 | echo "YES" 55 | return 56 | fi 57 | echo "NO" 58 | return 59 | } 60 | 61 | if hash opencv_version 2>/dev/null; then 62 | JETSON_OPENCV="$(opencv_version)" 63 | # Read information about cuda status 64 | JETSON_OPENCV_CUDA=$(opencv_read_cuda) 65 | else 66 | JETSON_OPENCV="NOT_INSTALLED" 67 | JETSON_OPENCV_CUDA="NO" 68 | fi 69 | # Opencv variables 70 | export JETSON_OPENCV 71 | export JETSON_OPENCV_CUDA 72 | 73 | # Extract cuDNN version 74 | JETSON_CUDNN=$(dpkg -l 2>/dev/null | grep -m1 "libcudnn") 75 | if [ ! -z "$JETSON_CUDNN" ] ; then 76 | JETSON_CUDNN=$(echo $JETSON_CUDNN | sed 's/.*libcudnn[0-9] \([^ ]*\).*/\1/' | cut -d '-' -f1 ) 77 | else 78 | JETSON_CUDNN="NOT_INSTALLED" 79 | fi 80 | # Export NVIDIA CuDNN Library 81 | export JETSON_CUDNN 82 | 83 | # Extract TensorRT version 84 | JETSON_TENSORRT=$(dpkg -l 2>/dev/null | grep -m1 " tensorrt ") 85 | if [ ! -z "$JETSON_TENSORRT" ] ; then 86 | JETSON_TENSORRT=$(echo $JETSON_TENSORRT | sed 's/.*tensorrt \([^ ]*\).*/\1/' | cut -d '-' -f1 ) 87 | else 88 | JETSON_TENSORRT="NOT_INSTALLED" 89 | fi 90 | # Export NVIDIA CuDNN TensorRT 91 | export JETSON_TENSORRT 92 | 93 | # Extract Visionworks version 94 | JETSON_VISIONWORKS=$(dpkg -l 2>/dev/null | grep -m1 "libvisionworks") 95 | if [ ! -z "$JETSON_VISIONWORKS" ] ; then 96 | JETSON_VISIONWORKS=$(echo $JETSON_VISIONWORKS | sed 's/.*libvisionworks \([^ ]*\).*/\1/' ) 97 | else 98 | JETSON_VISIONWORKS="NOT_INSTALLED" 99 | fi 100 | # Export NVIDIA CuDNN VisionWorks 101 | export JETSON_VISIONWORKS 102 | 103 | # Extract VPI 104 | JETSON_VPI=$(dpkg -l 2>/dev/null | grep -m1 "vpi") 105 | if [ ! -z "$JETSON_VPI" ] ; then 106 | JETSON_VPI=$(echo $JETSON_VPI | sed 's/.*vpi[0-9] \([^ ]*\).*/\1/' | cut -d '-' -f1 ) 107 | else 108 | JETSON_VPI="NOT_INSTALLED" 109 | fi 110 | # Export VPI 111 | export JETSON_VPI 112 | 113 | # Vulkan 114 | JETSON_VULKAN_INFO=$(which vulkaninfo) 115 | if [ ! -z $JETSON_VULKAN_INFO ] ; then 116 | JETSON_VULKAN_INFO=$($JETSON_VULKAN_INFO 2> /dev/null | grep -m1 "Vulkan Instance Version") 117 | JETSON_VULKAN_INFO=$(echo $JETSON_VULKAN_INFO | sed 's/.*: \([^ ]*\).*/\1/' ) 118 | else 119 | JETSON_VULKAN_INFO="NOT_INSTALLED" 120 | fi 121 | # Export VPI 122 | export JETSON_VULKAN_INFO 123 | #EOF 124 | -------------------------------------------------------------------------------- /scripts/jetson_variables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is part of the jetson_stats package (https://github.com/rbonghi/jetson_stats or http://rnext.it). 3 | # Copyright (c) 2020 Raffaello Bonghi. 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU Affero General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU Affero General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Affero General Public License 16 | # along with this program. If not, see . 17 | 18 | 19 | # TODO Add enviroments variables: 20 | # - UID -> https://devtalk.nvidia.com/default/topic/996988/jetson-tk1/chip-uid/post/5100481/#5100481 21 | # - GCID, BOARD, EABI 22 | 23 | ########################### 24 | #### JETPACK DETECTION #### 25 | ########################### 26 | # Write version of jetpack installed 27 | # https://developer.nvidia.com/embedded/jetpack-archive 28 | jetson_jetpack() 29 | { 30 | local JETSON_L4T=$1 31 | local JETSON_JETPACK="" 32 | case $JETSON_L4T in 33 | # JetPack 6.x series 34 | "36.4.4") JETSON_JETPACK="6.2.1" ;; 35 | "36.4.3") JETSON_JETPACK="6.2" ;; 36 | "36.4.0") JETSON_JETPACK="6.1" ;; 37 | "36.3.0") JETSON_JETPACK="6.0" ;; 38 | "36.2.0") JETSON_JETPACK="6.0 DP" ;; 39 | # JetPack 5.x series 40 | "35.6.1" | "35.6.2") JETSON_JETPACK="5.1.5" ;; 41 | "35.6.0") JETSON_JETPACK="5.1.4" ;; 42 | "35.5.0") JETSON_JETPACK="5.1.3" ;; 43 | "35.4.1") JETSON_JETPACK="5.1.2" ;; 44 | "35.3.1") JETSON_JETPACK="5.1.1" ;; 45 | "35.2.1") JETSON_JETPACK="5.1" ;; 46 | "35.1.0") JETSON_JETPACK="5.0.2" ;; 47 | "34.1.1") JETSON_JETPACK="5.0.1 DP" ;; 48 | "34.1.0") JETSON_JETPACK="5.0 DP" ;; 49 | # JetPack 4.x series 50 | "32.7.6") JETSON_JETPACK="4.6.6" ;; 51 | "32.7.5") JETSON_JETPACK="4.6.5" ;; 52 | "32.7.4") JETSON_JETPACK="4.6.4" ;; 53 | "32.7.3") JETSON_JETPACK="4.6.3" ;; 54 | "32.7.2") JETSON_JETPACK="4.6.2" ;; 55 | "32.7.1") JETSON_JETPACK="4.6.1" ;; 56 | "32.6.1") JETSON_JETPACK="4.6" ;; 57 | "32.5.1" | "32.5.2") JETSON_JETPACK="4.5.1" ;; 58 | "32.5.0" | "32.5") JETSON_JETPACK="4.5" ;; 59 | "32.4.4") JETSON_JETPACK="4.4.1" ;; 60 | "32.4.3") JETSON_JETPACK="4.4" ;; 61 | "32.4.2") JETSON_JETPACK="4.4 DP" ;; 62 | "32.3.1") JETSON_JETPACK="4.3" ;; 63 | "32.2.3") JETSON_JETPACK="4.2.3" ;; 64 | "32.2.1") JETSON_JETPACK="4.2.2" ;; 65 | "32.2.0" | "32.2") JETSON_JETPACK="4.2.1" ;; 66 | "32.1.0" | "32.1") JETSON_JETPACK="4.2" ;; 67 | "31.1.0" | "31.1") JETSON_JETPACK="4.1.1" ;; 68 | "31.0.2") JETSON_JETPACK="4.1" ;; 69 | "31.0.1") JETSON_JETPACK="4.0" ;; 70 | "28.4.0") JETSON_JETPACK="3.3.3" ;; 71 | "28.2.1") JETSON_JETPACK="3.3 | 3.2.1" ;; 72 | "28.2.0" | "28.2") JETSON_JETPACK="3.2" ;; 73 | "28.1.0" | "28.1") JETSON_JETPACK="3.1" ;; 74 | "27.1.0" | "27.1") JETSON_JETPACK="3.0" ;; 75 | "24.2.1") JETSON_JETPACK="3.0 | 2.3.1" ;; 76 | "24.2.0" | "24.2") JETSON_JETPACK="2.3" ;; 77 | "24.1.0" | "24.1") JETSON_JETPACK="2.2.1 | 2.2" ;; 78 | "23.2.0" | "23.2") JETSON_JETPACK="2.1" ;; 79 | "23.1.0" | "23.1") JETSON_JETPACK="2.0" ;; 80 | "21.5.0" | "21.5") JETSON_JETPACK="2.3.1 | 2.3" ;; 81 | "21.4.0" | "21.4") JETSON_JETPACK="2.2 | 2.1 | 2.0 | 1.2 DP" ;; 82 | "21.3.0" | "21.3") JETSON_JETPACK="1.1 DP" ;; 83 | "21.2.0" | "21.2") JETSON_JETPACK="1.0 DP" ;; 84 | *) JETSON_JETPACK="UNKNOWN" ;; 85 | esac 86 | # return type jetpack 87 | echo $JETSON_JETPACK 88 | } 89 | ########################### 90 | 91 | JETSON_MODEL="UNKNOWN" 92 | # Extract jetson model name 93 | if [ -f /sys/firmware/devicetree/base/model ]; then 94 | JETSON_MODEL=$(tr -d '\0' < /sys/firmware/devicetree/base/model) 95 | fi 96 | 97 | # Extract jetson chip id 98 | JETSON_CHIP_ID="" 99 | if [ -f /sys/module/tegra_fuse/parameters/tegra_chip_id ]; then 100 | JETSON_CHIP_ID=$(cat /sys/module/tegra_fuse/parameters/tegra_chip_id) 101 | fi 102 | # Ectract type board 103 | JETSON_SOC="" 104 | if [ -f /proc/device-tree/compatible ]; then 105 | # Extract the last part of name 106 | JETSON_SOC=$(tr -d '\0' < /proc/device-tree/compatible | sed -e 's/.*,//') 107 | fi 108 | # Extract boardids if exists 109 | JETSON_BOARDIDS="" 110 | if [ -f /proc/device-tree/nvidia,boardids ]; then 111 | JETSON_BOARDIDS=$(tr -d '\0' < /proc/device-tree/nvidia,boardids) 112 | fi 113 | 114 | # Code name 115 | JETSON_CODENAME="" 116 | JETSON_MODULE="UNKNOWN" 117 | JETSON_CARRIER="UNKNOWN" 118 | list_hw_boards() 119 | { 120 | # Extract from DTS the name of the boards available 121 | # Reference: 122 | # 1. https://unix.stackexchange.com/questions/251013/bash-regex-capture-group 123 | # 2. https://unix.stackexchange.com/questions/144298/delete-the-last-character-of-a-string-using-string-manipulation-in-shell-script 124 | local s=$1 125 | local regex='p([0-9-]+)' # Equivalent to p([\d-]*-) 126 | while [[ $s =~ $regex ]]; do 127 | local board_name=$(echo "P${BASH_REMATCH[1]}" | sed 's/-*$//' ) 128 | # Load jetson type 129 | # If jetson type is not empty the module name is the same 130 | if [ $JETSON_MODULE = "UNKNOWN" ] ; then 131 | JETSON_MODULE=$board_name 132 | echo "JETSON_MODULE=\"$JETSON_MODULE\"" 133 | else 134 | JETSON_CARRIER=$board_name 135 | echo "JETSON_CARRIER=\"$JETSON_CARRIER\"" 136 | fi 137 | # Find next match 138 | s=${s#*"${BASH_REMATCH[1]}"} 139 | done 140 | } 141 | # Read DTS file 142 | # 1. https://devtalk.nvidia.com/default/topic/1071080/jetson-nano/best-way-to-check-which-tegra-board/ 143 | # 2. https://devtalk.nvidia.com/default/topic/1014424/jetson-tx2/identifying-tx1-and-tx2-at-runtime/ 144 | # 3. https://devtalk.nvidia.com/default/topic/996988/jetson-tk1/chip-uid/post/5100481/#5100481 145 | if [ -f /proc/device-tree/nvidia,dtsfilename ]; then 146 | # ../hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts 147 | # The last third is the codename of the board 148 | JETSON_CODENAME=$(tr -d '\0' < /proc/device-tree/nvidia,dtsfilename) 149 | JETSON_CODENAME=$(echo ${JETSON_CODENAME#*"/hardware/nvidia/platform/"} | tr '/' '\n' | head -2 | tail -1 ) 150 | # The basename extract the board type 151 | JETSON_DTS="$(tr -d '\0' < /proc/device-tree/nvidia,dtsfilename | sed 's/.*\///')" 152 | # List of all boards 153 | eval $(list_hw_boards "$JETSON_DTS") 154 | fi 155 | 156 | # Export variables 157 | export JETSON_MODEL 158 | export JETSON_CHIP_ID 159 | export JETSON_SOC 160 | export JETSON_BOARDIDS 161 | export JETSON_CODENAME 162 | export JETSON_MODULE 163 | export JETSON_CARRIER 164 | 165 | # Write CUDA architecture 166 | # https://developer.nvidia.com/cuda-gpus 167 | # https://devtalk.nvidia.com/default/topic/988317/jetson-tx1/what-should-be-the-value-of-cuda_arch_bin/ 168 | case $JETSON_MODEL in 169 | *Orin*) JETSON_CUDA_ARCH_BIN="8.7" ;; 170 | *Xavier*) JETSON_CUDA_ARCH_BIN="7.2" ;; 171 | *TX2*) JETSON_CUDA_ARCH_BIN="6.2" ;; 172 | *TX1* | *Nano*) JETSON_CUDA_ARCH_BIN="5.3" ;; 173 | *TK1*) JETSON_CUDA_ARCH_BIN="3.2" ;; 174 | * ) JETSON_CUDA_ARCH_BIN="NONE" ;; 175 | esac 176 | # Export Jetson CUDA ARCHITECTURE 177 | export JETSON_CUDA_ARCH_BIN 178 | 179 | # Serial number 180 | # https://devtalk.nvidia.com/default/topic/1055507/jetson-nano/nano-serial-number-/ 181 | JETSON_SERIAL_NUMBER="" 182 | if [ -f /sys/firmware/devicetree/base/serial-number ]; then 183 | JETSON_SERIAL_NUMBER=$(tr -d '\0'