diff --git a/otaclient/app/boot_control/_jetson_uefi.py b/otaclient/app/boot_control/_jetson_uefi.py index f16c685ee..628e1d21a 100644 --- a/otaclient/app/boot_control/_jetson_uefi.py +++ b/otaclient/app/boot_control/_jetson_uefi.py @@ -151,7 +151,7 @@ def _ensure_efivarfs_mounted(cls) -> None: ) from e def _prepare_payload(self) -> None: - """Copy the Capsule update payload to the specified location.""" + """Copy the Capsule update payloads to specific location at esp partition.""" try: CMDHelperFuncs.mount_rw(self.esp_part, self.esp_mp) except Exception as e: @@ -159,17 +159,22 @@ def _prepare_payload(self) -> None: logger.error(_err_msg) raise JetsonUEFIBootControlError(_err_msg) from e - capsule_payload_location = Path(self.esp_mp) / boot_cfg.CAPSULE_PAYLOAD_LOCATION - try: - for capsule_fname in boot_cfg.FIRMWARE_LIST: - capsule_payload_fpath = self.standby_slot_mp / capsule_fname - shutil.copy(capsule_payload_fpath, capsule_payload_location) - except Exception as e: - _err_msg = f"failed to copy update Capsule from {capsule_payload_fpath} to {capsule_payload_location}: {e!r}" - logger.error(_err_msg) - raise JetsonUEFIBootControlError(_err_msg) from e - finally: - CMDHelperFuncs.umount(self.esp_mp, raise_exception=False) + capsule_at_esp = Path(self.esp_mp) / boot_cfg.CAPSULE_PAYLOAD_AT_ESP + capsule_at_standby_slot = self.standby_slot_mp / Path( + boot_cfg.CAPSULE_PAYLOAD_AT_ROOTFS + ).relative_to("/") + for capsule_fname in boot_cfg.FIRMWARE_LIST: + try: + shutil.copy( + src=capsule_at_standby_slot / capsule_fname, + dst=capsule_at_esp / capsule_fname, + ) + except Exception as e: + logger.warning( + f"failed to copy {capsule_fname} from {capsule_at_standby_slot} to {capsule_at_esp}: {e!r}" + ) + logger.warning(f"skip {capsule_fname}") + CMDHelperFuncs.umount(self.esp_mp, raise_exception=False) def _write_efivar(self) -> None: """Write magic efivar to trigger firmware Capsule update in next boot. diff --git a/otaclient/app/boot_control/configs.py b/otaclient/app/boot_control/configs.py index 373afe45c..1b20f4eda 100644 --- a/otaclient/app/boot_control/configs.py +++ b/otaclient/app/boot_control/configs.py @@ -69,7 +69,8 @@ class JetsonUEFIBootControlConfig(JetsonBootCommon): EFIVARS_DPATH = "/sys/firmware/efi/efivars/" UPDATE_TRIGGER_EFIVAR = "OsIndications-8be4df61-93ca-11d2-aa0d-00e098032b8c" MAGIC_BYTES = b"\x07\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00" - CAPSULE_PAYLOAD_LOCATION = "EFI/UpdateCapsule" + CAPSULE_PAYLOAD_AT_ESP = "EFI/UpdateCapsule" + CAPSULE_PAYLOAD_AT_ROOTFS = "/opt/ota_package/" @dataclass