aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/etype/blob.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-01-12 13:10:36 -0700
committerTom Rini <trini@konsulko.com>2022-01-12 21:26:59 -0500
commit790ba9fce82bff215cf05513278a7b52312b6b28 (patch)
tree8587c8832b50a6cdba7118649fa2aa66e9b9e939 /tools/binman/etype/blob.py
parent32d4f106bd806428d756398a83d2b15563b58cf8 (diff)
binman: Write fake blobs to the output directory
At present binman writes fake blobs to the current directory. This is not very helpful, since the files serve no useful purpose once binman has finished. They clutter up the source directory and affect future runs, since the files in the current directory are often used in preference to those in the board directory. To avoid these problems, write them to the output directory instead. Move the file-creation code to the Entry base class, so it can be used by any entry type that needs it. This is required since some entry types, such as Entry_blob_ext_list, are not subclasses of Entry_blob. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/blob.py')
-rw-r--r--tools/binman/etype/blob.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index 65ebb2ecf4..59728f368e 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -5,8 +5,6 @@
# Entry-type module for blobs, which are binary objects read from files
#
-import pathlib
-
from binman.entry import Entry
from binman import state
from dtoc import fdt_util
@@ -38,16 +36,12 @@ class Entry_blob(Entry):
self._filename = fdt_util.GetString(self._node, 'filename', self.etype)
def ObtainContents(self):
- if self.allow_fake and not pathlib.Path(self._filename).is_file():
- with open(self._filename, "wb") as out:
- out.truncate(1024)
- self.faked = True
-
self._filename = self.GetDefaultFilename()
self._pathname = tools.GetInputFilename(self._filename,
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.missing = True
return True