├── README.md ├── clone_tx1.txt ├── install_gcc_arm64.sh ├── jetson_max_l4t.sh ├── pytorch_jetson_install.sh ├── record_v4l2.sh ├── set_socket_buffer.sh └── uninstall_unity_scope.sh /README.md: -------------------------------------------------------------------------------- 1 | # jetson-scripts 2 | Scripts and config files for NVIDIA Jetson platform 3 | -------------------------------------------------------------------------------- /clone_tx1.txt: -------------------------------------------------------------------------------- 1 | 2 | See https://devtalk.nvidia.com/default/topic/898999/tx1-r23-1-new-flash-structure-how-to-clone-/post/4784149/#4784149 3 | 4 | 5 | ============================ 6 | Backing up an image 7 | ============================ 8 | 9 | sudo ./tegraflash.py --bl cboot.bin --applet nvtboot_recovery.bin --chip 0x21 --cmd "read APP my_backup_image_APP.img" 10 | 11 | 12 | 13 | ============================ 14 | Restoring an image 15 | ============================ 16 | 17 | sudo ./tegraflash.py --bl cboot.bin --applet nvtboot_recovery.bin --chip 0x21 --cmd "write APP my_backup_image_APP.img" -------------------------------------------------------------------------------- /install_gcc_arm64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Install arm64 gcc extensions on the NVIDIA Jetson TX1 3 | if [ $(id -u) != 0 ]; then 4 | echo "This script requires root permissions" 5 | echo "$ sudo "$0"" 6 | exit 7 | fi 8 | 9 | # Install arm64 gcc extensions 10 | dpkg --add-architecture arm64 11 | apt-get update 12 | apt-get install libc6:arm64 binutils:arm64 cpp-4.8:arm64 gcc-4.8:arm64 13 | # reassign aliases to the compiler 14 | cd /usr/bin 15 | rm cc gcc 16 | ln -s /usr/bin/aarch64-linux-gnu-gcc-4.8 cc 17 | ln -s /usr/bin/aarch64-linux-gnu-gcc-4.8 gcc 18 | ln -s /usr/bin/aarch64-linux-gnu-cpp-4.8 cpp 19 | /bin/echo -e "\e[1;32mARM 64 extensions to GCC Installed.\e[0m" 20 | 21 | -------------------------------------------------------------------------------- /jetson_max_l4t.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # turn on fan for safety 4 | echo "Enabling fan for safety..." 5 | if [ ! -w /sys/kernel/debug/tegra_fan/target_pwm ] ; then 6 | echo "Cannot set fan -- exiting..." 7 | fi 8 | echo 255 > /sys/kernel/debug/tegra_fan/target_pwm 9 | 10 | echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable 11 | echo 1 > /sys/kernel/cluster/immediate 12 | echo 1 > /sys/kernel/cluster/force 13 | echo G > /sys/kernel/cluster/active 14 | echo "Cluster: `cat /sys/kernel/cluster/active`" 15 | 16 | # online all CPUs - ignore errors for already-online units 17 | echo "onlining CPUs: ignore errors..." 18 | for i in 0 1 2 3 ; do 19 | echo 1 > /sys/devices/system/cpu/cpu${i}/online 20 | done 21 | echo "Online CPUs: `cat /sys/devices/system/cpu/online`" 22 | 23 | # set CPUs to max freq (perf governor not enabled on L4T yet) 24 | echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 25 | cpumax=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies | awk '{print $NF}'` 26 | echo "${cpumax}" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed 27 | for i in 0 1 2 3 ; do 28 | echo "CPU${i}: `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`" 29 | done 30 | 31 | # max GPU clock (should read from debugfs) 32 | cat /sys/kernel/debug/clock/gbus/max > /sys/kernel/debug/clock/override.gbus/rate 33 | echo 1 > /sys/kernel/debug/clock/override.gbus/state 34 | echo "GPU: `cat /sys/kernel/debug/clock/gbus/rate`" 35 | 36 | # max EMC clock (should read from debugfs) 37 | cat /sys/kernel/debug/clock/emc/max > /sys/kernel/debug/clock/override.emc/rate 38 | echo 1 > /sys/kernel/debug/clock/override.emc/state 39 | echo "EMC: `cat /sys/kernel/debug/clock/emc/rate`" 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /pytorch_jetson_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # pyTorch install script for NVIDIA Jetson TX1/TX2, 4 | # from a fresh flashing of JetPack 2.3.1 / JetPack 3.0 5 | # 6 | # note: pyTorch documentation calls for use of Anaconda, 7 | # however Anaconda isn't available for aarch64. 8 | # Instead, we install directly from source using setup.py 9 | sudo apt-get install python-pip 10 | 11 | # upgrade pip 12 | pip install -U pip 13 | pip --version 14 | # pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7) 15 | 16 | # clone pyTorch repo 17 | git clone http://github.com/pytorch/pytorch 18 | cd pytorch 19 | 20 | # install prereqs 21 | sudo pip install -U setuptools 22 | sudo pip install -r requirements.txt 23 | 24 | # Develop Mode: 25 | python setup.py build_deps 26 | sudo python setup.py develop 27 | 28 | # Install Mode: (substitute for Develop Mode commands) 29 | #sudo python setup.py install 30 | 31 | # Verify CUDA (from python interactive terminal) 32 | # import torch 33 | # print(torch.cuda.is_available()) 34 | # a = torch.cuda.FloatTensor(2).zero_() 35 | # print(a) 36 | # b = torch.randn(2).cuda() 37 | # print(b) 38 | # c = a + b 39 | # print(c) 40 | -------------------------------------------------------------------------------- /record_v4l2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | gst-launch v4l2src ! xvimagesink 4 | 5 | #gst-launch-0.10 -v v4l2src always-copy=FALSE ! 'video/x-raw-yuv, width=(int)2560, height=(int)720, format=(fourcc)I420' ! \ 6 | # nvvidconv ! nv_omx_h264enc ! qtmux ! filesink location=test.mp4 -e 7 | 8 | #gst-launch-0.10 videotestsrc ! 'video/x-raw-yuv, width=(int)1280, height=(int)720, format=(fourcc)I420' ! \ 9 | # nv_omx_h264enc ! qtmux ! filesink location=test.mp4 -e 10 | 11 | #gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)I420, width=(int)640, height=(int)480' ! omxh265enc ! filesink location=test.h265 -e 12 | 13 | #gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)I420, width=(int)640, height=(int)480' ! \ 14 | # omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=test.mp4 -e 15 | -------------------------------------------------------------------------------- /set_socket_buffer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # *************************************************************************************** 3 | # 4 | # Increases IP sockets buffer rx/tx size 5 | # 6 | # *************************************************************************************** 7 | 8 | OS_NAME=`uname --` 9 | 10 | if [ "$1" = "" ]; then 11 | SIZE=10485760 12 | else 13 | SIZE=$1 14 | fi 15 | 16 | if [ "$OS_NAME" = "SunOS" ]; then 17 | USER=`/usr/xpg4/bin/id -u -n` 18 | fi 19 | 20 | echo "Setting socket maximum buffer size to $SIZE" 21 | 22 | 23 | PROC_ROOT=/proc/sys/net/core 24 | 25 | if [ ! -w $PROC_ROOT/wmem_max ]; then 26 | echo "Cannot write to $PROC_ROOT/wmem_max" 27 | exit 1 28 | fi 29 | 30 | if [ ! -w $PROC_ROOT/rmem_max ]; then 31 | echo "Cannot write to $PROC_ROOT/rmem_max" 32 | exit 1 33 | fi 34 | 35 | echo $SIZE > $PROC_ROOT/wmem_max 36 | echo $SIZE > $PROC_ROOT/rmem_max 37 | 38 | cat $PROC_ROOT/wmem_max 39 | cat $PROC_ROOT/rmem_max 40 | 41 | 42 | -------------------------------------------------------------------------------- /uninstall_unity_scope.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # note: to remove online search (wikipedia, amazon, ect.) 4 | # go to 'Security & Privacy' settings -> Search tab 5 | # and disable Online search 6 | 7 | gsettings set com.canonical.Unity.Lenses disabled-scopes "['more_suggestions-amazon.scope', \ 8 | 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', \ 9 | 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']" 10 | 11 | sudo apt-get remove --purge unity-lens-friends 12 | sudo apt-get remove --purge unity-lens-music 13 | sudo apt-get remove --purge unity-lens-music 14 | sudo apt-get remove --purge unity-lens-photos 15 | sudo apt-get remove --purge unity-lens-video 16 | 17 | sudo apt-get remove --purge unity-scope-audacious 18 | sudo apt-get remove --purge unity-scope-calculator 19 | sudo apt-get remove --purge unity-scope-chromiumbookmarks 20 | sudo apt-get remove --purge unity-scope-clementine 21 | sudo apt-get remove --purge unity-scope-colourlovers 22 | sudo apt-get remove --purge unity-scope-devhelp 23 | sudo apt-get remove --purge unity-scope-firefoxbookmarks 24 | sudo apt-get remove --purge unity-scope-gdrive 25 | sudo apt-get remove --purge unity-scope-gmusicbrowser 26 | sudo apt-get remove --purge unity-scope-gourmet 27 | sudo apt-get remove --purge unity-scope-guayadeque 28 | sudo apt-get remove --purge unity-scope-manpages 29 | sudo apt-get remove --purge unity-scope-musicstores 30 | sudo apt-get remove --purge unity-scope-musique 31 | sudo apt-get remove --purge unity-scope-openclipart 32 | sudo apt-get remove --purge unity-scope-exdoc 33 | sudo apt-get remove --purge unity-scope-tomboy 34 | sudo apt-get remove --purge unity-scope-video-remote 35 | sudo apt-get remove --purge unity-scope-virtualbox 36 | sudo apt-get remove --purge unity-scope-yelp 37 | sudo apt-get remove --purge unity-scope-zotero 38 | 39 | --------------------------------------------------------------------------------