Installing Debian 9 on NVIDIA Jetson nano

DebianWe recently acquired a NVIDIA Jetson nano developer's kit. It's a great, low power, single board computer with plenty of CPU and GPU performance. The default NVIDIA image is based on Ubuntu 18.04 which is not our favorite distribution. At GGLABS all our machines run debian and we started hacking at the nano to make fit our standards.

Prerequisites

  • A Jetson nano
  • A SD card of at least 4GB
  • A debian host system with a SD card reader

Download and uncompress the files on the host system

Download the Official NVIDIA Jetson driver package

Install qemu-debootstrap (as root)
apt-get install binfmt-support qemu qemu-user-static debootstrap

Unpack the NVIDIA files
tar xvjf l4t-jetson-driver-package-32-1-jetson-nano_BSP.tar.bz2

Make a initial image

cd Linux_for_Tegra
./create-jetson-nano-sd-card-image.sh -o debian-nano.img -s 3G -r 200

Flash the preliminary image to the SD card
dd if=debian-nano.img of=/dev/sdX bs=1M status=progress oflag=sync

Run parted or gparted on the SD card. It will complain about the partition table not using the entire disk size. Allow parted to fix the issue. Then you can adjust the size of partition 1 (the root partition). You can also add more partition for home or other mount points. The important part is not to change or move any of the pre-existing partitions (except 1). Then format partition 1.
mkfs -t ext4 /dev/sdX1

Create the debian filesystem

qemu-debootstrap --arch=arm64 stretch rootfs
sed s/root:x:/root::/g rootfs/etc/passwd >rootfs/etc/passwd.tmp
mv rootfs/etc/passwd.tmp rootfs/etc/passwd
sed s/root:.*/root::::/g rootfs/etc/shadow >rootfs/etc/shadow.tmp
mv rootfs/etc/shadow.tmp rootfs/etc/shadow
rm rootfs/var/cache/apt/archives/*
rm rootfs/var/cache/debconf/*old
echo "nano" > rootfs/etc/hostname
./apply_binaries.sh

optionally clean up some of the unnecessary things installed by the apply_binaries script (this is currently a work in progress)
rm -rf rootfs/lib/firmware/brcm* rootfs/lib/firmware/bcm* rootfs/lib/firmware/nv-BT-Version
rm rootfs/usr/sbin/brcm_patchram_plus
rm rootfs/usr/share/doc/nvidia-tegra/LICENSE.brcm_patchram_plus
rm rootfs/usr/share/doc/nvidia-tegra/LICENSE.cypress_wifibt

Create a tar file for the base debian filesystem
cd rootfs
tar cvf ../debian-root.tar .
cd ..

Final touches

mount the SD card root and uncompress the root filesystem
mount /dev/sdX /mnt
tar xvf debian-root.tar -C /mnt/

unmount the sd card
umount /mnt
Kicad
put the SD card in the nano and it should boot.
This is a very basic install and still needs to be configured to be a fully functional system.

Login as root with no password. Set the root password, add user(s) as necessary, configure the network and install the desired packages to complete the install.

Known Issues

The Xorg driver for the integrated GPU is not installed correctly. 2D acceleration is fine but OpenGL applications fail to start.

In some configuration software reboot or shutdown will take a long time. Installing the acpid package should fix the issue.

The apply_binaries script installs lots of non-essential components. We are still working on breaking it up so only necessary files are installed.

Filed under: