diff --git a/meta-lmp-base/recipes-bsp/u-boot/u-boot-ostree-scr-fit/boot-common.cmd.in b/meta-lmp-base/recipes-bsp/u-boot/u-boot-ostree-scr-fit/boot-common.cmd.in index 1e0d8fca1f..c3556d62d9 100644 --- a/meta-lmp-base/recipes-bsp/u-boot/u-boot-ostree-scr-fit/boot-common.cmd.in +++ b/meta-lmp-base/recipes-bsp/u-boot/u-boot-ostree-scr-fit/boot-common.cmd.in @@ -66,6 +66,7 @@ else setenv fiovb.rollback "${rollback}" setenv fiovb.upgrade_available "${upgrade_available}" setenv fiovb.bootupgrade_available "${bootupgrade_available}" + setenv fiovb.bootfirmware_version "${bootfirmware_version}" setenv fiovb.debug "${debug}" fi @@ -97,6 +98,18 @@ if test "${fiovb.debug}" = "1"; then echo "${fio_msg} ###########################################" fi +if test -n "${fiovb_rpmb}"; then + if test "${fiovb.rollback_protection}" = "1"; then + echo "${fio_msg} Anti-rollback protection for boot firmware is enabled" + if test ${fiovb.bootfirmware_version} -gt ${dt_bootfirmware_version}; then + echo "${fio_msg} Error: It's impossible to downgrade to an older firmware, boot is aborted" + echo "${fio_msg} Error: Currently booted firmware: ${dt_bootfirmware_version}, previously booted: ${fiovb.bootfirmware_version} " + sleep 5 + reset + fi + fi +fi + setenv fiovb.old_is_secondary_boot ${fiovb.is_secondary_boot} # Check state of SECONDARY_BOOT bit run check_secondary_boot