Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't reflash agnos update if already flashed #19944

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion selfdrive/hardware/tici/agnos.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ def flash_partition(cloudlog, spinner, target_slot, partition):
cloudlog.info(f"Downloading and writing {partition['name']}")

downloader = StreamingDecompressor(partition['url'])
with open(f"/dev/disk/by-partlabel/{partition['name']}{target_slot}", 'wb') as out:
with open(f"/dev/disk/by-partlabel/{partition['name']}{target_slot}", 'wb+') as out:
partition_size = partition['size']

# Check if partition is already flashed
out.seek(partition_size)
if out.read(64) == partition['hash_raw'].lower().encode():
cloudlog.info(f"Already flashed {partition['name']}")
return

# Clear hash before flashing
out.seek(partition_size)
out.write(b"\x00" * 64)
Expand Down