From: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>,
Alper Nebi Yasak <alpernebiyasak@gmail.com>,
Tom Rini <trini@konsulko.com>,
Neha Malcom Francis <n-francis@ti.com>,
Dmitrii Sharshakov <d3dx12.xx@gmail.com>
Subject: [PATCH v2] binman: elf: Check for ELF_TOOLS availability in is_valid
Date: Fri, 09 Jan 2026 23:03:28 +0100 [thread overview]
Message-ID: <20260109-pyelftools-warning-v2-1-e27784f14c56@gmail.com> (raw)
Check if elftools package is available before running DecodeElf().
This clarifies the error message.
Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
---
Make the error more informative and indicative of environment issue and
not a code one
---
Changes in v2:
- Reword the commit message as suggested by reviewers
- Link to v1: https://lore.kernel.org/r/20260109-pyelftools-warning-v1-1-1a4965609b55@gmail.com
---
tools/binman/elf.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 6ac960e0419..899c84ad36d 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -570,6 +570,8 @@ def is_valid(data):
Returns:
bool: True if a valid Elf file, False if not
"""
+ if not ELF_TOOLS:
+ raise ValueError("Python: No module named 'elftools'")
try:
DecodeElf(data, 0)
return True
---
base-commit: 1bcb2fe324180d0a8cfbdb0511737eba1d5b8550
change-id: 20260109-pyelftools-warning-6df5f57ca5b8
Best regards,
--
Dmitrii Sharshakov <d3dx12.xx@gmail.com>
next reply other threads:[~2026-01-09 22:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 22:03 Dmitrii Sharshakov [this message]
2026-01-09 22:31 ` [PATCH v2] binman: elf: Check for ELF_TOOLS availability in is_valid Tom Rini
2026-01-20 15:47 ` [PATCH v3] " Tom Rini
2026-01-20 17:36 ` Quentin Schulz
2026-01-20 17:55 ` Tom Rini
2026-01-20 18:15 ` Quentin Schulz
2026-01-20 18:22 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260109-pyelftools-warning-v2-1-e27784f14c56@gmail.com \
--to=d3dx12.xx@gmail.com \
--cc=alpernebiyasak@gmail.com \
--cc=n-francis@ti.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox