Update only kernel image(Image) on TX2

I used below command to update(usb recovery mode) only kernel Image(Image).
sudo ./flash.sh -r -k kernel jetson-tx2 mmcblk0p1

but it looks like update boot.img instead my kernel image
(I’m using L4T 28.2)
And I checked the “FLASH - kernel” section in flash.sh(It specifies the case “${target_partname}” != “”)
I expected uImage but it define localbootfile=boot.img; as target file.

Is it possible to update only kernel image through this script?

Below is printed messages while above command
[ 1.9685 ] Sending bootloader and pre-requisite binaries
[ 1.9691 ] tegrarcm_v2 --download blob blob.bin
[ 1.9696 ] Applet version 01.00.0000
[ 1.9858 ] Sending blob
[ 1.9859 ] […] 100%
[ 2.8361 ]
[ 2.8382 ] tegrarcm_v2 --boot recovery
[ 2.8400 ] Applet version 01.00.0000
[ 2.8594 ]
[ 2.8612 ] tegrarcm_v2 --isapplet
[ 3.5141 ]
[ 3.5162 ] tegradevflash_v2 --iscpubl
[ 3.5180 ] CPU Bootloader is not running on device.
[ 3.5187 ]
[ 4.7747 ] Writing partition
[ 4.7779 ] tegradevflash_v2 --write kernel /home/ywlee/workspace/nvdia_workspace/simple-workspace/Linux_for_Tegra/bootloader/signed/boot_sigheader.img.encrypt
[ 4.7804 ] Bootloader version 01.00.0000
[ 4.7833 ] Writing partition kernel with /home/ywlee/workspace/nvdia_workspace/simple-workspace/Linux_for_Tegra/bootloader/signed/boot_sigheader.img.encrypt
[ 4.7863 ] […] 100%
[ 4.8168 ]
[ 4.8170 ] Coldbooting the device
[ 4.8193 ] tegradevflash_v2 --reboot coldboot
[ 4.8211 ] Bootloader version 01.00.0000

The “-k kernel” would name a partition, but I think what you really want is a file in “/boot” of the rootfs partition (gdisk label “APP”). Is it correct to assume you wanted to do this because the system could not be booted and thus a file copy would not work? If so, then you might boot to a rescue SD card and copy the kernel from there.

If you need to fix the now incorrect “kernel” partition it is possible you will instead want to clone the rootfs, copy the new kernel to the clone, and then flash with “reusing” the rootfs image (which is really a copy of the clone). This would simultaneously fix the “kernel” partition and add the file…plus you could work on it offline and just flash the modification of the clone at any time so long as you stick to that release revision.

Thank you linuxdev.

I have seen the article described as below command for updating kernel & dtb
sudo ./flash.sh -r -k kernel jetson-tx2 mmcblk0p1
sudo ./flash -r -k kernel-dtb jetson-tx2 mmcblk0p1

Yes you are right. I can update it using “scp” or “copy from sdcard”.
I was wondering if I was using the flash.sh script wrongly. Because kernel and kernel-dtb are specified as partition names.
I wonder why these two names are specified in flash.sh. Is this a legacy of the past?

I can’t give you a definitive answer, but keep in mind flash.sh has evolved over decades for Tegra products (I still have some Tegra3 hardware and parts of T30 are present in the TX2 in one form or another), and that the script is a “general use” script even for hardware not even released to the public. I am reminded of Ardbeg…you’ll see references to this in kernel source and many places, and yet so far as I know this was only used internally at NVIDIA. Despite the actual hardware not being out in the wild some subsets (such as USB controllers or GPIO controllers) are often in common among all of the targets (think of it as object-oriented hardware module re-use). You wouldn’t have to specify “jetson-tx2” as a target if flash.sh were just for the Jetsons and some hardware may still use the kernel partition as a kernel (I don’t know exactly what the “kernel” partition is used for with a TX2 on R28.2…I don’t think it is the Linux kernel).

My thought is that the “-k ” unambiguously implies flashing a partition by that label unless there is some sort of hard-coded override from the actual flash program which knows some special handling of that partition target as something other than binary data…and I do not believe flash.sh or executables called have such knowledge. In the days of fastboot everything was in a partition, including the kernel. Some hardware still related to this somewhere probably still uses fastboot (or at least has it available). In the past, when moving from fastboot to U-Boot, the partitions used for fastboot were abandoned, and yet still created and put in place…but any content was inert.

Perhaps someone could add detail to exactly what the R28.2 GPT partition label “kernel” content is under a TX2 and how it is used. What would be more interesting would be to verify if flash.sh has some special non-partition handling when this is the “kernel” partition.

Thank you for your opinion.
Thanks to you, it has become clear that flash.sh is not supporting flash of kernel image.
So now we can update kernel only using scp and sdcard not recovery mode usb.

It isn’t so much that flash.sh doesn’t support kernel flash…the issue is more that the bootloader is looking for a file instead of a partition. flash.sh can flash the partition with the kernel…but this partition includes an entire rootfs and not just the one component.

Something I’ve not done, but have been tempted to do, is to see if I could use a separate “/boot” partition. I have a clone and serial console, so this has never been much of a priority (I simply add extra configurations when I need to test and then pick it at boot time).

What is your use-case for needing to flash the kernel as a partition? Knowing what you wish to accomplish could provide other possible answers, e.g., production environment requirements.

I just want know why described command is not working because it looks really pointing kernel flashing.
sudo ./flash.sh -r -k kernel jetson-tx2 mmcblk0p1

Yes. some SoC uses different partition like “boot” & “rootfs”.(In case of TI Jacinto6, I used sdcard boot alway to copy only kernel image)
So first time, I understood that the flash.sh command means flashing to “boot” partition(memory flashing or fs copy whatever)

We have no fixed use-case and just making our environment and understand it(flash.sh) now.
I just wanted to clarify the functions supported by flash.sh of current version.

hello wooleeyang,

the simplest way to update kernel image (/boot/Image) for TX2 is copy the updated Image to overwrite that and warm-boot the device.
to flashing the kernel partition, bootloader will also update with the “-k kernel” option.
you could also check the flashing message to have more details.

Hi JerryChang.
Did you mean “sudo ./flash.sh -r -k kernel jetson-tx2 mmcblk0p1”?
It updating “boot.img” not “Image”. In flash.sh, I could find “boot.img” as “-k kernel” option.
As I discussed with linuxdev, that option update boot.img not kernel image.
Could you correct us? if we have misunderstanding?

hello wooleeyang,

AFAIK, boot.img contains kernel and ramdisk.
please refer to flash.sh and searching for mkbootimg

Trivia: U-Boot is a kernel…it just isn’t a Linux kernel. The Linux kernel runs “init”, the U-Boot kernel kills itself by self-overwriting with binary data…which happens to be a Linux kernel in this case (from “/boot/Image”). The GPT partition labels aren’t even necessary for operation unless software looks for labels as a mechanism to abstract.

Hello Jerry Chang.
Very strange.
Generated boot.img is only 400kbytes and Image(I expected it is linux kernel image) is 2Mbytes.
I can not understand how boot.img include kernel and ramdisk.