Skip to content

Commit 167a15e

Browse files
committed
Add intel-ipu-fw-info as a standalone tool
1 parent 9874603 commit 167a15e

10 files changed

Lines changed: 796 additions & 0 deletions

File tree

tools/intel-ipu-fw-info/.gitignore

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
# Python {
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# poetry
99+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100+
# This is especially recommended for binary packages to ensure reproducibility, and is more
101+
# commonly ignored for libraries.
102+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103+
#poetry.lock
104+
105+
# pdm
106+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107+
#pdm.lock
108+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109+
# in version control.
110+
# https://pdm.fming.dev/#use-with-ide
111+
.pdm.toml
112+
113+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
114+
__pypackages__/
115+
116+
# Celery stuff
117+
celerybeat-schedule
118+
celerybeat.pid
119+
120+
# SageMath parsed files
121+
*.sage.py
122+
123+
# Environments
124+
.env
125+
.venv
126+
env/
127+
venv/
128+
ENV/
129+
env.bak/
130+
venv.bak/
131+
132+
# Spyder project settings
133+
.spyderproject
134+
.spyproject
135+
136+
# Rope project settings
137+
.ropeproject
138+
139+
# mkdocs documentation
140+
/site
141+
142+
# mypy
143+
.mypy_cache/
144+
.dmypy.json
145+
dmypy.json
146+
147+
# Pyre type checker
148+
.pyre/
149+
150+
# pytype static type analyzer
151+
.pytype/
152+
153+
# Cython debug symbols
154+
cython_debug/
155+
156+
# PyCharm
157+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159+
# and can be added to the global gitignore or merged into this file. For a more nuclear
160+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161+
#.idea/
162+
# } Python
163+
164+
# Vim {
165+
# Swap
166+
[._]*.s[a-v][a-z]
167+
!*.svg # comment out if you don't need vector files
168+
[._]*.sw[a-p]
169+
[._]s[a-rt-v][a-z]
170+
[._]ss[a-gi-z]
171+
[._]sw[a-p]
172+
173+
# Session
174+
Session.vim
175+
Sessionx.vim
176+
177+
# Temporary
178+
.netrwhist
179+
*~
180+
# Auto-generated tag files
181+
tags
182+
# Persistent undo
183+
[._]*.un~
184+
# } Vim
185+
186+
# JetBrains {
187+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
188+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
189+
190+
# User-specific stuff
191+
.idea/**/workspace.xml
192+
.idea/**/tasks.xml
193+
.idea/**/usage.statistics.xml
194+
.idea/**/dictionaries
195+
.idea/**/shelf
196+
197+
# AWS User-specific
198+
.idea/**/aws.xml
199+
200+
# Generated files
201+
.idea/**/contentModel.xml
202+
203+
# Sensitive or high-churn files
204+
.idea/**/dataSources/
205+
.idea/**/dataSources.ids
206+
.idea/**/dataSources.local.xml
207+
.idea/**/sqlDataSources.xml
208+
.idea/**/dynamic.xml
209+
.idea/**/uiDesigner.xml
210+
.idea/**/dbnavigator.xml
211+
212+
# Gradle
213+
.idea/**/gradle.xml
214+
.idea/**/libraries
215+
216+
# Gradle and Maven with auto-import
217+
# When using Gradle or Maven with auto-import, you should exclude module files,
218+
# since they will be recreated, and may cause churn. Uncomment if using
219+
# auto-import.
220+
# .idea/artifacts
221+
# .idea/compiler.xml
222+
# .idea/jarRepositories.xml
223+
# .idea/modules.xml
224+
# .idea/*.iml
225+
# .idea/modules
226+
# *.iml
227+
# *.ipr
228+
229+
# CMake
230+
cmake-build-*/
231+
232+
# Mongo Explorer plugin
233+
.idea/**/mongoSettings.xml
234+
235+
# File-based project format
236+
*.iws
237+
238+
# IntelliJ
239+
out/
240+
241+
# mpeltonen/sbt-idea plugin
242+
.idea_modules/
243+
244+
# JIRA plugin
245+
atlassian-ide-plugin.xml
246+
247+
# Cursive Clojure plugin
248+
.idea/replstate.xml
249+
250+
# SonarLint plugin
251+
.idea/sonarlint/
252+
253+
# Crashlytics plugin (for Android Studio and IntelliJ)
254+
com_crashlytics_export_strings.xml
255+
crashlytics.properties
256+
crashlytics-build.properties
257+
fabric.properties
258+
259+
# Editor-based Rest Client
260+
.idea/httpRequests
261+
262+
# Android studio 3.1+ serialized cache file
263+
.idea/caches/build_file_checksums.ser
264+
# } JetBrains

tools/intel-ipu-fw-info/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# intel-ipu-fw-info
2+
3+
## Installation
4+
5+
```
6+
pip install --editable .
7+
```
8+
9+
## Usage
10+
11+
```
12+
intel-ipu-fw-info <firmware.bin>
13+
```
14+
15+
See `intel-ipu-fw-info -h` for details
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '1.0.0'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .key import Key
2+
from .parser import get_firmware_info
3+
from .spec import FirmwareInfo
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import argparse
2+
import dataclasses
3+
import json
4+
import os
5+
import pathlib
6+
from typing import BinaryIO
7+
8+
from .parser import ByteEncoder, FirmwareInfo, get_cse, get_firmware_info
9+
from .spec import CSE
10+
11+
12+
def parse_args() -> argparse.Namespace:
13+
parser: argparse.ArgumentParser = argparse.ArgumentParser()
14+
parser.add_argument('--full', action='store_true', help=f'show full info')
15+
parser.add_argument('firmware_path', metavar='<firmware.bin>', type=pathlib.Path, help='path to the firmware')
16+
return parser.parse_args()
17+
18+
19+
def main() -> int:
20+
args: argparse.Namespace = parse_args()
21+
22+
f: BinaryIO
23+
with open(args.firmware_path, 'rb') as f:
24+
firmware: bytes = f.read()
25+
info: FirmwareInfo | CSE = get_cse(firmware) if args.full else get_firmware_info(firmware)
26+
27+
print(json.dumps(dataclasses.asdict(info), indent=2, cls=ByteEncoder))
28+
return os.EX_OK

0 commit comments

Comments
 (0)