How to flash the kernel only?

Hello, I run L4T 32.5.1.

How can I only flash the kernel using flash.sh?

I know I can copy the new kernel in /boot/Image, but sometimes I mess up and cause a kernel panic during boot and I would need to reflash a clean kernel because the board doesnt boot.

I tried : sudo ./flash.sh -k kernel jetson-xavier-nx-devkit-emmc mmcblk0p1
but it doesnt work.

Thanks!

It does not help to flash kernel only if you already corrupted it. Please do full flash.

When I run sudo ./flash.sh -k kernel jetson-xavier-nx-devkit-emmc mmcblk0p1 then the kernel is not changed
(I can still see the logs and the kernel panic I introduced 😅 )

So, do you mean that it’s not possible to reflash only the kernel ? It would be faster to just reflash the kernel, it wastes a lot of time to reflash everything each time I mess up something.

Kernel image is by default read from rootfs, as specified in /boot/extlinux/extlinux.conf.
You can only access rootfs when the kernel still boots up, so it’s a deadlock you want to replace the kernel image when kernel panic happens.
Therefore, please do a full re-flash. Or add a backup image in case the primary one fails.

2 Likes

Can you guide me how to add a backup image, and how to select it?

Thanks!

What exact model do you have? I suspect it is eMMC since you earlier mentioned mmcblk0p1. If that is the case, then it isn’t a dev kit, but involves a third party carrier board (the dev kit Xavier NX would use an SD card to boot, and that SD would be on the module itself, not on the carrier board). Backing things up depends on model, and sometimes on the third party carrier board manufacturer’s software. That’s for backing up the rootfs.

For the kernel itself it is usually simpler, you just don’t overwrite the original and add an alternate boot entry either for the new kernel or for the old kernel. When you ask about backup, make sure to answer exactly what it is you want backed up.

Also, on eMMC models, a full boot log would help. There are conditions whereby the kernel will boot from a partition in eMMC, and other times when the kernel is from “/boot/Image”. A serial console boot log would answer some of those questions.

Hey @linuxdev, and thanks for your answer.
I have a Leopard Imaging board, without a SD card.

I have tried to add a new entry to /boot/extlinux/extlinux.conf like so:

LABEL backup
      MENU LABEL primary kernel
      LINUX /boot/Image.bak
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

But I am not prompted to select the kernel image during the boot, any idea?

You would use serial console to select during boot, but that entry might be wrong. Can you post the full extlinux.conf? You could attach it to the forums.

In serial console you get a very short time in which you can hit any key to stop boot. If you stop it a bit too early, you end up in a boot console, and you can then type “boot” to continue boot. Slightly after that hitting a key again will offer you a chance to enter the number of the boot entry (it’ll show a number along with each MENU LABEL). Do beware that if you hit a key to stop boot you probably need to hit backspace to remove that character before typing in the number of the entry. Removing quiet might make that easier to see? You could just keep hitting any key until it stops from serial console.

In case you need to debug, I also suggest removing the “quiet” token from the APPEND key/value parameter (you could put this back in later if too much debug message gets irritating).

Thanks for your answer, unfortunately we do not have access to serial on our board. Is there any other way ? A GRUB-Like menu at boot perhaps?

Here’s the full extlinux.conf file:

TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      FDT /boot/tegra194-p3668-all-p3509-0000.dtb
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

LABEL backup
      MENU LABEL primary kernel
      LINUX /boot/Image.bak
      FDT /boot/tegra194-p3668-all-p3509-0000.dtb
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

If you stay on rel-32, then no grub like menu to use.

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