Skip to content

Commit

Permalink
fix: fix reserved bytes len and md5 len in compressed image header
Browse files Browse the repository at this point in the history
  • Loading branch information
WangYuxin-esp committed Mar 20, 2023
1 parent bd32f08 commit 6203325
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions tools/cmake_utilities/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v0.4.2 - 2023-03-20

### Bugfix:

* gen_compressed_ota: Fix the number of bytes reserved in the v3 compressed image header
* gen_compressed_ota: Fix definition of MD5 length in compressed image header for different versions.

## v0.4.1 - 2023-03-15

* relinker: add option to use customized configuration files
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake_utilities/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.4.1"
version: "0.4.2"
description: A collection of useful cmake utilities
url: https://github.com/espressif/esp-iot-solution/tree/master/tools/cmake_utilities
issues: https://github.com/espressif/esp-iot-solution/issues
Expand Down
8 changes: 5 additions & 3 deletions tools/cmake_utilities/scripts/gen_custom_ota.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,15 @@ def main():
bin_data += struct.pack('32s', firmware_ver.encode())
else:
# Reserved
bin_data += struct.pack('<I', 0)
bin_data += struct.pack('<I', 0)
bin_data += struct.pack('10s', b'0')
# The length of the compressed data
bin_data += struct.pack('<I', f_len)
print('compressed data len: {}'.format(f_len))
# The MD5 for the compressed data
bin_data += struct.pack('16s', hashlib.md5(data).digest())
if (header_version[header_ver] < 3):
bin_data += struct.pack('32s', hashlib.md5(data).digest())
else:
bin_data += struct.pack('16s', hashlib.md5(data).digest())
# The CRC32 for the header
bin_data += struct.pack('<I', binascii.crc32(bin_data, 0x0))

Expand Down

0 comments on commit 6203325

Please sign in to comment.