# Can't switch kernel image in A\_kernel partition

**URL:** <https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750>\
**Category:** Jetson AGX Orin\
**Tags:** kernel\
**Created:** [March 28, 2024, 12:03pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750 "2024-03-28T12:03:16Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [March 28, 2024, 12:03pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/1 "2024-03-28T12:03:16Z")

</div>

Hi,  
I’m using JP5.1.3.  
I configured and built a kernel image and backed it up (I copied the Linux\_for\_Tegra/kernel/Image to a separate folder)

Now I wish to flash my A\_kernel partition with that Image backup.  
I used the following command:

> sudo ROOTFS\_AB=1 ROOTFS\_RETRY\_COUNT\_MAX=1 ./flash.sh -c ./bootloader/t186ref/cfg/flash\_t234\_qspi\_sdmmc\_rootfs\_ab.xml -k A\_kernel -K /home/bsp/Desktop/Images/Image\_A jetson-agx-orin-devkit mmcblk0p1

During the flash process I see it prints for generating a new boot.img and from the flash.sh I know the boot.img contains the kernel image.

When booting up my target I see that for some reason its not using that kernel image (I removed some modules to be able to check the differences between two distinct kernel images)

What am I doing wrong?  
From my understanding I can configure and create two separate kernel images , flash each of them into the appropriate partition (A\_kernel and B\_kernel) and then use them seperatly accroding to the active slot.

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 1, 2024, 2:04am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/3 "2024-04-01T02:04:59Z")

</div>

L4T by default loads kernel image from rootfs, as specified in `/boot/extlinux/extlinux.conf`, not the dedicated partition.  
Refer to the document to make it boot from parititions:  
[https://docs.nvidia.com/jetson/archives/r35.5.0/DeveloperGuide/SD/Bootloader/UEFI.html#boot-mode-selection](https://docs.nvidia.com/jetson/archives/r35.5.0/DeveloperGuide/SD/Bootloader/UEFI.html#boot-mode-selection)

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 1, 2024, 9:56am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/4 "2024-04-01T09:56:32Z")

</div>

Thank you for your answer.  
Can you please briefly elaborate on the following questions:

1. If I choose to use GRUB, then UEFI will load GRUB and it will load kernel?
2. You said L4T loads kernel. L4T is bootloader? I thought UEFI loads the kernel.
3. why I need 3 kernel images? (filesystem + partition + recovery) is there any specific good reason for that?
4. Is there a specific scenario in which the system automatically loads the recovery kernel?

Thanks

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 1, 2024, 10:10am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/5 "2024-04-01T10:10:54Z")

</div>

1. YES
2. I just mean the whole L4T BSP. You are right that it’s UEFI that loads the kernel.
3. By default it uses the rootfs file, and fall backs to partition in case the former one does not work. The recovery kernel is used in scenarios like OTA and when your rootfs is dead and cannot boot.
4. If you don’t have ROOTFS AB enabled, and the device fails to boot for three consecutive times, it will switch to the recovery kernel.

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 1, 2024, 12:54pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/6 "2024-04-01T12:54:11Z")

</div>

Hi,  
I encounter the following problem:

If I copy my custom kernel image to:

1. L4T/kernel/Image
2. L4T/rootfs/boot/Image

and than use one of the following commands to flash:

> sudo ROOTFS\_AB=1 ROOTFS\_RETRY\_COUNT\_MAX=1 ./flash.sh -c ./bootloader/t186ref/cfg/flash\_t234\_qspi\_sdmmc\_rootfs\_ab.xml -k APP jetson-agx-orin-devkit mmcblk0p1

or

> sudo ROOTFS\_AB=1 ROOTFS\_RETRY\_COUNT\_MAX=1 ./flash.sh -c ./bootloader/t186ref/cfg/flash\_t234\_qspi\_sdmmc\_rootfs\_ab.xml -k APP\_b jetson-agx-orin-devkit mmcblk0p1

then for some reason I don’t see the custom kernel image in any of the slots (the system use other image)

BUT

If I copy the custom kernel image into the target and manually change it with /boot/Image I can see the difference after reboot.

Any idea why this happens?

(I didn’t modified the L4T options so it loads the kernel from the rootfs as you stated)

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 1, 2024, 1:53pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/7 "2024-04-01T13:53:07Z")

</div>

Then does it work if you don’t enable ROOTFS\_AB or you don’t specify the APP/APP\_b partition?

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 1, 2024, 1:58pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/8 "2024-04-01T13:58:13Z")

</div>

I didn’t tried since my goal is to use different kernel image on each slot.

you want me to try some steps and post here?

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 1, 2024, 2:47pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/9 "2024-04-01T14:47:31Z")

</div>

YES. Let’s do some experiment and see how it goes.  
Please also check `/boot/extlinux/extlinux.conf` in each slot.

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 2, 2024, 10:11am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/10 "2024-04-02T10:11:19Z")

</div>

What exactly you want me to do and which logs to post?

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 2, 2024, 10:23am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/11 "2024-04-02T10:23:41Z")

</div>

> [@DaveYYY](#):
>
> Then does it work if you don’t enable ROOTFS\_AB or you don’t specify the APP/APP\_b partition?

This one.

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 2, 2024, 10:28am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/12 "2024-04-02T10:28:16Z")

</div>

> [@bsp\_dev](#):
>
> I didn’t tried since my goal is to use different kernel image on each slot.

I don’t think this is possible in the flashing stage.  
You can only achieve this by manual replacing the kernel image after flashing.

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 3, 2024, 7:13am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/13 "2024-04-03T07:13:54Z")

</div>

So the solution is:

1. Flash with A/B Enabled
2. Manually replace kernel in whatever partition I want
3. Backup A/B RootFS into system.img
4. Reuse the backup system.img in future flash and it will contain the replaced kernel?

---

<div class="post-metadata">

**Author:** ![DaveYYY](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/daveyyy/32/233244_2.png) [@DaveYYY](https://forums.developer.nvidia.com/u/DaveYYY)\
**Post date:** [April 3, 2024, 7:30am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/14 "2024-04-03T07:30:57Z")

</div>

Sure, and you need to note that you don’t generate the image again when flashing, so the backup one is not replaced.

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 3, 2024, 8:04am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/15 "2024-04-03T08:04:41Z")

</div>

I’ll try and update here that everything works as expected

---

<div class="post-metadata">

**Author:** ![bsp\_dev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@bsp\_dev](https://forums.developer.nvidia.com/u/bsp_dev)\
**Post date:** [April 3, 2024, 4:02pm UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/16 "2024-04-03T16:02:14Z")

</div>

I confirm it works. I couldn’t modify the APP APP\_b partitions sizes but I try to do it in the following thread:

> [@Modify APP and APP\_b partitions sizes](https://forums.developer.nvidia.com/t/modify-app-and-app-b-partitions-sizes/288072/15):
>
> mmcblk0, not mmcblk0p1.

I’ll update there.

Thanks/

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [April 24, 2024, 3:15am UTC](https://forums.developer.nvidia.com/t/cant-switch-kernel-image-in-a-kernel-partition/287750/18 "2024-04-24T03:15:29Z")

</div>

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