summaryrefslogtreecommitdiff
path: root/tools/binman/etype
diff options
context:
space:
mode:
Diffstat (limited to 'tools/binman/etype')
-rw-r--r--tools/binman/etype/atf_fip.py2
-rw-r--r--tools/binman/etype/blob.py4
-rw-r--r--tools/binman/etype/blob_ext_list.py2
-rw-r--r--tools/binman/etype/fdtmap.py2
-rw-r--r--tools/binman/etype/files.py2
-rw-r--r--tools/binman/etype/fill.py2
-rw-r--r--tools/binman/etype/fit.py20
-rw-r--r--tools/binman/etype/fmap.py4
-rw-r--r--tools/binman/etype/gbb.py10
-rw-r--r--tools/binman/etype/intel_ifwi.py12
-rw-r--r--tools/binman/etype/mkimage.py8
-rw-r--r--tools/binman/etype/section.py16
-rw-r--r--tools/binman/etype/text.py4
-rw-r--r--tools/binman/etype/u_boot_elf.py6
-rw-r--r--tools/binman/etype/u_boot_env.py4
-rw-r--r--tools/binman/etype/u_boot_spl_bss_pad.py4
-rw-r--r--tools/binman/etype/u_boot_tpl_bss_pad.py4
-rw-r--r--tools/binman/etype/u_boot_ucode.py4
-rw-r--r--tools/binman/etype/u_boot_with_ucode_ptr.py2
-rw-r--r--tools/binman/etype/vblock.py10
20 files changed, 61 insertions, 61 deletions
diff --git a/tools/binman/etype/atf_fip.py b/tools/binman/etype/atf_fip.py
index 07e6c645b0..6ecd95b71f 100644
--- a/tools/binman/etype/atf_fip.py
+++ b/tools/binman/etype/atf_fip.py
@@ -181,7 +181,7 @@ class Entry_atf_fip(Entry_section):
self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
self._fip_flags = fdt_util.GetInt64(self._node, 'fip-hdr-flags', 0)
self._fip_align = fdt_util.GetInt(self._node, 'fip-align', 1)
- if tools.NotPowerOfTwo(self._fip_align):
+ if tools.not_power_of_two(self._fip_align):
raise ValueError("Node '%s': FIP alignment %s must be a power of two" %
(self._node.path, self._fip_align))
self.ReadEntries()
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index 59728f368e..25ec5d26c9 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -37,7 +37,7 @@ class Entry_blob(Entry):
def ObtainContents(self):
self._filename = self.GetDefaultFilename()
- self._pathname = tools.GetInputFilename(self._filename,
+ self._pathname = tools.get_input_filename(self._filename,
self.external and self.section.GetAllowMissing())
# Allow the file to be missing
if not self._pathname:
@@ -68,7 +68,7 @@ class Entry_blob(Entry):
bytes: Data read
"""
state.TimingStart('read')
- indata = tools.ReadFile(pathname)
+ indata = tools.read_file(pathname)
state.TimingAccum('read')
state.TimingStart('compress')
data = self.CompressData(indata)
diff --git a/tools/binman/etype/blob_ext_list.py b/tools/binman/etype/blob_ext_list.py
index 29c9092dc3..76ad32a1ee 100644
--- a/tools/binman/etype/blob_ext_list.py
+++ b/tools/binman/etype/blob_ext_list.py
@@ -38,7 +38,7 @@ class Entry_blob_ext_list(Entry_blob):
pathnames = []
for fname in self._filenames:
fname = self.check_fake_fname(fname)
- pathname = tools.GetInputFilename(
+ pathname = tools.get_input_filename(
fname, self.external and self.section.GetAllowMissing())
# Allow the file to be missing
if not pathname:
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index aaaf2de438..76e8dbe818 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -140,7 +140,7 @@ class Entry_fdtmap(Entry):
fdt.pack()
outfdt = Fdt.FromData(fdt.as_bytearray())
data = outfdt.GetContents()
- data = FDTMAP_MAGIC + tools.GetBytes(0, 8) + data
+ data = FDTMAP_MAGIC + tools.get_bytes(0, 8) + data
return data
def ObtainContents(self):
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
index 927d0f071d..0650a69c55 100644
--- a/tools/binman/etype/files.py
+++ b/tools/binman/etype/files.py
@@ -47,7 +47,7 @@ class Entry_files(Entry_section):
'require-matches')
def ExpandEntries(self):
- files = tools.GetInputFilenameGlob(self._pattern)
+ files = tools.get_input_filename_glob(self._pattern)
if self._require_matches and not files:
self.Raise("Pattern '%s' matched no files" % self._pattern)
for fname in files:
diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py
index efb2d13e91..cd38279919 100644
--- a/tools/binman/etype/fill.py
+++ b/tools/binman/etype/fill.py
@@ -31,5 +31,5 @@ class Entry_fill(Entry):
self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
def ObtainContents(self):
- self.SetContents(tools.GetBytes(self.fill_value, self.size))
+ self.SetContents(tools.get_bytes(self.fill_value, self.size))
return True
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 6ad4a686df..954cbc3d85 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -200,19 +200,19 @@ class Entry_fit(Entry):
for seq, fdt_fname in enumerate(self._fdts):
node_name = subnode.name[1:].replace('SEQ',
str(seq + 1))
- fname = tools.GetInputFilename(fdt_fname + '.dtb')
+ fname = tools.get_input_filename(fdt_fname + '.dtb')
with fsw.add_node(node_name):
for pname, prop in subnode.props.items():
val = prop.bytes.replace(
- b'NAME', tools.ToBytes(fdt_fname))
+ b'NAME', tools.to_bytes(fdt_fname))
val = val.replace(
- b'SEQ', tools.ToBytes(str(seq + 1)))
+ b'SEQ', tools.to_bytes(str(seq + 1)))
fsw.property(pname, val)
# Add data for 'fdt' nodes (but not 'config')
if depth == 1 and in_images:
fsw.property('data',
- tools.ReadFile(fname))
+ tools.read_file(fname))
else:
if self._fdts is None:
if self._fit_list_prop:
@@ -246,10 +246,10 @@ class Entry_fit(Entry):
# self._BuildInput() either returns bytes or raises an exception.
data = self._BuildInput(self._fdt)
uniq = self.GetUniqueName()
- input_fname = tools.GetOutputFilename('%s.itb' % uniq)
- output_fname = tools.GetOutputFilename('%s.fit' % uniq)
- tools.WriteFile(input_fname, data)
- tools.WriteFile(output_fname, data)
+ input_fname = tools.get_output_filename('%s.itb' % uniq)
+ output_fname = tools.get_output_filename('%s.fit' % uniq)
+ tools.write_file(input_fname, data)
+ tools.write_file(output_fname, data)
args = {}
ext_offset = self._fit_props.get('fit,external-offset')
@@ -260,11 +260,11 @@ class Entry_fit(Entry):
}
if self.mkimage.run(reset_timestamp=True, output_fname=output_fname,
**args) is not None:
- self.SetContents(tools.ReadFile(output_fname))
+ self.SetContents(tools.read_file(output_fname))
else:
# Bintool is missing; just use empty data as the output
self.record_missing_bintool(self.mkimage)
- self.SetContents(tools.GetBytes(0, 1024))
+ self.SetContents(tools.get_bytes(0, 1024))
return True
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index cac99b60eb..72b44a7869 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -8,7 +8,7 @@
from binman.entry import Entry
from binman import fmap_util
from patman import tools
-from patman.tools import ToHexSize
+from patman.tools import to_hex_size
from patman import tout
@@ -47,7 +47,7 @@ class Entry_fmap(Entry):
def _AddEntries(areas, entry):
entries = entry.GetEntries()
tout.Debug("fmap: Add entry '%s' type '%s' (%s subentries)" %
- (entry.GetPath(), entry.etype, ToHexSize(entries)))
+ (entry.GetPath(), entry.etype, to_hex_size(entries)))
if entries and entry.etype != 'cbfs':
# Create an area for the section, which encompasses all entries
# within it
diff --git a/tools/binman/etype/gbb.py b/tools/binman/etype/gbb.py
index ca8af1be42..e32fae27ce 100644
--- a/tools/binman/etype/gbb.py
+++ b/tools/binman/etype/gbb.py
@@ -70,14 +70,14 @@ class Entry_gbb(Entry):
def ObtainContents(self):
gbb = 'gbb.bin'
- fname = tools.GetOutputFilename(gbb)
+ fname = tools.get_output_filename(gbb)
if not self.size:
self.Raise('GBB must have a fixed size')
gbb_size = self.size
bmpfv_size = gbb_size - 0x2180
if bmpfv_size < 0:
self.Raise('GBB is too small (minimum 0x2180 bytes)')
- keydir = tools.GetInputFilename(self.keydir)
+ keydir = tools.get_input_filename(self.keydir)
stdout = self.futility.gbb_create(
fname, [0x100, 0x1000, bmpfv_size, 0x1000])
@@ -88,14 +88,14 @@ class Entry_gbb(Entry):
rootkey='%s/root_key.vbpubk' % keydir,
recoverykey='%s/recovery_key.vbpubk' % keydir,
flags=self.gbb_flags,
- bmpfv=tools.GetInputFilename(self.bmpblk))
+ bmpfv=tools.get_input_filename(self.bmpblk))
if stdout is not None:
- self.SetContents(tools.ReadFile(fname))
+ self.SetContents(tools.read_file(fname))
else:
# Bintool is missing; just use the required amount of zero data
self.record_missing_bintool(self.futility)
- self.SetContents(tools.GetBytes(0, gbb_size))
+ self.SetContents(tools.get_bytes(0, gbb_size))
return True
diff --git a/tools/binman/etype/intel_ifwi.py b/tools/binman/etype/intel_ifwi.py
index ed14046ba6..46bdf116e6 100644
--- a/tools/binman/etype/intel_ifwi.py
+++ b/tools/binman/etype/intel_ifwi.py
@@ -58,11 +58,11 @@ class Entry_intel_ifwi(Entry_blob_ext):
# Create the IFWI file if needed
if self._convert_fit:
inname = self._pathname
- outname = tools.GetOutputFilename('ifwi.bin')
+ outname = tools.get_output_filename('ifwi.bin')
if self.ifwitool.create_ifwi(inname, outname) is None:
# Bintool is missing; just create a zeroed ifwi.bin
self.record_missing_bintool(self.ifwitool)
- self.SetContents(tools.GetBytes(0, 1024))
+ self.SetContents(tools.get_bytes(0, 1024))
self._filename = 'ifwi.bin'
self._pathname = outname
@@ -74,15 +74,15 @@ class Entry_intel_ifwi(Entry_blob_ext):
if self.ifwitool.delete_subpart(outname, 'OBBP') is None:
# Bintool is missing; just use zero data
self.record_missing_bintool(self.ifwitool)
- self.SetContents(tools.GetBytes(0, 1024))
+ self.SetContents(tools.get_bytes(0, 1024))
return True
for entry in self._ifwi_entries.values():
# First get the input data and put it in a file
data = entry.GetPaddedData()
uniq = self.GetUniqueName()
- input_fname = tools.GetOutputFilename('input.%s' % uniq)
- tools.WriteFile(input_fname, data)
+ input_fname = tools.get_output_filename('input.%s' % uniq)
+ tools.write_file(input_fname, data)
# At this point we know that ifwitool is present, so we don't need
# to check for None here
@@ -107,7 +107,7 @@ class Entry_intel_ifwi(Entry_blob_ext):
After that we delete the OBBP sub-partition and add each of the files
that we want in the IFWI file, one for each sub-entry of the IWFI node.
"""
- self._pathname = tools.GetInputFilename(self._filename,
+ self._pathname = tools.get_input_filename(self._filename,
self.section.GetAllowMissing())
# Allow the file to be missing
if not self._pathname:
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index 201ee4b569..baa16f36f3 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -48,12 +48,12 @@ class Entry_mkimage(Entry):
return False
data += entry.GetData()
uniq = self.GetUniqueName()
- input_fname = tools.GetOutputFilename('mkimage.%s' % uniq)
- tools.WriteFile(input_fname, data)
- output_fname = tools.GetOutputFilename('mkimage-out.%s' % uniq)
+ input_fname = tools.get_output_filename('mkimage.%s' % uniq)
+ tools.write_file(input_fname, data)
+ output_fname = tools.get_output_filename('mkimage-out.%s' % uniq)
if self.mkimage.run_cmd('-d', input_fname, *self._args,
output_fname) is not None:
- self.SetContents(tools.ReadFile(output_fname))
+ self.SetContents(tools.read_file(output_fname))
else:
# Bintool is missing; just use the input data as the output
self.record_missing_bintool(self.mkimage)
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index bb375e9063..b3d7302394 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -19,7 +19,7 @@ from binman import state
from dtoc import fdt_util
from patman import tools
from patman import tout
-from patman.tools import ToHexSize
+from patman.tools import to_hex_size
class Entry_section(Entry):
@@ -269,19 +269,19 @@ class Entry_section(Entry):
data = bytearray()
# Handle padding before the entry
if entry.pad_before:
- data += tools.GetBytes(self._pad_byte, entry.pad_before)
+ data += tools.get_bytes(self._pad_byte, entry.pad_before)
# Add in the actual entry data
data += entry_data
# Handle padding after the entry
if entry.pad_after:
- data += tools.GetBytes(self._pad_byte, entry.pad_after)
+ data += tools.get_bytes(self._pad_byte, entry.pad_after)
if entry.size:
- data += tools.GetBytes(pad_byte, entry.size - len(data))
+ data += tools.get_bytes(pad_byte, entry.size - len(data))
- self.Detail('GetPaddedDataForEntry: size %s' % ToHexSize(self.data))
+ self.Detail('GetPaddedDataForEntry: size %s' % to_hex_size(self.data))
return data
@@ -316,7 +316,7 @@ class Entry_section(Entry):
# Handle empty space before the entry
pad = (entry.offset or 0) - self._skip_at_start - len(section_data)
if pad > 0:
- section_data += tools.GetBytes(self._pad_byte, pad)
+ section_data += tools.get_bytes(self._pad_byte, pad)
# Add in the actual entry data
section_data += data
@@ -709,14 +709,14 @@ class Entry_section(Entry):
if not size:
data = self.GetPaddedData(self.data)
size = len(data)
- size = tools.Align(size, self.align_size)
+ size = tools.align(size, self.align_size)
if self.size and contents_size > self.size:
self._Raise("contents size %#x (%d) exceeds section size %#x (%d)" %
(contents_size, contents_size, self.size, self.size))
if not self.size:
self.size = size
- if self.size != tools.Align(self.size, self.align_size):
+ if self.size != tools.align(self.size, self.align_size):
self._Raise("Size %#x (%d) does not match align-size %#x (%d)" %
(self.size, self.size, self.align_size,
self.align_size))
diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index 45dfcc401e..c55e0233b1 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -60,14 +60,14 @@ class Entry_text(Entry):
super().__init__(section, etype, node)
value = fdt_util.GetString(self._node, 'text')
if value:
- value = tools.ToBytes(value)
+ value = tools.to_bytes(value)
else:
label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)])
self.text_label = label
if self.text_label:
value, = self.GetEntryArgsOrProps([EntryArg(self.text_label,
str)])
- value = tools.ToBytes(value) if value is not None else value
+ value = tools.to_bytes(value) if value is not None else value
self.value = value
def ObtainContents(self):
diff --git a/tools/binman/etype/u_boot_elf.py b/tools/binman/etype/u_boot_elf.py
index 6614a75faf..3ec774f38a 100644
--- a/tools/binman/etype/u_boot_elf.py
+++ b/tools/binman/etype/u_boot_elf.py
@@ -27,9 +27,9 @@ class Entry_u_boot_elf(Entry_blob):
def ReadBlobContents(self):
if self._strip:
uniq = self.GetUniqueName()
- out_fname = tools.GetOutputFilename('%s.stripped' % uniq)
- tools.WriteFile(out_fname, tools.ReadFile(self._pathname))
- tools.Run('strip', out_fname)
+ out_fname = tools.get_output_filename('%s.stripped' % uniq)
+ tools.write_file(out_fname, tools.read_file(self._pathname))
+ tools.run('strip', out_fname)
self._pathname = out_fname
super().ReadBlobContents()
return True
diff --git a/tools/binman/etype/u_boot_env.py b/tools/binman/etype/u_boot_env.py
index 1694c2a6ee..c38340b256 100644
--- a/tools/binman/etype/u_boot_env.py
+++ b/tools/binman/etype/u_boot_env.py
@@ -27,7 +27,7 @@ class Entry_u_boot_env(Entry_blob):
self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
def ReadBlobContents(self):
- indata = tools.ReadFile(self._pathname)
+ indata = tools.read_file(self._pathname)
data = b''
for line in indata.splitlines():
data += line + b'\0'
@@ -35,7 +35,7 @@ class Entry_u_boot_env(Entry_blob):
pad = self.size - len(data) - 5
if pad < 0:
self.Raise("'u-boot-env' entry too small to hold data (need %#x more bytes)" % -pad)
- data += tools.GetBytes(self.fill_value, pad)
+ data += tools.get_bytes(self.fill_value, pad)
crc = zlib.crc32(data)
buf = struct.pack('<I', crc) + b'\x01' + data
self.SetContents(buf)
diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py b/tools/binman/etype/u_boot_spl_bss_pad.py
index 18c5596bd3..680d198305 100644
--- a/tools/binman/etype/u_boot_spl_bss_pad.py
+++ b/tools/binman/etype/u_boot_spl_bss_pad.py
@@ -36,9 +36,9 @@ class Entry_u_boot_spl_bss_pad(Entry_blob):
super().__init__(section, etype, node)
def ObtainContents(self):
- fname = tools.GetInputFilename('spl/u-boot-spl')
+ fname = tools.get_input_filename('spl/u-boot-spl')
bss_size = elf.GetSymbolAddress(fname, '__bss_size')
if not bss_size:
self.Raise('Expected __bss_size symbol in spl/u-boot-spl')
- self.SetContents(tools.GetBytes(0, bss_size))
+ self.SetContents(tools.get_bytes(0, bss_size))
return True
diff --git a/tools/binman/etype/u_boot_tpl_bss_pad.py b/tools/binman/etype/u_boot_tpl_bss_pad.py
index 521b24a384..47f4b23f35 100644
--- a/tools/binman/etype/u_boot_tpl_bss_pad.py
+++ b/tools/binman/etype/u_boot_tpl_bss_pad.py
@@ -36,9 +36,9 @@ class Entry_u_boot_tpl_bss_pad(Entry_blob):
super().__init__(section, etype, node)
def ObtainContents(self):
- fname = tools.GetInputFilename('tpl/u-boot-tpl')
+ fname = tools.get_input_filename('tpl/u-boot-tpl')
bss_size = elf.GetSymbolAddress(fname, '__bss_size')
if not bss_size:
self.Raise('Expected __bss_size symbol in tpl/u-boot-tpl')
- self.SetContents(tools.GetBytes(0, bss_size))
+ self.SetContents(tools.get_bytes(0, bss_size))
return True
diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py
index b4cb8cdb6e..6945411cf9 100644
--- a/tools/binman/etype/u_boot_ucode.py
+++ b/tools/binman/etype/u_boot_ucode.py
@@ -92,8 +92,8 @@ class Entry_u_boot_ucode(Entry_blob):
return True
# Write it out to a file
- self._pathname = tools.GetOutputFilename('u-boot-ucode.bin')
- tools.WriteFile(self._pathname, fdt_entry.ucode_data)
+ self._pathname = tools.get_output_filename('u-boot-ucode.bin')
+ tools.write_file(self._pathname, fdt_entry.ucode_data)
self.ReadBlobContents()
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 20be22a1fd..a5fd2d1ca5 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -38,7 +38,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
def ProcessFdt(self, fdt):
# Figure out where to put the microcode pointer
- fname = tools.GetInputFilename(self.elf_fname)
+ fname = tools.get_input_filename(self.elf_fname)
sym = elf.GetSymbolAddress(fname, '_dt_ucode_base_size')
if sym:
self.target_offset = sym
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py
index 8bbba273ab..a1de98290b 100644
--- a/tools/binman/etype/vblock.py
+++ b/tools/binman/etype/vblock.py
@@ -65,9 +65,9 @@ class Entry_vblock(Entry_collection):
return None
uniq = self.GetUniqueName()
- output_fname = tools.GetOutputFilename('vblock.%s' % uniq)
- input_fname = tools.GetOutputFilename('input.%s' % uniq)
- tools.WriteFile(input_fname, input_data)
+ output_fname = tools.get_output_filename('vblock.%s' % uniq)
+ input_fname = tools.get_output_filename('input.%s' % uniq)
+ tools.write_file(input_fname, input_data)
prefix = self.keydir + '/'
stdout = self.futility.sign_firmware(
vblock=output_fname,
@@ -78,11 +78,11 @@ class Entry_vblock(Entry_collection):
kernelkey=prefix + self.kernelkey,
flags=f'{self.preamble_flags}')
if stdout is not None:
- data = tools.ReadFile(output_fname)
+ data = tools.read_file(output_fname)
else:
# Bintool is missing; just use 4KB of zero data
self.record_missing_bintool(self.futility)
- data = tools.GetBytes(0, 4096)
+ data = tools.get_bytes(0, 4096)
return data
def ObtainContents(self):