Jetson/Cloning

From eLinux.org
< Jetson
Revision as of 07:14, 20 November 2014 by Jabjoe (talk | contribs)
Jump to: navigation, search

Cloning the image

Like with all x86 host operations performed on the Jetson, you will need the Jetson TK1 Development Pack.

To make a carbon copy of an existing Jetson install, first connect the Jetson's micro-B USB flash port to the Linux machine that you originally flashed L4T from. Then enter the Jetson into recovery mode by holding RECOVERY and pressing RESET.

cd into the Linux_for_Tegra/bootloader directory that you used when originally flashing the Jetson. Inspect flash.cfg to obtain the partition id of system.img (in this case, 9)

[partition]
name=APP
id=9
type=data
allocation_policy=sequential
filesystem_type=basic
size=15288238080
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=system.img

Next, remove the old system.img built from the initial flashing and download the new image from the Jetson. If the id of your system.img partition is different than 9, substitute that in the nvflash command.

sudo rm system.img
sudo ./nvflash --read 9 system.img --bl fastboot.bin --go

(On more recent Jetson TK1 Development Pack releases, fastboot.bin has been moved to ardbeg/fastboot.bin)

(downloading the image can take a while)

Mounting

To mount the backed-up image to your system, execute the following command:

sudo mount -t ext4 -o loop system.img /mnt

You can now inspect the Jetson's filesystem in /mnt and make edits, perform cross-compiling, ect. When finished, unmount the image with:

sudo umount /mnt

Restoring

The image can be restored to a Jetson by flashing it with the -r 'skip building and reuse existing system.img' flag. Substitute the size of your partition if you originally flashed with a size different than 14580MiB.

cd ../
sudo ./flash.sh -r -S 14580MiB jetson-tk1 mmcblk0p1

Reboot the Jetson when it's done flashing and the system should be restored to the state at the time of cloning.

Packaging

Keep the Linux_for_Tegra directory used during the cloning process to successfully restore the image. Linux_for_Tegra/rootfs can be removed as it's no longer needed. However the other L4T files should be transported along with the system.img to use during restoration.

sudo rm -r -f rootfs
cd ../
tar -zcvf my_backup.tar.gz Linux_for_Tegra

tar.gz can significantly compress the size of system.img and will retain the access privileges and is now convenient to copy/FTP/ect.