Skip to content

Commit 9aa68d7

Browse files
committed
Update FW blobs version too
Without this version field becomes useless, this is handy in quickly identifying blobs using human readable versions. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 787eea1 commit 9aa68d7

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

scripts/update_blobs.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,33 @@
2626
)
2727

2828

29+
def parse_version_from_binary(binary_data: bytes) -> str:
30+
"""
31+
Parse version from firmware binary.
32+
Version is stored at bytes 8-12, e.g., 02 0e 02 01 -> 1.2.14.2
33+
"""
34+
if len(binary_data) < 12:
35+
logger.warning("Binary too short to extract version, using default")
36+
return "1.0.0"
37+
38+
# Extract version bytes (positions 8-12)
39+
version_bytes = binary_data[8:12]
40+
41+
# Convert to version string: 02 0e 02 01 -> 1.2.14.2
42+
version_parts = []
43+
for byte in version_bytes:
44+
version_parts.append(str(byte))
45+
46+
version = ".".join(version_parts)
47+
logger.debug(f"Extracted version from binary: {version}")
48+
return version
49+
50+
2951
def get_wifi_blob_info(name: str) -> BlobInfo:
3052
return BlobInfo(
3153
name,
3254
f"nRF70 Wi-Fi firmware for {name} mode",
33-
"1.0.0",
55+
"1.0.0", # This will be overridden by actual binary parsing
3456
f"nrf_wifi/bin/zephyr/{name}/{WIFI_FW_BIN_NAME}",
3557
f"wifi_fw_bins/{name}/{WIFI_FW_BIN_NAME}",
3658
f"nrf_wifi/doc",
@@ -73,9 +95,19 @@ def render_template(template_path: str, output_path: str, latest_sha: str) -> No
7395
blob_info["version"] = blob.version
7496
blob_info["url"] = f"{nrfxlib_url}/{blob.rpath}"
7597
blob_info["doc_url"] = f"{nrfxlib_url}/{blob.docpath}"
76-
blob_info["sha256"] = compute_sha256(blob_info["url"])
98+
99+
# Download the binary to compute SHA-256 and extract version
100+
response = requests.get(blob_info["url"])
101+
response.raise_for_status()
102+
binary_data = response.content
103+
104+
blob_info["sha256"] = hashlib.sha256(binary_data).hexdigest()
77105
blob_info["description"] = blob.description
78-
blobs[blob] = blob_info
106+
107+
# Parse version from the actual binary
108+
blob_info["version"] = parse_version_from_binary(binary_data)
109+
110+
blobs[blob.name] = blob_info
79111

80112
logger.debug(blobs)
81113
# Render the template with the provided context

zephyr/module.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ blobs:
88
- path: wifi_fw_bins/default/nrf70.bin
99
sha256: 3ea889857d1590ff8c2ef4e3bfb3606acb8d1c2f845a09581ad27c7ec7b4e306
1010
type: img
11-
version: '1.0.0'
11+
version: '2.14.2.1'
1212
license-path: ./LICENSE.txt
1313
url: https://github.com/nrfconnect/sdk-nrfxlib/raw/0e6ff4c030bbebdee9d7595914a7378a70b966b7/nrf_wifi/bin/zephyr/default/nrf70.bin
1414
description: nRF70 Wi-Fi firmware for default mode
@@ -17,7 +17,7 @@ blobs:
1717
- path: wifi_fw_bins/scan_only/nrf70.bin
1818
sha256: 57a2688478ef45896bd0975d57fee4e67cd6024cdcebc9993cf6607c9f24bfb4
1919
type: img
20-
version: '1.0.0'
20+
version: '2.14.2.1'
2121
license-path: ./LICENSE.txt
2222
url: https://github.com/nrfconnect/sdk-nrfxlib/raw/0e6ff4c030bbebdee9d7595914a7378a70b966b7/nrf_wifi/bin/zephyr/scan_only/nrf70.bin
2323
description: nRF70 Wi-Fi firmware for scan_only mode
@@ -26,7 +26,7 @@ blobs:
2626
- path: wifi_fw_bins/radio_test/nrf70.bin
2727
sha256: 259a91e13f6f9fdc08bc892e4db398fbe3b982413dce34e74be825e8b5b4444d
2828
type: img
29-
version: '1.0.0'
29+
version: '2.14.2.1'
3030
license-path: ./LICENSE.txt
3131
url: https://github.com/nrfconnect/sdk-nrfxlib/raw/0e6ff4c030bbebdee9d7595914a7378a70b966b7/nrf_wifi/bin/zephyr/radio_test/nrf70.bin
3232
description: nRF70 Wi-Fi firmware for radio_test mode
@@ -35,7 +35,7 @@ blobs:
3535
- path: wifi_fw_bins/system_with_raw/nrf70.bin
3636
sha256: 6de4300d0ebdaa910e2e9d92defc5e656825f9b2eddfdfc2c3d2b259e2c22053
3737
type: img
38-
version: '1.0.0'
38+
version: '2.14.2.1'
3939
license-path: ./LICENSE.txt
4040
url: https://github.com/nrfconnect/sdk-nrfxlib/raw/0e6ff4c030bbebdee9d7595914a7378a70b966b7/nrf_wifi/bin/zephyr/system_with_raw/nrf70.bin
4141
description: nRF70 Wi-Fi firmware for system_with_raw mode
@@ -44,7 +44,7 @@ blobs:
4444
- path: wifi_fw_bins/offloaded_raw_tx/nrf70.bin
4545
sha256: 2a42e24eef2ff5096edfa37e57f2340ac152ee89780fa3bf1f598a4c8460e0f7
4646
type: img
47-
version: '1.0.0'
47+
version: '2.14.2.1'
4848
license-path: ./LICENSE.txt
4949
url: https://github.com/nrfconnect/sdk-nrfxlib/raw/0e6ff4c030bbebdee9d7595914a7378a70b966b7/nrf_wifi/bin/zephyr/offloaded_raw_tx/nrf70.bin
5050
description: nRF70 Wi-Fi firmware for offloaded_raw_tx mode

0 commit comments

Comments
 (0)