commontorizon / meta-common-torizon

Fork of the TorizonCore OpenEmbedded Distro Layer to create Common TorizonCore
MIT License
9 stars 8 forks source link

Add OTA rollback capabilities for x86 #19

Closed EdTheBearded closed 6 months ago

EdTheBearded commented 6 months ago

Extending ostree-grub-generator script, so that it also checks under '/etc/ostree.d' for bootloader logic to append to grub.cfg script.

Also create the '/etc/ostree.d' folder in order to store the files to be appended.

Added regexp module to grub, to create some variable increment functions since there's no math in Grub.

Added grub-ota-fallback recipe that uses the OSTree change that enables to add custom logic to grub.cfg. It adds the '99_fallback_logic' to '/etc/ostree.d', so after an update, if it goes wrong, grub can perform a fallback.

Added the 'grubenv-create' service, a oneshot service that the idea is to only run in the first boot ever, since it check the BOOT partition for the grubenv environment file, and if it's not present, it will create one with the variables used during fallback with their default values.

Added an entry into fstab, so that the BOOT partition is mounted and ready for both Greenboot and grubenv-create.service to operate on Grub environment file.

And also adds 2 aliases for 'grubenv-edit' tool, for 'fw_printenv' and 'fw_setenv', so that both Aktualizr and Greenboot become compatible with Grub.

microhobby commented 6 months ago

@EdTheBearded there is a detail for qemux86-64:

at https://github.com/commontorizon/meta-common-torizon/blob/3d64396ad4635cc57cb7dc6a210548d02a48cba2/recipes-sota/config/aktualizr-default-sec.bb#L17

should be added also:

RDEPENDS:${PN}:remove:qemux86-64 = "u-boot-fw-utils"

Because now we are trying to also add fw_printenv and fw_setenv that will be conflict with the ones from u-boot-fw-utils.

EdTheBearded commented 6 months ago

@microhobby nice point! just submitted a new commit removing u-boot-fw-utils.

microhobby commented 6 months ago

LGTM! Thanks for the contribution @EdTheBearded !