From: Tom Rini Date: Wed, 18 Jun 2025 18:16:29 +0000 (-0600) Subject: Merge patch series "bootstd: New bootmeth for RAUC A/B systems" X-Git-Tag: v2025.10-rc1~118^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=009d7722ffd771ac7446b3ee6bae1eb692a0c058;p=thirdparty%2Fu-boot.git Merge patch series "bootstd: New bootmeth for RAUC A/B systems" Martin Schwan says: This series implements a new bootmeth for RAUC A/B systems. RAUC (Robust Auto Update Controller) is a lightweight update client, providing "Safe and Secure OTA Updates for Embedded Linux". See the following links for more information about RAUC: https://rauc.io/ https://rauc.readthedocs.io/en/latest/ PHYTEC uses RAUC in its Yocto based distribution "Ampliphy" as the default way of updating embedded devices based on PHYTEC hardware. So far, the logic selecting the correct partitions and files to boot was being implemented in the U-Boot environment. While this is a straightforward way to do it, adding and supporting new platforms became somewhat tedious and is platform-specific. The introduction of U-Boot's "Standard Boot" provided a convincing alternative, promising a simpler and more portable way of booting, even for RAUC systems. This led me to implement a new bootmeth supporting RAUC A/B systems. Note, that this new bootmeth is not proprietary to PHYTEC products and is designed to work on other hardware with a RAUC A/B system, too. The bootmeth currently only supports symmetric A/B partitioning layouts. E.g. A/rescue is not (yet) supported. The partition indexes and default slot tries can be specified via configuration options. For now, the bootmeth_rauc uses a similar approach for loading the Kernel and device tree as the bootmeth_script, in that it requires a FIT containing a U-Boot script loading the desired distro. It could be possible to support booting without a script and load the Kernel and DT directly with this bootmeth, but I found the script method to be very flexible for now, in letting the distro decide what to load. The bootmeth_rauc was tested on a phyBOARD-Pollux i.MX8M Plus [1] with BSP-Yocto-Ampliphy-i.MX8MP-PD24.1.2 [2]. Supported boot devices are currently only MMC devices, but it should be possible to add SPI flashes in the future. To test this patch stack with PHYTEC's phyBOARD-Pollux i.MX8M Plus board, you need to adjust the boot files to include the boot.scr.uimg containing the distro's boot script and set "optargs" to "${raucargs}" in it. Also disable any legacyboot in the U-Boot environment and simply boot with Standard Boot: bootmeth order rauc bootflow scan -lb [1]: https://www.phytec.eu/en/produkte/single-board-computer/phyboard-pollux/ [2]: https://download.phytec.de/Software/Linux/BSP-Yocto-i.MX8MP/BSP-Yocto-Ampliphy-i.MX8MP-PD24.1.2/ Link: https://lore.kernel.org/r/20250604-wip-bootmeth-rauc-v3-0-f9fad913c57e@phytec.de [trini: Don't enable by default] --- 009d7722ffd771ac7446b3ee6bae1eb692a0c058 diff --cc boot/Kconfig index 30eb5b328d7,a610cf9faf9..f5dfae28f08 --- a/boot/Kconfig +++ b/boot/Kconfig @@@ -855,6 -855,57 +855,56 @@@ config EXP The expo can be presented in graphics form using a vidconsole, or in text form on a serial console. + config BOOTMETH_RAUC + bool "Bootdev support for RAUC A/B systems" - default y if BOOTSTD_FULL + depends on CMDLINE + select BOOTMETH_GLOBAL + select HUSH_PARSER + help + Enables support for booting RAUC A/B systems from MMC devices. This + makes the bootdevs look for a 'boot.scr.uimg' or 'boot.scr' in the + respective boot partitions, describing how to boot the distro. + + if BOOTMETH_RAUC + + config BOOTMETH_RAUC_BOOT_ORDER + string "RAUC boot order" + default "A B" + help + Sets the default boot order. This must be list of space-separated + strings naming the individual boot slots. Each entry in this string + should correspond to an existing slot on the target's flash device. + + config BOOTMETH_RAUC_PARTITIONS + string "RAUC boot and root partitions indexes" + default "1,2 3,4" + help + Sets the partition indexes of boot and root slots. This must be a list + of comma-separated pair values, which in turn are separated by spaces. + The first value in pair is for the boot partition and second for the + root partition. + + config BOOTMETH_RAUC_DEFAULT_TRIES + int "RAUC slot default tries" + default 3 + help + Sets how many times a slot should be tried booting, before considering + it to be bad. + + config BOOTMETH_RAUC_RESET_ALL_ZERO_TRIES + bool "Reset slot tries when all RAUC slots have zero tries left" + default y + help + When all slots have zero tries left or no valid slot was found, reset + to the default boot order set by BOOTMETH_RAUC_BOOT_ORDER and set the + slot tries to their default value specified by + BOOTMETH_RAUC_DEFAULT_TRIES. + + This prevents a system from remaining in an unbootable state, after + all slot tries were decremented to zero. + + endif # BOOTMETH_RAUC + config BOOTMETH_SANDBOX def_bool y depends on SANDBOX