How to restore cloned kernel-dtb

On TX2, I know how to clone the rootfs and restore it but couldn’t find any details on how to restore a cloned device tree partition.

I have cloned dtb partition using,
sudo ./ -r -k kernel-dtb -G ~/dtb_backup.img jetson-tx2 mmcblk0p15

How to restore this image?

Each partition has a GPT label. This is what “kernel-dtb” is…just a GPT partition label. You can verify with “sudo gdisk -l /dev/mmcblk0”.

Option 1, you could copy it to the Jetson (if it is running) and dd it to the partition number this is from (be sure to check the size of your dtb will fit in that partition).

Option 2, pretend you are making a custom dtb, look up the instructions for placing it with the right name under “Linux_for_Tegra/kernel/dtb/” and use those instructions. Example, after copying the file in place:

sudo ./ -r -k kernel-dtb jetson-tx2 mmcblk0p1

FYI, the partition is a binary copy of the dtb file, but with NULL bytes padding the end of it to fit the block size and partition size (512 byte block size times number of blocks…the dtb is a subset of the leading bytes). If you were to use a binary editor and cut the tail of your partition to end with only one NULL byte you would essentially have exactly what the dtc application would produce. I don’t know if having a binary image with all NULL bytes already on it would matter or not so long as it fits in the partition’s space…probably it would work, but I’d test when you aren’t afraid of losing things through need to flash.


I have been using Option 2 on a running system but cannot use it in my current issue, more details below.

Cloned the Image from a running system using,
sudo ./ -r -k APP -G system.img jetson-tx2 mmcblk0p1

this gave me system.img and system.img.raw

Next I tried to restore this image on a different system but there is a kernel panic during boot up at the early stages and it continuously reboots. In both cases, L4T release is same (R28.1).

I thought there is a mismatch between device tree/kernel so I have cloned image of device tree and kernel (from the running system) using,

sudo ./ -r -k kernel-dtb -G ~/dtb_backup.img jetson-tx2 mmcblk0p1
sudo ./ -r -k kernel -G ~/kernel.img jetson-tx2 mmcblk0p1

Now, dtb_back.img is renamed to correct dtb filename and I have flashed this file but still not able to boot. I have also mounted system.img.raw and copied the /boot/Image file and tried to flash this as new kernel image but this is also not helping.

The kernel.img that I cloned above is of 67MB (as compared to ‘/boot/Image’ file size of 20MB).

Previously I was able to simply clone and restore that image (system.img) in a different system with no issues but in this case I am not able to do that for some reason.

My understanding is that kernel partition contains only kernel image (i.e., /boot/Image) but their sizes are considerably different (is it a non-sparse image perhaps?).

Could you suggest anyway to be able to restore my system and get it working?
How can I flash kernel.img that is extracted above?

Please ignore my previous post, I am able to restore the image on to a different system correctly now.

Looks like the dtb file that I was using was not the correct one and I also ran the below command to first flash all the default images.

sudo ./ -r jetson-tx2 mmcblk0p1


I’m trying to do what you described above, but I don’t know what the proper name of the dtb_backup.img should be before I run sudo ./ -r jetson-tx2 mmcblk0p1.

What filename did you use? Should it be tegra186-quill-p3310-1000-a00-00-base.dtb?