Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
156 lines (139 sloc) 6.8 KB
# TX1 setup script for use as companion computer
# STEP1: Run ONE of STEP1A or STEP1B
# STEP1a : install NVidia image onto TX1 (skip this step if you already have a factory image (created in Step2) for the current release of JetPack
# Connect TX1 via USB to Ubuntu machine and put TX1 into bootloader mode:
# Hold Force Recovery button (aka "REC"), press Reset button(aka "RST"), Release Force Recovery button
# On Ubuntu machine "lsusb", and look for "NVidia Corp"
#
# Install JetPack on an Ubuntu 16.04 machine (a Vagrantfile has been supplied!), while connected to the internet:
# download https://developer.nvidia.com/embedded/dlc/jetpack-l4t-3_1 (nvidia login required)
# from the directory you want JetPack installed into (e.g. JetPack-3.1) run "sh /vagrant/JetPack-L4T-3.1-linux-x64.run". This must not be in /vagrant.
# e.g.:
# mkdir jetpack
# cd jetpack
# sh /vagrant/JetPack-L4T-3.1-linux-x64.run
# - may need to run it twice to get the GUI to actualy run
# select Jetson TX1 Development Kit and Ubuntu Host
# On JetPack L4T Component Manager:
# Choose JetPack L4T 3.0 to install
# - Custom
# * Host: set "no action" for everything
# * For Target - Jetson TX1: mixed
# * Linux for Tegra (TX1 64bit): install
# * File System and OS: install
# * Drivers: install
# * Flash OS Image to Target: install
# Install on Target
# * CUDA Toolkit for L4T: install
# * Compile CUDA Samples: no action
# * PerfKit: install
# * TensorRT: install
# * Multimedia API package: no action
# * cuDNN Package: install
# * OpenCV for Tegra: install
# * VisionWorks on TX1 Target: no action
# Click Next, and Accept All
# "Network Layout" screen should appear:
# Select "Device accesses Internet via router/switch", Next
# Select network adapter to use to connect to TX (i.e. eth0 if your Ubuntu machine uses eth0 to access your local internet)
# when "Post Installation Jetson TX1, Following actions will be performed at this stage.." screen appears click Next
# Black screen, "Please put your device to Force USB Recovery Mode", press <Enter>
# Eventually, "Finished Flashing OS, Please press Reset button on device, Press Enter key to continue" will be displayed, press <Enter>
#
# STEP1B: if you want to re-use a factory image (e.g. one downloaded in STEP2):
# (possibly bring up Vagrant virtual machine)
BASEDIR=~/jetpack
TEGRAFLASH=$BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/tegraflash.py
ls $TEGRAFLASH
APPLET=$BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/nvtboot_recovery.bin
ls $APPLET
CBOOT=$BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/t210ref/cboot.bin
ls $CBOOT
IMAGE_NAME="/vagrant/image-factory-20170112/image_jetpack_factory.img" # (e.g.)
IMAGE_NAME="apsync-tx1-$TIMESTAMP.img" # (e.g.)
ls $IMAGE_NAME
sudo $TEGRAFLASH --bl $CBOOT --applet $APPLET --chip 0x21 --cmd "write APP $IMAGE_NAME" # about 60m
#
# STEP2 : Download base image from TX1 (e.g. if you want to take a copy of the factory image)
# put TX1 into bootloader mode: Hold Force Recovery button (aka "REC"), press Reset button(aka "RST"), Release Force Recovery button
# cd to directory where JetPack was installed (i.e. JetPack-2.3.1)
# cd 64_TX1/Linux_for_Tegra_64_tx1/bootloader
# copy in download_image.sh from this repo
# ./download_image.sh tx1_image_jetpack231_factory.img <-- image will be saved to this file. this will take about 1hour and 40 minutes
#
# Step 3 : install packages on TX1
# power on the TX1
# log onto TX1 as ubuntu/ubuntu (you may be able to do this over ethernet using the tegra-ubuntu hostname)
# ssh ubuntu@tegra-ubuntu
# create an apsync user:
sudo useradd -s /bin/bash -m -U -G sudo,netdev,users,dialout,video apsync
sudo passwd apsync # apsync
logout
# copy your private key over:
ssh-copy-id apsync@tegra-ubuntu
# ssh in as apsync, or switch-user to apsync
# open terminal
ssh apsync@tegra-ubuntu
for x in cuda-l4t cudnn jetson_clocks.sh OpenCV4Tegra tegrastats; do
sudo mv /home/ubuntu/$x /home/apsync
sudo chown -R apsync.apsync /home/apsync/$x
done
# change default login user for GUI to apsync:
sudo perl -pe 's/ubuntu/apsync/' -i /etc/lightdm/lightdm.conf.d/50-nvidia.conf
cd ~
mkdir GitHub
pushd GitHub
git clone https://github.com/ArduPilot/companion.git
# usually at this point I rsync over that repository:
# rsync -aP companion/ apsync@tegra-ubuntu:GitHub/companion --delete --delete-excluded --exclude=*.img.xz --exclude=*actory.img
pushd companion/Nvidia_JTX1/Ubuntu
sudo ./set-hostname # reset the machine's hostname
sudo apt-get autoremove -y # avoid repeated no-longer-required annoyance
sudo ./remove-unattended-upgrades #
sudo ./ensure_rc_local.sh
sudo ./disable_console.sh
time sudo ./2_install_packages.sh # 20m
time sudo ./install_niceties || echo "Failed" # 20s
time sudo ./3_wifi_access_point.sh # 20s
sudo ./4_setup_log_rotation # instant
time sudo ./6_setup_video.sh # 1m
time sudo ./8_setup_cmavnode.sh # ~4m
time sudo ./setup_mavlink-router # ~2m
time sudo ./7_dflogger.sh # ~210s
sudo ./5_setup_mavproxy.sh # instant
time sudo ./setup-video-streaming # 11s
time sudo apt-get install -y libxml2-dev libxslt1.1 libxslt1-dev
time sudo pip install future lxml # 4m
time sudo ./install_pymavlink # new version required for apweb #1m
time sudo ./install_apweb # 2m
time sudo ./install_openkai.sh
# reboot and test image according to testing.txt
sudo reboot
# Step 4: cleanup
pushd ~/GitHub/companion/Nvidia_JTX1/Ubuntu && sudo ./clean-for-imaging
sudo poweroff
# Step 5: download apsync image from TX1:
# put TX1 into bootloader mode: Hold Force Recovery button (aka "REC"), press Reset button(aka "RST"), Release Force Recovery button
watch lsusb
# cd to directory where JetPack was installed (i.e. JetPack-2.3.1)
BASEDIR=~/jetpack
cd $BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader
# run download_image.sh from this repo:
TIMESTAMP=`date '+%Y%m%d%H%M'`
# consider using an absolute path for IMAGE_NAME here! e.g. /vagrant/...
IMAGE_NAME="apsync-tx1-$TIMESTAMP.img"
TEGRAFLASH=$BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/tegraflash.py
ls $TEGRAFLASH
APPLET=$BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/nvtboot_recovery.bin
ls $APPLET
CBOOT=$BASEDIR/64_TX1/Linux_for_Tegra_64_tx1/bootloader/t210ref/cboot.bin
ls $CBOOT
sudo $TEGRAFLASH --bl $CBOOT --applet $APPLET --chip 0x21 --cmd "read APP $IMAGE_NAME" # about 1 hour 45 minutes
ls -l $IMAGE_NAME
time xz --verbose -e $IMAGE_NAME # about 7.5 hours
COMPRESSED_IMAGE_NAME="$IMAGE_NAME.xz"
ls -l --si $COMPRESSED_IMAGE_NAME # ~5.2GB
# on host machine (not on the Vagrant VM!)
COMPRESSED_IMAGE_NAME="..."
ls -l --si $COMPRESSED_IMAGE_NAME
time rsync -aP $COMPRESSED_IMAGE_NAME autotest@autotest.ardupilot.org:APM/buildlogs/binaries/Companion/next/$COMPRESSED_IMAGE_NAME # about 11.5 hours