Installing CUDA packages on Jetson boards without JetPack

To install packages like CUDA, OpenCV4Tegra, … on Jetson boards, Nvidia provides the JetPack tool which is intended to simplify the installation process.
However, this tool only runs on some Ubuntu distributions and requires to be connected to the Jetson board.
Of course, Nvidia does not provide links to download packages separately anymore.
So, here is the little trick I found, for those who, like me, want to bypass the JetPack tool and go “old school”.
The method described below works on my Debian (testing) systems and may also work on other distributions.
This post follows a question posted on the Nvidia forum (TX1 Specific arm64 deb repo for cuda 8) and I realized that my method may help other users.

The first step is to download the last JetPack from the Nvidia website.
On a non Ubuntu system, running JetPack installer produces the following error :
$ bash JetPack-L4T-2.3.1-linux-x64.run
Error: JetPack must be run on Ubuntu platform. Please check your platform and retry.

Adding the –help flag to the command line provides additional flags:
$ bash JetPack-L4T-2.3.1-linux-x64.run –help
The one we are looking for is the –noexec flag which unpack the JetPack files without executing installation scripts:
$ bash JetPack-L4T-2.3.1-linux-x64.run –noexec

Installation tools and scripts are located into the _installer directory:
$ cd _installer
$ ls
Chooser local.cfg.tmp report_ip_to_host.sh
configure_host nv_info_broker run_command
cuda-l4t.sh ocv.sh run_gameworks_sample.sh
flash_os PageAction start_up.sh
InstallUtil Poller sudo_daemon
JetPack_Uninstaller rc.local
Launcher remove_unsupported_cuda_samples.sh

The command which displays the list of available packages for the boards is called Chooser.
$ ./Chooser
However, if you run it, it may display an error like “missing libpng12 library.”
So, download the library (libpng12 on SourceForge), unpack and compile it, then:
export LD_LIBRARY_PATH+=:path_to_libpng12/lib

Now the Chooser command may work but you do not need to use it!
Indeed, it starts by checking Nvidia servers and produces a file call repository.json which contains all the links to the Nvidia packages.
$ cat repository.json | grep cuda-repo

“url”: “http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/006/linux-x64/cuda-repo-l4t-8-0-local_8.0.34-1_arm64.deb”,

Now you can do whatever you want with these links, for example to get the CUDA 8.0 package on your Jetson board:
$ wget http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/006/linux-x64/cuda-repo-l4t-8-0-local_8.0.34-1_arm64.deb

Then you can install it:
$ dpkg -i cuda-repo-l4t-8-0-local_8.0.34-1_arm64.deb
$ apt update
$ apt search cuda
$ apt install cuda-toolkit-8.0

After performing all of these steps, I wonder why Nvidia does not provide access to these packages anymore since it is supported on more platforms and does not require an additional computer to update the Jetson boards.