aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/etype/mkimage.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/binman/etype/mkimage.py')
-rw-r--r--tools/binman/etype/mkimage.py52
1 files changed, 45 insertions, 7 deletions
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index ddbd9ce..c2288c4 100644
--- a/tools/binman/etype/mkimage.py
+++ b/tools/binman/etype/mkimage.py
@@ -18,11 +18,16 @@ class Entry_mkimage(Entry):
- args: Arguments to pass
- data-to-imagename: Indicates that the -d data should be passed in as
the image name also (-n)
+ - multiple-data-files: boolean to tell binman to pass all files as
+ datafiles to mkimage instead of creating a temporary file the result
+ of datafiles concatenation
+ - filename: filename of output binary generated by mkimage
The data passed to mkimage via the -d flag is collected from subnodes of the
mkimage node, e.g.::
mkimage {
+ filename = "imximage.bin";
args = "-n test -T imximage";
u-boot-spl {
@@ -35,8 +40,9 @@ class Entry_mkimage(Entry):
mkimage -d <data_file> -n test -T imximage <output_file>
The output from mkimage then becomes part of the image produced by
- binman. If you need to put multiple things in the data file, you can use
- a section, or just multiple subnodes like this::
+ binman but also is written into `imximage.bin` file. If you need to put
+ multiple things in the data file, you can use a section, or just multiple
+ subnodes like this::
mkimage {
args = "-n test -T imximage";
@@ -51,6 +57,25 @@ class Entry_mkimage(Entry):
Note that binman places the contents (here SPL and TPL) into a single file
and passes that to mkimage using the -d option.
+ To pass all datafiles untouched to mkimage::
+
+ mkimage {
+ args = "-n rk3399 -T rkspi";
+ multiple-data-files;
+
+ u-boot-tpl {
+ };
+
+ u-boot-spl {
+ };
+ };
+
+ This calls mkimage to create a Rockchip RK3399-specific first stage
+ bootloader, made of TPL+SPL. Since this first stage bootloader requires to
+ align the TPL and SPL but also some weird hacks that is handled by mkimage
+ directly, binman is told to not perform the concatenation of datafiles prior
+ to passing the data to mkimage.
+
To use CONFIG options in the arguments, use a string list instead, as in
this example which also produces four arguments::
@@ -96,8 +121,10 @@ class Entry_mkimage(Entry):
"""
def __init__(self, section, etype, node):
super().__init__(section, etype, node)
+ self._multiple_data_files = fdt_util.GetBool(self._node, 'multiple-data-files')
self._mkimage_entries = OrderedDict()
self._imagename = None
+ self._filename = fdt_util.GetString(self._node, 'filename')
self.align_default = None
def ReadNode(self):
@@ -122,16 +149,27 @@ class Entry_mkimage(Entry):
def ObtainContents(self):
# Use a non-zero size for any fake files to keep mkimage happy
# Note that testMkimageImagename() relies on this 'mkimage' parameter
- data, input_fname, uniq = self.collect_contents_to_file(
- self._mkimage_entries.values(), 'mkimage', 1024)
- if data is None:
- return False
+ fake_size = 1024
+ if self._multiple_data_files:
+ fnames = []
+ uniq = self.GetUniqueName()
+ for entry in self._mkimage_entries.values():
+ if not entry.ObtainContents(fake_size=fake_size):
+ return False
+ fnames.append(tools.get_input_filename(entry.GetDefaultFilename()))
+ input_fname = ":".join(fnames)
+ else:
+ data, input_fname, uniq = self.collect_contents_to_file(
+ self._mkimage_entries.values(), 'mkimage', fake_size)
+ if data is None:
+ return False
if self._imagename:
image_data, imagename_fname, _ = self.collect_contents_to_file(
[self._imagename], 'mkimage-n', 1024)
if image_data is None:
return False
- output_fname = tools.get_output_filename('mkimage-out.%s' % uniq)
+ outfile = self._filename if self._filename else 'mkimage-out.%s' % uniq
+ output_fname = tools.get_output_filename(outfile)
args = ['-d', input_fname]
if self._data_to_imagename: