If your platform is already configured to use uboot as a bootloader, it might
be easier to use the custom bootloader, see
example proposed.
Definition
The proposed boot routine runs a uboot script at boot time, and counts the amount of time a partition has been attempted. This boot-related information is then stored on the first partition detected by uboot (typically a boot partition). Here is an extract of the main function executed by the Thistle-U-Boot boot script. The full source of the script is also available. We can see that targeted partition is attempted 3 times before falling back to the default partition.Implementation
The Thistle-U-Boot script requires to have a uboot-compliant system, and two equally-sized partitions available for installing the coming rootfs updates. A boot partition is also required to store the information related to the boot sequence. If your system is using a simple partition table with a FAT32 boot partition and two subsequent root partitions, you can use the precompiled scripts provided below. Note that these scripts are platform and boot-partition filesystem dependent. If your partition table is different, integration work is probably required around our boot script, so that you specify your boot commands as well as kernel parameters, etc… Once modifications are performed, uboot requires that bootscripts are compiled with theirmkimage
tool.
boot.scr
.
Interaction with the update client
Once executed, the bootscript will create a file on the boot partition to keep count of the booted partitions. The Thistle Update Client when configured withThistle-U-Boot
as a bootloader will then be able to operate on this file to control the behavior of the bootloader. This file will also be used to trigger boot-partition swap upon rootfs updates.
If your system uses OverlayFS, you can use the configuration field
determine_boot_part_script to help with detection. See the configuration page
for more information.