Clone TX2 with custom kernel


I’m a little confused and I need to clarify something about image cloning for TX2, with the script.

Say I clone an image with sudo ./ -r -k APP -G clone_image.img jetson-xavier-nx-devkit-tx2-nx mmcblk0p1. What am I actually cloning? Does it include all the changed I made to the kernel, device tree, etc… ? This is a bit unclear to me because I only use 1 host machine, so when I reuse an image, with ``sudo ./ -r -k APP jetson-xavier-nx-devkit-tx2-nx mmcblk0p1, i'm not sure if the kernel is embedded in the image file or if it's using the already compiled kernel that I have in the directory. Also, I'm not really sure what -k APP` is doing or what it’s referring to, or even if that’s at all relevant for my question. I saw in this post that it is the partition name, but i’m not sure what that means for this context.

Sorry if this is a little confusing. I guess my ultimate question would be, can we create an image with the rootfs image as well as the kernel that contains everything and I can be sure every image will contain the same kernel and rootfs changes we initially made?

Thank you,

Before I answer keep in mind that the kernel has two possible locations:

  1. The partition which is just for the kernel.
  2. In “/boot” with an entry in “/boot/extlinux/extlinux.conf” pointing at it.

If security fuses are burned the content must come from the kernel partition. If not, then either is allowed. A serial boot log typically tells you which kernel is loaded. You can also examine “extlinux.conf” and see if it points at a “/boot” entry.

Cloning copies only the rootfs partition. Other partitions, including the kernel partition, do not clone. If you modified the “/boot” content, then your clone includes this.

Hi @linuxdev, thank you for your answer.

So, when I clone an image with -k APP, this partition you mentioned, is not cloned, correct?

Ok I see it.
So, extlinux.conf, I have this entry: LINUX /boot/Image. Does this mean my clonde includes /boot/Image? Also, what exacly is this /boot/Image file? And fundamentally, does this allow me to keep my changes to the kernel drivers and device trees that I’ve made, when I clone an image?

Correct, the “APP” partition is the root filesystem, and does not include the kernel partition.

Also correct that the “LINUX” entry naming “/boot/Image” causes this to be the kernel loaded (unless security fuses are burned). Your clone includes this kernel.

The Image file is the uncompressed Linux kernel. The partition version would differ only by having a signature (you can have quite different kernels in the partition versus file, but the logical content of being a kernel with signature versus just a kernel still applies). If you flash a clone into a new Jetson (one without security fuses burned), then this should be the kernel booted and preserved from clone through restore.

Ok so then I guess my follow up questions would be:
Say I give someone an image where I cloned the APP partition. They will have an image of our rootfs. In order for them to also have the same kernel changes, I should also give them my /boot/Image and, assuming their extlinux.conf points to it, they will have both my rootfs and kernel?

Is this correct or am I miss interpreting something?

Thank you.

Generally, APP partition will already include the /boot/Image.

It is a complicated story. If you are asking TX2 case, then your “kernel” partition actually has a uboot inside of it.
But if your case is NX, then your “kernel” partition will have a really kernel image.

Both platforms read the kernel image from the rootfs by default. So sharing APP partition image out should be sufficient. The image in partition will only be used when bootloader fails to read kernel from rootfs.

That makes sense. So assuming the we are able to read the kernel from rootfs, cloning the APP partition should suffice. That was very helpful.

Thank you both.

Mostly this works, but I want to add that there is a special case if you use an SD card model of any Jetson. On those the boot content lives in the QSPI memory on the Jetson itself, and this content does support many releases, but does occasionally change. When it changes an APP partition clone won’t fully function using the old QSPI. Some things may go on to attempt to upgrade the QSPI, but mostly, for an SD card model, you would need to flash the Jetson itself in addition to a copy of the SD card clone for a guarantee of working (but if the QSPI is in “version range”, then it would “just work” with such a clone).

eMMC models don’t worry about that per se, but if when flashing a clone you just “reuse” the APP partition clone, then it should always work if the flashing software is from the same release which produced the cloned image to start with. It is still possible to have a cloned eMMC model image which is incompatible with non-rootfs (non-APP) content if you were to just flash the APP partition (one can flash and “reuse” the APP partition, but otherwise do a full flash, or it is possible to only flash the APP partition and leave the rest unchanged…it is a bit like QSPI memory on the SD card model).

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.