[PATCH v2 01/11] binman: elf: Check for ELF_TOOLS availability and remove extra semicolon

lukas.funke-oss at weidmueller.com lukas.funke-oss at weidmueller.com
Thu Jul 6 10:38:10 CEST 2023


From: Lukas Funke <lukas.funke at weidmueller.com>

Check if elf tools are available when running DecodeElf(). Also
remove superfuous semicolon at line ending.

Signed-off-by: Lukas Funke <lukas.funke at weidmueller.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 tools/binman/elf.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 5816284c32..a53f4b9c4f 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -438,13 +438,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)
-- 
2.30.2



More information about the U-Boot mailing list