@@ -115,11 +115,10 @@ class ImageSegment(object):
115115 """Wrapper class for a segment in an ESP image
116116 (very similar to a section in an ELFImage also)"""
117117
118- def __init__ (self , addr , data , file_offs = None , flags = 0 ):
118+ def __init__ (self , addr , data , file_offs = None ):
119119 self .addr = addr
120120 self .data = data
121121 self .file_offs = file_offs
122- self .flags = flags
123122 self .include_in_checksum = True
124123 if self .addr != 0 :
125124 self .pad_to_alignment (
@@ -168,8 +167,8 @@ class ELFSection(ImageSegment):
168167 """Wrapper class for a section in an ELF image, has a section
169168 name as well as the common properties of an ImageSegment."""
170169
171- def __init__ (self , name , addr , data , flags ):
172- super (ELFSection , self ).__init__ (addr , data , flags = flags )
170+ def __init__ (self , name , addr , data ):
171+ super (ELFSection , self ).__init__ (addr , data )
173172 self .name = name .decode ("utf-8" )
174173
175174 def __repr__ (self ):
@@ -179,9 +178,6 @@ def __repr__(self):
179178class BaseFirmwareImage (object ):
180179 SEG_HEADER_LEN = 8
181180 SHA256_DIGEST_LEN = 32
182- ELF_FLAG_WRITE = 0x1
183- ELF_FLAG_READ = 0x2
184- ELF_FLAG_EXEC = 0x4
185181
186182 """ Base class with common firmware image functions """
187183
@@ -377,8 +373,6 @@ def merge_adjacent_segments(self):
377373 elem .get_memory_type (self ) == next_elem .get_memory_type (self ),
378374 elem .include_in_checksum == next_elem .include_in_checksum ,
379375 next_elem .addr == elem .addr + len (elem .data ),
380- next_elem .flags & self .ELF_FLAG_EXEC
381- == elem .flags & self .ELF_FLAG_EXEC ,
382376 )
383377 ):
384378 # Merge any segment that ends where the next one starts,
@@ -1285,7 +1279,7 @@ def read_section_header(offs):
12851279 name_offs , sec_type , _flags , lma , sec_offs , size = struct .unpack_from (
12861280 "<LLLLLL" , section_header [offs :]
12871281 )
1288- return (name_offs , sec_type , lma , size , sec_offs , _flags )
1282+ return (name_offs , sec_type , lma , size , sec_offs )
12891283
12901284 all_sections = [read_section_header (offs ) for offs in section_header_offsets ]
12911285 prog_sections = [s for s in all_sections if s [1 ] in ELFFile .PROG_SEC_TYPES ]
@@ -1294,7 +1288,7 @@ def read_section_header(offs):
12941288 # search for the string table section
12951289 if (shstrndx * self .LEN_SEC_HEADER ) not in section_header_offsets :
12961290 raise FatalError ("ELF file has no STRTAB section at shstrndx %d" % shstrndx )
1297- _ , sec_type , _ , sec_size , sec_offs , _ = read_section_header (
1291+ _ , sec_type , _ , sec_size , sec_offs = read_section_header (
12981292 shstrndx * self .LEN_SEC_HEADER
12991293 )
13001294 if sec_type != ELFFile .SEC_TYPE_STRTAB :
@@ -1316,14 +1310,14 @@ def read_data(offs, size):
13161310 return f .read (size )
13171311
13181312 prog_sections = [
1319- ELFSection (lookup_string (n_offs ), lma , read_data (offs , size ), flags = _flags )
1320- for (n_offs , _type , lma , size , offs , _flags ) in prog_sections
1313+ ELFSection (lookup_string (n_offs ), lma , read_data (offs , size ))
1314+ for (n_offs , _type , lma , size , offs ) in prog_sections
13211315 if lma != 0 and size > 0
13221316 ]
13231317 self .sections = prog_sections
13241318 self .nobits_sections = [
1325- ELFSection (lookup_string (n_offs ), lma , b"" , flags = _flags )
1326- for (n_offs , _type , lma , size , offs , _flags ) in nobits_secitons
1319+ ELFSection (lookup_string (n_offs ), lma , b"" )
1320+ for (n_offs , _type , lma , size , offs ) in nobits_secitons
13271321 if lma != 0 and size > 0
13281322 ]
13291323
@@ -1356,7 +1350,7 @@ def read_segment_header(offs):
13561350 _flags ,
13571351 _align ,
13581352 ) = struct .unpack_from ("<LLLLLLLL" , segment_header [offs :])
1359- return (seg_type , lma , size , seg_offs , _flags )
1353+ return (seg_type , lma , size , seg_offs )
13601354
13611355 all_segments = [read_segment_header (offs ) for offs in segment_header_offsets ]
13621356 prog_segments = [s for s in all_segments if s [0 ] == ELFFile .SEG_TYPE_LOAD ]
@@ -1366,8 +1360,8 @@ def read_data(offs, size):
13661360 return f .read (size )
13671361
13681362 prog_segments = [
1369- ELFSection (b"PHDR" , lma , read_data (offs , size ), flags = _flags )
1370- for (_type , lma , size , offs , _flags ) in prog_segments
1363+ ELFSection (b"PHDR" , lma , read_data (offs , size ))
1364+ for (_type , lma , size , offs ) in prog_segments
13711365 if lma != 0 and size > 0
13721366 ]
13731367 self .segments = prog_segments
0 commit comments