aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/binman/binman.rst3
-rw-r--r--tools/binman/entry.py9
-rw-r--r--tools/binman/etype/blob.py7
-rw-r--r--tools/binman/etype/blob_ext_list.py2
4 files changed, 13 insertions, 8 deletions
diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index 509fc8d..935839c 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -1500,7 +1500,8 @@ Some ideas:
- Figure out how to make Fdt support changing the node order, so that
Node.AddSubnode() can support adding a node before another, existing node.
Perhaps it should completely regenerate the flat tree?
-
+- Put faked files into a separate subdir and remove them on start-up, to avoid
+ seeing them as 'real' files on a subsequent run
--
Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 786c959..9d499f0 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -999,15 +999,18 @@ features to produce new behaviours.
fname (str): Filename to check
Returns:
- fname (str): Filename of faked file
+ tuple:
+ fname (str): Filename of faked file
+ bool: True if the blob was faked, False if not
"""
if self.allow_fake and not pathlib.Path(fname).is_file():
outfname = tools.get_output_filename(os.path.basename(fname))
with open(outfname, "wb") as out:
out.truncate(1024)
self.faked = True
- return outfname
- return fname
+ tout.info(f"Entry '{self._node.path}': Faked file '{outfname}'")
+ return outfname, True
+ return fname, False
def CheckFakedBlobs(self, faked_blobs_list):
"""Check if any entries in this section have faked external blobs
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index 25ec5d2..89f089e 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -41,10 +41,11 @@ class Entry_blob(Entry):
self.external and self.section.GetAllowMissing())
# Allow the file to be missing
if not self._pathname:
- self._pathname = self.check_fake_fname(self._filename)
- self.SetContents(b'')
+ self._pathname, faked = self.check_fake_fname(self._filename)
self.missing = True
- return True
+ if not faked:
+ self.SetContents(b'')
+ return True
self.ReadBlobContents()
return True
diff --git a/tools/binman/etype/blob_ext_list.py b/tools/binman/etype/blob_ext_list.py
index 76ad32a..f00202e 100644
--- a/tools/binman/etype/blob_ext_list.py
+++ b/tools/binman/etype/blob_ext_list.py
@@ -37,7 +37,7 @@ class Entry_blob_ext_list(Entry_blob):
missing = False
pathnames = []
for fname in self._filenames:
- fname = self.check_fake_fname(fname)
+ fname, _ = self.check_fake_fname(fname)
pathname = tools.get_input_filename(
fname, self.external and self.section.GetAllowMissing())
# Allow the file to be missing