|
| 1 | +#!/bin/bash |
| 2 | +# Copyright (C) 2018, Raffaello Bonghi <[email protected]> |
| 3 | +# All rights reserved |
| 4 | +# |
| 5 | +# Redistribution and use in source and binary forms, with or without |
| 6 | +# modification, are permitted provided that the following conditions |
| 7 | +# are met: |
| 8 | +# |
| 9 | +# 1. Redistributions of source code must retain the above copyright |
| 10 | +# notice, this list of conditions and the following disclaimer. |
| 11 | +# 2. Redistributions in binary form must reproduce the above copyright |
| 12 | +# notice, this list of conditions and the following disclaimer in the |
| 13 | +# documentation and/or other materials provided with the distribution. |
| 14 | +# 3. Neither the name of the copyright holder nor the names of its |
| 15 | +# contributors may be used to endorse or promote products derived |
| 16 | +# from this software without specific prior written permission. |
| 17 | +# |
| 18 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
| 19 | +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
| 20 | +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 21 | +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 24 | +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 25 | +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 26 | +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 27 | +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 28 | +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | + |
| 30 | +# NVIDIA Identify version |
| 31 | +# reference: |
| 32 | +# https://devtalk.nvidia.com/default/topic/1014424/jetson-tx2/identifying-tx1-and-tx2-at-runtime/ |
| 33 | +# https://devtalk.nvidia.com/default/topic/996988/jetson-tk1/chip-uid/post/5100481/#5100481 |
| 34 | + |
| 35 | +if [ -f /sys/module/tegra_fuse/parameters/tegra_chip_id ]; then |
| 36 | + case $(cat /sys/module/tegra_fuse/parameters/tegra_chip_id) in |
| 37 | + 64) |
| 38 | + JETSON_BOARD="TK1" ;; |
| 39 | + 33) |
| 40 | + JETSON_BOARD="TX1" ;; |
| 41 | + 24) |
| 42 | + JETSON_BOARD="TX2" ;; |
| 43 | + *) |
| 44 | + JETSON_BOARD="UNKNOWN" ;; |
| 45 | + esac |
| 46 | + JETSON_DESCRIPTION="NVIDIA Jetson $JETSON_BOARD" |
| 47 | +fi |
| 48 | + |
| 49 | +# NVIDIA Jetson version |
| 50 | +# reference https://devtalk.nvidia.com/default/topic/860092/jetson-tk1/how-do-i-know-what-version-of-l4t-my-jetson-tk1-is-running-/ |
| 51 | +if [ -f /etc/nv_tegra_release ]; then |
| 52 | + # L4T string |
| 53 | + JETSON_L4T_STRING=$(head -n 1 /etc/nv_tegra_release) |
| 54 | + |
| 55 | + # Load release and revision |
| 56 | + JETSON_L4T_RELEASE=$(echo $JETSON_L4T_STRING | cut -f 1 -d ',' | sed 's/\# R//g' | cut -d ' ' -f1) |
| 57 | + JETSON_L4T_REVISION=$(echo $JETSON_L4T_STRING | cut -f 2 -d ',' | sed 's/\ REVISION: //g' | cut -d. -f1) |
| 58 | + # unset variable |
| 59 | + unset JETSON_L4T_STRING |
| 60 | + |
| 61 | + # Write Jetson description |
| 62 | + JETSON_L4T="$JETSON_L4T_RELEASE.$JETSON_L4T_REVISION" |
| 63 | + |
| 64 | + # Write version of jetpack installed |
| 65 | + # https://developer.nvidia.com/embedded/jetpack-archive |
| 66 | + if [ "$JETSON_BOARD" = "TX2i" ] ; then |
| 67 | + case $JETSON_L4T in |
| 68 | + "28.2") |
| 69 | + JETSON_JETPACK="3.2" ;; |
| 70 | + *) |
| 71 | + JETSON_JETPACK="UNKNOWN" ;; |
| 72 | + esac |
| 73 | + elif [ "$JETSON_BOARD" = "TX2" ] ; then |
| 74 | + case $JETSON_L4T in |
| 75 | + "28.2") |
| 76 | + JETSON_JETPACK="3.2" ;; |
| 77 | + "28.1") |
| 78 | + JETSON_JETPACK="3.1" ;; |
| 79 | + "27.1") |
| 80 | + JETSON_JETPACK="3.0" ;; |
| 81 | + *) |
| 82 | + JETSON_JETPACK="UNKNOWN" ;; |
| 83 | + esac |
| 84 | + elif [ "$JETSON_BOARD" = "TX1" ] ; then |
| 85 | + case $JETSON_L4T in |
| 86 | + "28.2") |
| 87 | + JETSON_JETPACK="3.2" ;; |
| 88 | + "28.1") |
| 89 | + JETSON_JETPACK="3.1" ;; |
| 90 | + "24.2.1") |
| 91 | + JETSON_JETPACK="3.0 or 2.3.1" ;; |
| 92 | + "24.2") |
| 93 | + JETSON_JETPACK="2.3" ;; |
| 94 | + "24.1") |
| 95 | + JETSON_JETPACK="2.2.1 or 2.2" ;; |
| 96 | + "23.2") |
| 97 | + JETSON_JETPACK="2.1" ;; |
| 98 | + "23.1") |
| 99 | + JETSON_JETPACK="2.0" ;; |
| 100 | + *) |
| 101 | + JETSON_JETPACK="UNKNOWN" ;; |
| 102 | + esac |
| 103 | + elif [ "$JETSON_BOARD" ="TK1" ] ; then |
| 104 | + case $JETSON_L4T in |
| 105 | + "21.5") |
| 106 | + JETSON_JETPACK="2.3.1 or 2.3" ;; |
| 107 | + "21.4") |
| 108 | + JETSON_JETPACK="2.2 or 2.1 or 2.0 or DP 1.2" ;; |
| 109 | + "21.3") |
| 110 | + JETSON_JETPACK="DP 1.1" ;; |
| 111 | + "21.2") |
| 112 | + JETSON_JETPACK="DP 1.0" ;; |
| 113 | + *) |
| 114 | + JETSON_JETPACK="UNKNOWN" ;; |
| 115 | + esac |
| 116 | + else |
| 117 | + # Unknown board |
| 118 | + JETSON_JETPACK="UNKNOWN" |
| 119 | + fi |
| 120 | +fi |
| 121 | + |
| 122 | +# Read CUDA version |
| 123 | +if [ -f /usr/local/cuda/version.txt ]; then |
| 124 | + JETSON_CUDA=$(cat /usr/local/cuda/version.txt | sed 's/\CUDA Version //g') |
| 125 | +else |
| 126 | + JETSON_CUDA="NOT INSTALLED" |
| 127 | +fi |
| 128 | + |
| 129 | +# Read opencv version |
| 130 | +if hash pkg-config --modversion opencv 2>/dev/null; then |
| 131 | + JETSON_OPENCV=$(pkg-config --modversion opencv) |
| 132 | +else |
| 133 | + JETSON_OPENCV="NOT INSTALLED" |
| 134 | +fi |
| 135 | + |
| 136 | +# TODO Add enviroments variables: |
| 137 | +# - UID -> https://devtalk.nvidia.com/default/topic/996988/jetson-tk1/chip-uid/post/5100481/#5100481 |
| 138 | +# - GCID, BOARD, EABI |
| 139 | +# - cuDNN |
| 140 | +# - TensorRT |
| 141 | +# - Visionworks |
| 142 | + |
0 commit comments