How to flash and clone the xavier jetpack on sd card?

Hello, i would like to create an image from my jetson xavier and flash it on sd card, what is the best way to do that?

hello shragat,

you’ll need flash script to create an image from your target.

Usage: sudo ./flash.sh [options] <target_board> <rootdev>
...
-G <file name> ------- Read partition and save image to file.

please also refer to Flashing and Booting the Target Device for using flash script.
besides, you may also check Setting Up the Root File System for the steps to copy the file system to an external storage device.
thanks

hi, thanks for your reply. I read the links you provided, but didn’t find any information that can help me.
I used this instructions for creating an image of my xavier: https://elinux.org/Jetson/AGX_Xavier_Alternative_II_For_Cloning
Now i have a system.img file after this command:

./mksparse -v --fillpattern=0 ~/testimage.raw system.img

I replaced the original system.img with the new one, and then used those commands:

sudo mkfs.ext4 /dev/sd<port><device_number> #Format your device with an Ext4 file system cd Linux_for_Tegra/rootfs/
sudo cp -a * <mntpoint> && sync Unmount the disk and connect it to the target Tegra device
$ sudo ./flash.sh jetson-xavier mmcblk1p1

It didn’t work, the xavier started boot and stopped.
What do i wrong?

If your “system.img” was from a clone, then realize it was already sparse. Clone would create both a system.img.raw and a system.img. Runing mksparse on system.img would be an error, whereas running mksparse on “system.img.raw” would duplicate the sparse version of system.img.

Also, make sure the cloned partition is from the same release as the JetPack/SDK Manager being used to flash now.

Keep in mind as well that this will overwrite your clone and generate a new default image:

sudo ./flash.sh jetson-xavier mmcblk1p1

This would reuse the existing image:

sudo ./flash.sh <b>-r</b> jetson-xavier mmcblk1p1

Also, if you are flashing to an alternative device, then you probably need to copy manually to that device. Even if boot software points something like an SD card partition you would still need to be sure that partition exists with a full operating system.