Skip to content

Instantly share code, notes, and snippets.

@adujardin
Created November 3, 2022 10:36
Show Gist options
  • Select an option

  • Save adujardin/5298a596fdab30e6f45b74db3971dd7c to your computer and use it in GitHub Desktop.

Select an option

Save adujardin/5298a596fdab30e6f45b74db3971dd7c to your computer and use it in GitHub Desktop.

Revisions

  1. adujardin created this gist Nov 3, 2022.
    34 changes: 34 additions & 0 deletions upgrade_jetpack.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    #!/usr/bin/env bash

    set -x

    LT4_MAJOR=32
    LT4_MINOR_OLD=6
    LT4_MINOR=7

    if [ "$EUID" -ne 0 ]
    then echo "Please run as root"
    exit
    fi

    jetson_clocks # speed things up

    # Check disk space
    disk_space_byte=$(df $PWD | awk '/[0-9]%/{print $(NF-2)}')
    disk_space_megabyte=$(( disk_space_byte / 1000 ))
    echo "** Free space : $disk_space_megabyte Mo **"
    if [[ $disk_space_megabyte -lt 5000 ]]; then
    echo "Not enough disk space (need 5Go)"
    exit 1
    fi

    # Upgrade
    apt update; apt upgrade -y;
    echo "The device should be rebooted before continuing (the script is paused)"
    sleep 20

    # Actual upgrade
    # https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fquick_start.html%23wwpID0EXHA
    sed -i "s/r$LT4_MAJOR.$LT4_MINOR_OLD /r$LT4_MAJOR.$LT4_MINOR /g" /etc/apt/sources.list.d/nvidia-l4t-apt-source.list
    apt update; apt upgrade -y;
    echo "The device can be rebooted now"