This page describes how to setup a Jetson TK1 to run a Baserock development image by default, by reflashing with a Baserock devel rootfs.
The pre-requisites are
- a Jetson TK1
- a micro-USB cable for flashing (there is one provided with the Jetson)
- a working Baserock devel machine (or other Linux) to use as host for flashing the Jetson
You may also want to have
- USB keyboard and HDMI screen to work on the Jetson directly
- USB-serial cable if you want to debug what's going on from your host
- SATA disk or SSD with cables
If you're running your host in a VM, make sure that it has access to USB
1) Clone and Build the NVIDIA flashing tools
You'll need the open source Nvidia flashing tools built first, and you only have to do this once, so create a directory for them to go into, e.g ~/nvidia-tools
mkdir ~/nvidia-tools export TEGRA_TOOLS_DIR=~/nvidia-tools/ cd ~/nvidia-tools git clone git://git.baserock.org/delta/nvidia/cbootimage.git git clone git://git.baserock.org/delta/nvidia/cbootimage-configs.git git clone git://git.baserock.org/delta/dtc.git git clone git://git.baserock.org/delta/nvidia/tegrarcm.git git clone git://git.baserock.org/delta/nvidia/tegra-uboot-flasher-scripts.git
Install dependencies (on a Debian-like system)
sudo apt-get install dh-autoreconf libusb-1.0-0-dev libcrypto++-dev flex bison
Now, to build them
cd tegra-uboot-flasher-scripts ./build-tools
If there are any errors here, it will most likely be due missing build dependencies for tegrarcm (e.g libusb). Once you have satisfied these you can run the build tools command again.
Please note: The flashing script requires gdisk to be installed, make sure you have this installed, e.g:
sudo apt-get install gdisk
You should now have a folder _out_tools in TEGRA_TOOLS_DIR that contains the following binaries:
cbootimage dtc fdtput tegrarcm
Once you have these, you're ready to flash!
2) Flashing the Jetson
The process is pretty straight forward. Download the image you want to flash, and run the script! You need to be root to run this, so do this first, e.g:
Follow the instructions carefully, and make sure you export TEGRA_TOOLS_DIR to the folder that contains the _out_tools folder, e.g
Make sure the Jetson isn't in recovery mode before doing this, you'll be told when to do this during the flashing process (to do this hold down "FORCE RECOVERY", press "RESET", release "FORCE RECOVERY". See elinux )
git clone https://gitlab.com/jamesthomas/baserock-flashing-tools.git cd baserock-flashing-tools/ curl -k -O https://download.baserock.org/baserock/baserock-current-build-system-armv7lhf-jetson.img.gz gunzip baserock-current-build-system-armv7lhf-jetson.img.gz bash baserock-flash.sh baserock-current-build-system-armv7lhf-jetson.img jetson-tk1
3) Resize root filesystem
The built-in eMMC that now contains your rootfs is 16GB in size. You can safely use 10GB of this: DON'T try to use more or your root file system may get corrupted. If the disk image you flashed is smaller than that, you can expand it by running the following command on the Jetson:
btrfs filesystem resize 10G /
4) Deploying an upgrade
There is one very important change you will need to make to your upgrade cluster after doing this, using the clusters/jetson-upgrade.morph cluster as an example:
name: jetson-upgrade kind: cluster systems: - morph: systems/devel-system-armv7lhf-jetson.morph deploy-defaults: ... ROOT_DEVICE: "/dev/mmcblk0p1" ...
Since the rootfs is actually no longer on mmcblk0p1 we need to change this, and since the boot partition is now on a separate partition we also need to add BOOT_DEVICE:
name: jetson-upgrade kind: cluster systems: - morph: systems/devel-system-armv7lhf-jetson.morph deploy-defaults: ... BOOT_DEVICE: "/dev/mmcblk0p1" ROOT_DEVICE: "/dev/mmcblk0p2" ...
That's it, you can now run your upgrade in the same way.
To upgrade your Jetson board, you can use Baserock's ssh-rsync deployment method.
First build a new or custom devel-system-armv7lhf-jetson:
git clone git://git.baserock.org/baserock/baserock/definitions cd definitions # make some changes to the system or its strata files, then morph build systems/devel-system-armv7lhf-jetson.morph
See devel-with for information on using Baserock in general.
Make sure you have enough disk space available to hold the new system-version without running out of disk space. Btrfs file systems handle out of space errors very badly. Run:
btrfs filesystem usage /
And check the 'Free (estimated) min: ' value. There's no easy way to discover how much space a system upgrade will take up in advance. As a rule of thumb, 2GB or more free space will be fine unless the system is very large.
Once the system is built you should be able to apply the upgrade to your Jetson, try:
morph deploy --upgrade ./clusters/jetson-upgrade.morph self.HOSTNAME="$(hostname)" self.VERSION_LABEL="my_new_version"
Once this is complete, you should be able to reboot directly into the updated image.
It's probably best to have a serial console attached, so you can watch what's going on.
Go to Jetson to Default
If you hit this, you'll need to set the clock...
date --set 201409251900 hwclock --systohc