cancel
Showing results for 
Search instead for 
Did you mean: 

How to Implement A/B partition with STM32MP2?

YunEn0623
Visitor

 

Hi erveryone,

I want to implement A/B partitioning functionality, not for updates, but to enable switching to an alternative ROOTFS partition if U-Boot fails to start the kernel. For example, if partition A fails to boot three times, switch to partition B and attempt to boot three times as well. Additionally, incorporate a watchdog to check for timeouts, and if all attempts fail, report an error.

Currently, I have modified the contents of meta-st/meta-st-stm32mp/conf/machine/include, specifically st-machine-image-partition-stm32mp.inc and st-machine-extlinux-config-stm32mp.inc, and in the .tsv file, I can generate two partitions, rootfs_A and rootfs_B, and boot the kernel using rootfs_A.

 

I have found some relevant information that mentions enabling CONFIG_BOOTCOUNT_ENV and CONFIG_BOOTCOUNT_LIMIT in U-Boot's configuration. I have set these in my menuconfig, but I am unsure how to use them or where to modify. I have only found that /drivers/bootcount/bootcount_env.c seems to have what I need, but I don’t know how to implement it.

螢幕擷取畫面 2024-08-30 203846.png

 

It also seems possible to use fw_printenv and fw_setenv for userspace operations, but I would prefer to implement this directly within U-Boot. Does anyone know of any methods for achieving this?

 

0 REPLIES 0