How to copy whole rootfs of Jetson TX2 to PC

Dear all,

As we installed many packages on JetsonTX2 by apt-get command or the other way so is there any way to copy whole rootfs to PC(host) in order to use ./flash.sh script later.

We don’t want to clone as image file because we also wanna change the root file system at host PC(host) side.

Thanks and Best Regards,
Vu Nguyen

hello forever3000,

besides cloning,
how about creating a custom rootfs on your host device, you’re able to install required packages into root file system.
here’s my steps to make it works,

sudo apt-get install qemu
sudo apt-get install qemu-user-static

sudo tar xvpf <rootfs>.tar.gz 
sudo cp /usr/bin/qemu-aarch64-static <rootfs>/usr/bin/

sudo mount /sys ./sys -o bind
sudo mount /proc ./proc -o bind
sudo mount /dev ./dev -o bind

sudo LC_ALL=C chroot . /bin/bash

sudo apt-get update 
sudo apt-get install <PKG_NAME>
exit

sudo tar -jcpf customize_rootfs.tbz2 *

you may also refer to https://elinux.org/Jetson/TX1_Sample_Root_Filesystem for steps.
thanks

1 Like

Hi JerryChang,

It look so good. If I want to make the custom rootfs that include almost packages from Jetpack, is it possible?

Thanks and Best Regards,
Vu Nguyen

hello forever3000,

I would suggest you download root file system from Jetson Download Center for development.
thanks

Hi JerryChang,

I see but if I want to install some packages that basic root file system (that download from Jetson Download Center) doesn’t have such as cudnn, cuda, opencv, … in Jetpack how can I make it at host side?

Thanks and Best Regards,
Vu Nguyen

hello forever3000,

please running with JetPack install, and please keep these download files save to your local host device. you will found all necessary packages in the jetpack_download/ folder.
you should copy these *.deb files manually into your root files system for customization.
thanks

FYI, clone provides two files: One is the backup.img, and this is “sparse”…it cannot be edited or viewed; the second file is the backup.img.raw…and the raw file can be loopback mounted, explored, edited, and used for flash. I throw away the sparse image and keep only the raw image. Clone will work for what you want and won’t add all of the difficulties of different methods of copy.

Example:

sudo -s
mount -o loop backup.img.raw /mnt
# cd to /mnt, edit, explore...
cd
umount /mnt
cp backup.img.raw /where/ever/Linux_for_Tegra/bootloader/system.img
# flash steps...
exit

FYI, sparse files are faster to flash, but the raw file, if named as “bootloader/system.img”, will flash just fine (it just takes longer).

The raw file will be an exact match to the size of the partition. If you originally flashed with “-S 14580MiB”, then the size will be exactly “14580 * 1024 *1024 = 15288238080” bytes. If you originally flashed with “-S 14GiB”, then the size will be exactly “14 * 1024 * 1024 * 1024 = 15032385536” bytes. By examining the size of the raw file you can figure out the original flash size. Then, assuming it was “-S 14580MiB” originally:

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

If you cover this raw image with loopback, then gdisk and gparted will work on the image (via the name of the loopback device) just like it would for a real partition. So long as size sticks to the “MiB” or “GiB” “-S” size increments you can also resize a loopback raw clone image.

1 Like

Hi linuxdev,

Wow, It look so good.

Thanks a lot