summaryrefslogtreecommitdiff
path: root/tools/binman/elf.py
diff options
context:
space:
mode:
authorLukas Funke <lukas.funke@weidmueller.com>2023-07-18 13:53:09 +0200
committerSimon Glass <sjg@chromium.org>2023-08-02 07:51:09 -0600
commit43176ed86d9f120efb3e86084d83a714bf076d29 (patch)
treea26d06fdaf2d4cc5ec1633ab583e594476f1d6a5 /tools/binman/elf.py
parent7755b2200777f72dca87dd169138e95f011bbcb9 (diff)
binman: elf: Check for ELF_TOOLS availability and remove extra semicolon
Check if elf tools are available when running DecodeElf(). Also remove superfuous semicolon at line ending. Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Revert part of patch to make binman test pass Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/elf.py')
-rw-r--r--tools/binman/elf.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 4219001feac..2ecc95f7eb8 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -447,13 +447,15 @@ def DecodeElf(data, location):
Returns:
ElfInfo object containing information about the decoded ELF file
"""
+ if not ELF_TOOLS:
+ raise ValueError("Python: No module named 'elftools'")
file_size = len(data)
with io.BytesIO(data) as fd:
elf = ELFFile(fd)
- data_start = 0xffffffff;
- data_end = 0;
- mem_end = 0;
- virt_to_phys = 0;
+ data_start = 0xffffffff
+ data_end = 0
+ mem_end = 0
+ virt_to_phys = 0
for i in range(elf.num_segments()):
segment = elf.get_segment(i)