Skip to content

Instantly share code, notes, and snippets.

@adujardin
Last active January 29, 2021 17:34
Show Gist options
  • Save adujardin/59f7653080c2f25e7558d18de66b59bf to your computer and use it in GitHub Desktop.
Save adujardin/59f7653080c2f25e7558d18de66b59bf to your computer and use it in GitHub Desktop.
Script to upgrade OTA the jetpack version (currently to JP45 from JP44)
#!/usr/bin/env bash
LT4_MAJOR=32
LT4_MINOR_OLD=4
LT4_MINOR=5
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
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
jetson_clocks # speed things up
# Make some room
docker image prune -af
# Upgrade to patch release if needed + cleanup
apt update; apt upgrade -y; apt dist-upgrade -y
apt clean ; apt autoremove -y
# 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 purge cuda-repo-*-local-* libvisionworks*-repo
apt update; apt dist-upgrade -y
apt --fix-broken install -y # just in case
DEBIAN_FRONTEND=noninteractive apt-get install nvidia-jetpack -y
apt autoremove -y; apt clean -y
echo "The device should be rebooted now"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment