From 3c5fea742ea2a40a93f0cdcaf8e3caa51dbc99cb Mon Sep 17 00:00:00 2001 From: Bodong Yang <86948717+Bodong-Yang@users.noreply.github.com> Date: Thu, 16 May 2024 00:37:14 +0900 Subject: [PATCH] fix(jetson-cboot): save firmware version file to standby slot (#303) This PR fixes jetson-cboot post-update that not saving firmware version file to standby slot. This might result in firmware version control not working as expected as standby slot's firmware version file is missing after every OTA. --- otaclient/app/boot_control/_jetson_cboot.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/otaclient/app/boot_control/_jetson_cboot.py b/otaclient/app/boot_control/_jetson_cboot.py index 35fbe9cfe..4d9eb98b9 100644 --- a/otaclient/app/boot_control/_jetson_cboot.py +++ b/otaclient/app/boot_control/_jetson_cboot.py @@ -427,7 +427,7 @@ def _nv_firmware_update(self) -> Optional[bool]: new_bsp_v = parse_bsp_version(_new_bsp_v_fpath.read_text()) except Exception as e: logger.warning(f"failed to detect new image's BSP version: {e!r}") - logger.info("skip firmware update due to new image BSP version unknown") + logger.warning("skip firmware update due to new image BSP version unknown") return logger.info(f"BUP package version: {new_bsp_v=}") @@ -481,7 +481,6 @@ def _nv_firmware_update(self) -> Optional[bool]: standby_bootloader_slot, new_bsp_v ) return True - logger.info("no firmware payload BUP available, skip firmware update") # APIs @@ -529,14 +528,17 @@ def post_update(self) -> Generator[None, None, None]: ) # ------ firmware update ------ # - _fw_update_result = self._nv_firmware_update() - if _fw_update_result: - # update the firmware_bsp_version file on firmware update applied - self._firmware_ver_control.write_standby_firmware_bsp_version() + firmware_update_result = self._nv_firmware_update() + if firmware_update_result: self._firmware_ver_control.write_current_firmware_bsp_version() - elif _fw_update_result is not None: + elif firmware_update_result is None: + logger.info("no firmware update occurs") + else: raise JetsonCBootContrlError("firmware update failed") + # ------ preserve BSP version files to standby slot ------ # + self._firmware_ver_control.write_standby_firmware_bsp_version() + # ------ preserve /boot/ota folder to standby rootfs ------ # preserve_ota_config_files_to_standby( active_slot_ota_dirpath=self._mp_control.active_slot_mount_point @@ -548,6 +550,7 @@ def post_update(self) -> Generator[None, None, None]: ) # ------ for external rootfs, preserve /boot folder to internal ------ # + # NOTE: the copy must happen AFTER all the changes to active slot's /boot done. if self._cboot_control._external_rootfs: logger.info( "rootfs on external storage enabled: "