aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTom Rini2022-09-19 13:19:39 -0400
committerTom Rini2022-09-19 16:07:12 -0400
commite9a1ff9724348408144c7f1c5b5cc26130ba46e5 (patch)
tree68b56f117206d121b4a7e567b0209c02283c98e6 /tools
parentb6c50e5831f6ce3800d4b3cf3c7aa35dde8c48d9 (diff)
parentf76f3e3b44328fe6229650540109af93750fd5f0 (diff)
Merge branch 'master' into next
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/binman.rst54
-rw-r--r--tools/binman/bintool.py46
-rw-r--r--tools/binman/btool/btool_gzip.py2
-rw-r--r--tools/binman/btool/bzip2.py2
-rw-r--r--tools/binman/btool/fiptool.py11
-rw-r--r--tools/binman/btool/futility.py13
-rw-r--r--tools/binman/btool/lz4.py14
-rw-r--r--tools/binman/btool/mkimage.py18
-rw-r--r--tools/binman/entries.rst22
-rw-r--r--tools/binman/etype/mkimage.py52
-rw-r--r--tools/binman/etype/u_boot_vpl.py42
-rw-r--r--tools/binman/etype/u_boot_vpl_bss_pad.py44
-rw-r--r--tools/binman/etype/u_boot_vpl_dtb.py28
-rw-r--r--tools/binman/etype/u_boot_vpl_expanded.py45
-rw-r--r--tools/binman/etype/u_boot_vpl_nodtb.py42
-rw-r--r--tools/binman/ftest.py252
-rw-r--r--tools/binman/state.py3
-rw-r--r--tools/binman/test/082_fdt_update_all.dts2
-rw-r--r--tools/binman/test/230_dev.key (renamed from tools/binman/test/225_dev.key)0
-rw-r--r--tools/binman/test/230_pre_load.dts (renamed from tools/binman/test/225_pre_load.dts)2
-rw-r--r--tools/binman/test/231_pre_load_pkcs.dts (renamed from tools/binman/test/226_pre_load_pkcs.dts)2
-rw-r--r--tools/binman/test/232_pre_load_pss.dts (renamed from tools/binman/test/227_pre_load_pss.dts)2
-rw-r--r--tools/binman/test/233_pre_load_invalid_padding.dts (renamed from tools/binman/test/228_pre_load_invalid_padding.dts)2
-rw-r--r--tools/binman/test/234_pre_load_invalid_sha.dts (renamed from tools/binman/test/229_pre_load_invalid_sha.dts)2
-rw-r--r--tools/binman/test/235_pre_load_invalid_algo.dts (renamed from tools/binman/test/230_pre_load_invalid_algo.dts)2
-rw-r--r--tools/binman/test/236_pre_load_invalid_key.dts (renamed from tools/binman/test/231_pre_load_invalid_key.dts)2
-rw-r--r--tools/binman/test/237_unique_names.dts (renamed from tools/binman/test/230_unique_names.dts)0
-rw-r--r--tools/binman/test/238_unique_names_multi.dts (renamed from tools/binman/test/231_unique_names_multi.dts)0
-rw-r--r--tools/binman/test/239_replace_with_bintool.dts (renamed from tools/binman/test/232_replace_with_bintool.dts)0
-rw-r--r--tools/binman/test/240_fit_extract_replace.dts (renamed from tools/binman/test/233_fit_extract_replace.dts)0
-rw-r--r--tools/binman/test/241_replace_section_simple.dts (renamed from tools/binman/test/234_replace_section_simple.dts)0
-rw-r--r--tools/binman/test/242_mkimage_name.dts (renamed from tools/binman/test/235_mkimage_name.dts)0
-rw-r--r--tools/binman/test/243_mkimage_image.dts (renamed from tools/binman/test/236_mkimage_image.dts)0
-rw-r--r--tools/binman/test/244_mkimage_image_no_content.dts (renamed from tools/binman/test/237_mkimage_image_no_content.dts)0
-rw-r--r--tools/binman/test/245_mkimage_image_bad.dts (renamed from tools/binman/test/238_mkimage_image_bad.dts)0
-rw-r--r--tools/binman/test/246_collection_other.dts (renamed from tools/binman/test/239_collection_other.dts)0
-rw-r--r--tools/binman/test/247_mkimage_coll.dts (renamed from tools/binman/test/240_mkimage_coll.dts)0
-rw-r--r--tools/binman/test/248_compress_dtb_prepend_invalid.dts (renamed from tools/binman/test/235_compress_dtb_prepend_invalid.dts)0
-rw-r--r--tools/binman/test/249_compress_dtb_prepend_length.dts (renamed from tools/binman/test/236_compress_dtb_prepend_length.dts)0
-rw-r--r--tools/binman/test/250_compress_dtb_invalid.dts (renamed from tools/binman/test/237_compress_dtb_invalid.dts)0
-rw-r--r--tools/binman/test/251_compress_dtb_zstd.dts (renamed from tools/binman/test/238_compress_dtb_zstd.dts)0
-rw-r--r--tools/binman/test/252_mkimage_mult_data.dts21
-rw-r--r--tools/binman/test/253_mkimage_mult_no_content.dts22
-rw-r--r--tools/binman/test/254_mkimage_filename.dts18
-rw-r--r--tools/binman/test/255_u_boot_vpl.dts11
-rw-r--r--tools/binman/test/256_u_boot_vpl_nodtb.dts13
-rw-r--r--tools/binman/test/257_fdt_incl_vpl.dts13
-rw-r--r--tools/binman/test/258_vpl_bss_pad.dts19
-rw-r--r--tools/kwboot.c2
-rw-r--r--tools/patman/patman.rst47
-rw-r--r--tools/sunxi_toc0.c2
-rw-r--r--tools/termios_linux.h1
52 files changed, 671 insertions, 204 deletions
diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index f94fd7e2a53..4ee6f41f35e 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -236,6 +236,10 @@ variable. Within binman, this EntryArg is picked up by the `Entry_atf_bl31`
etype. An EntryArg is simply an argument to the entry. The `atf-bl31-path`
name is documented in :ref:`etype_atf_bl31`.
+Taking this a little further, when binman is used to create a FIT, it supports
+using an ELF file, e.g. `bl31.elf` and splitting it into separate pieces (with
+`fit,operation = "split-elf"`), each with its own load address.
+
Invoking binman outside U-Boot
------------------------------
@@ -854,6 +858,55 @@ allow-repack:
image description to be stored in the FDT and fdtmap.
+Image dependencies
+------------------
+
+Binman does not currently support images that depend on each other. For example,
+if one image creates `fred.bin` and then the next uses this `fred.bin` to
+produce a final `image.bin`, then the behaviour is undefined. It may work, or it
+may produce an error about `fred.bin` being missing, or it may use a version of
+`fred.bin` from a previous run.
+
+Often this can be handled by incorporating the dependency into the second
+image. For example, instead of::
+
+ binman {
+ multiple-images;
+
+ fred {
+ u-boot {
+ };
+ fill {
+ size = <0x100>;
+ };
+ };
+
+ image {
+ blob {
+ filename = "fred.bin";
+ };
+ u-boot-spl {
+ };
+ };
+
+you can do this::
+
+ binman {
+ image {
+ fred {
+ type = "section";
+ u-boot {
+ };
+ fill {
+ size = <0x100>;
+ };
+ };
+ u-boot-spl {
+ };
+ };
+
+
+
Hashing Entries
---------------
@@ -1684,6 +1737,7 @@ 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?
+- Support images which depend on each other
--
Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index ec30ceff74c..032179a99de 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -53,9 +53,11 @@ class Bintool:
# List of bintools to regard as missing
missing_list = []
- def __init__(self, name, desc):
+ def __init__(self, name, desc, version_regex=None, version_args='-V'):
self.name = name
self.desc = desc
+ self.version_regex = version_regex
+ self.version_args = version_args
@staticmethod
def find_bintool_class(btype):
@@ -464,16 +466,27 @@ binaries. It is fairly easy to create new bintools. Just add a new file to the
print(f"No method to fetch bintool '{self.name}'")
return False
- # pylint: disable=R0201
def version(self):
"""Version handler for a bintool
- This should be implemented by the base class
-
Returns:
str: Version string for this bintool
"""
- return 'unknown'
+ if self.version_regex is None:
+ return 'unknown'
+
+ import re
+
+ result = self.run_cmd_result(self.version_args)
+ out = result.stdout.strip()
+ if not out:
+ out = result.stderr.strip()
+ if not out:
+ return 'unknown'
+
+ m_version = re.search(self.version_regex, out)
+ return m_version.group(1) if m_version else out
+
class BintoolPacker(Bintool):
"""Tool which compression / decompression entry contents
@@ -495,9 +508,9 @@ class BintoolPacker(Bintool):
"""
def __init__(self, name, compression=None, compress_args=None,
decompress_args=None, fetch_package=None,
- version_regex=r'(v[0-9.]+)'):
+ version_regex=r'(v[0-9.]+)', version_args='-V'):
desc = '%s compression' % (compression if compression else name)
- super().__init__(name, desc)
+ super().__init__(name, desc, version_regex, version_args)
if compress_args is None:
compress_args = ['--compress']
self.compress_args = compress_args
@@ -507,7 +520,6 @@ class BintoolPacker(Bintool):
if fetch_package is None:
fetch_package = name
self.fetch_package = fetch_package
- self.version_regex = version_regex
def compress(self, indata):
"""Compress data
@@ -557,21 +569,3 @@ class BintoolPacker(Bintool):
if method != FETCH_BIN:
return None
return self.apt_install(self.fetch_package)
-
- def version(self):
- """Version handler
-
- Returns:
- str: Version number
- """
- import re
-
- result = self.run_cmd_result('-V')
- out = result.stdout.strip()
- if not out:
- out = result.stderr.strip()
- if not out:
- return super().version()
-
- m_version = re.search(self.version_regex, out)
- return m_version.group(1) if m_version else out
diff --git a/tools/binman/btool/btool_gzip.py b/tools/binman/btool/btool_gzip.py
index 7bea300b5da..70cbc19f04b 100644
--- a/tools/binman/btool/btool_gzip.py
+++ b/tools/binman/btool/btool_gzip.py
@@ -27,5 +27,5 @@ class Bintoolbtool_gzip(bintool.BintoolPacker):
man gzip
"""
def __init__(self, name):
- super().__init__(name, compress_args=[],
+ super().__init__("gzip", compress_args=[],
version_regex=r'gzip ([0-9.]+)')
diff --git a/tools/binman/btool/bzip2.py b/tools/binman/btool/bzip2.py
index 9be87a621f2..c3897d63acb 100644
--- a/tools/binman/btool/bzip2.py
+++ b/tools/binman/btool/bzip2.py
@@ -27,4 +27,4 @@ class Bintoolbzip2(bintool.BintoolPacker):
man bzip2
"""
def __init__(self, name):
- super().__init__(name, version_regex=r'bzip2.*Version ([0-9.]+)')
+ super().__init__(name, version_regex=r'bzip2.*Version ([0-9.]+)', version_args='--help')
diff --git a/tools/binman/btool/fiptool.py b/tools/binman/btool/fiptool.py
index c6d71cebc21..c80f8275c4c 100644
--- a/tools/binman/btool/fiptool.py
+++ b/tools/binman/btool/fiptool.py
@@ -49,7 +49,7 @@ class Bintoolfiptool(bintool.Bintool):
https://trustedfirmware-a.readthedocs.io/en/latest/getting_started/tools-build.html?highlight=fiptool#building-and-using-the-fip-tool
"""
def __init__(self, name):
- super().__init__(name, 'Manipulate ATF FIP files')
+ super().__init__(name, 'Manipulate ATF FIP files', r'^(.*)$', 'version')
def info(self, fname):
"""Get info on a FIP image
@@ -112,12 +112,3 @@ class Bintoolfiptool(bintool.Bintool):
'fiptool',
'tools/fiptool/fiptool')
return result
-
- def version(self):
- """Version handler for fiptool
-
- Returns:
- str: Version number of fiptool
- """
- out = self.run_cmd('version').strip()
- return out or super().version()
diff --git a/tools/binman/btool/futility.py b/tools/binman/btool/futility.py
index 8d00966a9d0..75a05c2ac66 100644
--- a/tools/binman/btool/futility.py
+++ b/tools/binman/btool/futility.py
@@ -69,7 +69,7 @@ class Bintoolfutility(bintool.Bintool):
https://chromium.googlesource.com/chromiumos/platform/vboot/+/refs/heads/main/_vboot_reference/README
"""
def __init__(self, name):
- super().__init__(name, 'Chromium OS firmware utility')
+ super().__init__(name, 'Chromium OS firmware utility', r'^(.*)$', 'version')
def gbb_create(self, fname, sizes):
"""Create a new Google Binary Block
@@ -165,14 +165,3 @@ class Bintoolfutility(bintool.Bintool):
fname, tmpdir = self.fetch_from_drive(
'1hdsInzsE4aJbmBeJ663kYgjOQyW1I-E0')
return fname, tmpdir
-
- def version(self):
- """Version handler for futility
-
- Returns:
- str: Version string for futility
- """
- out = self.run_cmd('version').strip()
- if not out:
- return super().version()
- return out
diff --git a/tools/binman/btool/lz4.py b/tools/binman/btool/lz4.py
index f09c5c8904b..dc9e37921a6 100644
--- a/tools/binman/btool/lz4.py
+++ b/tools/binman/btool/lz4.py
@@ -76,7 +76,7 @@ class Bintoollz4(bintool.Bintool):
man lz4
"""
def __init__(self, name):
- super().__init__(name, 'lz4 compression')
+ super().__init__(name, 'lz4 compression', r'.* (v[0-9.]*),.*')
def compress(self, indata):
"""Compress data with lz4
@@ -126,15 +126,3 @@ class Bintoollz4(bintool.Bintool):
if method != bintool.FETCH_BIN:
return None
return self.apt_install('lz4')
-
- def version(self):
- """Version handler
-
- Returns:
- str: Version number of lz4
- """
- out = self.run_cmd('-V').strip()
- if not out:
- return super().version()
- m_version = re.match(r'.* (v[0-9.]*),.*', out)
- return m_version.group(1) if m_version else out
diff --git a/tools/binman/btool/mkimage.py b/tools/binman/btool/mkimage.py
index c85bfe053cf..da5f3441624 100644
--- a/tools/binman/btool/mkimage.py
+++ b/tools/binman/btool/mkimage.py
@@ -18,11 +18,11 @@ class Bintoolmkimage(bintool.Bintool):
Support is provided for fetching this on Debian-like systems, using apt.
"""
def __init__(self, name):
- super().__init__(name, 'Generate image for U-Boot')
+ super().__init__(name, 'Generate image for U-Boot', r'mkimage version (.*)')
# pylint: disable=R0913
def run(self, reset_timestamp=False, output_fname=None, external=False,
- pad=None, version=False):
+ pad=None):
"""Run mkimage
Args:
@@ -44,8 +44,6 @@ class Bintoolmkimage(bintool.Bintool):
args.append('-t')
if output_fname:
args += ['-F', output_fname]
- if version:
- args.append('-V')
return self.run_cmd(*args)
def fetch(self, method):
@@ -66,15 +64,3 @@ class Bintoolmkimage(bintool.Bintool):
if method != bintool.FETCH_BIN:
return None
return self.apt_install('u-boot-tools')
-
- def version(self):
- """Version handler for mkimage
-
- Returns:
- str: Version string for mkimage
- """
- out = self.run(version=True).strip()
- if not out:
- return super().version()
- m_version = re.match(r'mkimage version (.*)', out)
- return m_version.group(1) if m_version else out
diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index b3613d7cbd0..18bd328c5cd 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1175,6 +1175,9 @@ Properties / Entry arguments:
- 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
The data passed to mkimage via the -d flag is collected from subnodes of the
mkimage node, e.g.::
@@ -1205,6 +1208,25 @@ a section, or just multiple subnodes like this::
};
};
+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::
diff --git a/tools/binman/etype/mkimage.py b/tools/binman/etype/mkimage.py
index ddbd9cec658..c2288c48eef 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:
diff --git a/tools/binman/etype/u_boot_vpl.py b/tools/binman/etype/u_boot_vpl.py
new file mode 100644
index 00000000000..9daaca4f6fd
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl.py
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for vpl/u-boot-vpl.bin
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+
+class Entry_u_boot_vpl(Entry_blob):
+ """U-Boot VPL binary
+
+ Properties / Entry arguments:
+ - filename: Filename of u-boot-vpl.bin (default 'vpl/u-boot-vpl.bin')
+
+ This is the U-Boot VPL (Verifying Program Loader) binary. This is a small
+ binary which loads before SPL, typically into on-chip SRAM. It is
+ responsible for locating, loading and jumping to SPL, the next-stage
+ loader. Note that VPL is not relocatable so must be loaded to the correct
+ address in SRAM, or written to run from the correct address if direct
+ flash execution is possible (e.g. on x86 devices).
+
+ SPL can access binman symbols at runtime. See:
+
+ 'Access to binman entry offsets at run time (symbols)'
+
+ in the binman README for more information.
+
+ The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since
+ binman uses that to look up symbols to write into the VPL binary.
+ """
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node)
+ self.elf_fname = 'vpl/u-boot-vpl'
+
+ def GetDefaultFilename(self):
+ return 'vpl/u-boot-vpl.bin'
+
+ def WriteSymbols(self, section):
+ elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/etype/u_boot_vpl_bss_pad.py b/tools/binman/etype/u_boot_vpl_bss_pad.py
new file mode 100644
index 00000000000..b2ce2a31352
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl_bss_pad.py
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for BSS padding for vpl/u-boot-vpl.bin. This padding
+# can be added after the VPL binary to ensure that anything concatenated
+# to it will appear to VPL to be at the end of BSS rather than the start.
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+from patman import tools
+
+class Entry_u_boot_vpl_bss_pad(Entry_blob):
+ """U-Boot VPL binary padded with a BSS region
+
+ Properties / Entry arguments:
+ None
+
+ This holds the padding added after the VPL binary to cover the BSS (Block
+ Started by Symbol) region. This region holds the various variables used by
+ VPL. It is set to 0 by VPL when it starts up. If you want to append data to
+ the VPL image (such as a device tree file), you must pad out the BSS region
+ to avoid the data overlapping with U-Boot variables. This entry is useful in
+ that case. It automatically pads out the entry size to cover both the code,
+ data and BSS.
+
+ The contents of this entry will a certain number of zero bytes, determined
+ by __bss_size
+
+ The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since
+ binman uses that to look up the BSS address.
+ """
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node)
+
+ def ObtainContents(self):
+ fname = tools.get_input_filename('vpl/u-boot-vpl')
+ bss_size = elf.GetSymbolAddress(fname, '__bss_size')
+ if not bss_size:
+ self.Raise('Expected __bss_size symbol in vpl/u-boot-vpl')
+ self.SetContents(tools.get_bytes(0, bss_size))
+ return True
diff --git a/tools/binman/etype/u_boot_vpl_dtb.py b/tools/binman/etype/u_boot_vpl_dtb.py
new file mode 100644
index 00000000000..f6253bf2431
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl_dtb.py
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for U-Boot device tree in VPL (Verifying Program Loader)
+#
+
+from binman.entry import Entry
+from binman.etype.blob_dtb import Entry_blob_dtb
+
+class Entry_u_boot_vpl_dtb(Entry_blob_dtb):
+ """U-Boot VPL device tree
+
+ Properties / Entry arguments:
+ - filename: Filename of u-boot.dtb (default 'vpl/u-boot-vpl.dtb')
+
+ This is the VPL device tree, containing configuration information for
+ VPL. VPL needs this to know what devices are present and which drivers
+ to activate.
+ """
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node)
+
+ def GetDefaultFilename(self):
+ return 'vpl/u-boot-vpl.dtb'
+
+ def GetFdtEtype(self):
+ return 'u-boot-vpl-dtb'
diff --git a/tools/binman/etype/u_boot_vpl_expanded.py b/tools/binman/etype/u_boot_vpl_expanded.py
new file mode 100644
index 00000000000..92c64f0a65e
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl_expanded.py
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2021 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for expanded U-Boot VPL binary
+#
+
+from patman import tout
+
+from binman import state
+from binman.etype.blob_phase import Entry_blob_phase
+
+class Entry_u_boot_vpl_expanded(Entry_blob_phase):
+ """U-Boot VPL flat binary broken out into its component parts
+
+ Properties / Entry arguments:
+ - vpl-dtb: Controls whether this entry is selected (set to 'y' or '1' to
+ select)
+
+ This is a section containing the U-Boot binary, BSS padding if needed and a
+ devicetree. Using this entry type automatically creates this section, with
+ the following entries in it:
+
+ u-boot-vpl-nodtb
+ u-boot-vpl-bss-pad
+ u-boot-dtb
+
+ Having the devicetree separate allows binman to update it in the final
+ image, so that the entries positions are provided to the running U-Boot.
+
+ This entry is selected based on the value of the 'vpl-dtb' entryarg. If
+ this is non-empty (and not 'n' or '0') then this expanded entry is selected.
+ """
+ def __init__(self, section, etype, node):
+ bss_pad = state.GetEntryArgBool('vpl-bss-pad')
+ super().__init__(section, etype, node, 'u-boot-vpl', 'u-boot-vpl-dtb',
+ bss_pad)
+
+ @classmethod
+ def UseExpanded(cls, node, etype, new_etype):
+ val = state.GetEntryArgBool('vpl-dtb')
+ tout.do_output(tout.INFO if val else tout.DETAIL,
+ "Node '%s': etype '%s': %s %sselected" %
+ (node.path, etype, new_etype, '' if val else 'not '))
+ return val
diff --git a/tools/binman/etype/u_boot_vpl_nodtb.py b/tools/binman/etype/u_boot_vpl_nodtb.py
new file mode 100644
index 00000000000..25c966cf342
--- /dev/null
+++ b/tools/binman/etype/u_boot_vpl_nodtb.py
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# Entry-type module for 'u-boot-vpl-nodtb.bin'
+#
+
+from binman import elf
+from binman.entry import Entry
+from binman.etype.blob import Entry_blob
+
+class Entry_u_boot_vpl_nodtb(Entry_blob):
+ """VPL binary without device tree appended
+
+ Properties / Entry arguments:
+ - filename: Filename to include (default 'vpl/u-boot-vpl-nodtb.bin')
+
+ This is the U-Boot VPL binary, It does not include a device tree blob at
+ the end of it so may not be able to work without it, assuming VPL needs
+ a device tree to operate on your platform. You can add a u_boot_vpl_dtb
+ entry after this one, or use a u_boot_vpl entry instead, which normally
+ expands to a section containing u-boot-vpl-dtb, u-boot-vpl-bss-pad and
+ u-boot-vpl-dtb
+
+ VPL can access binman symbols at runtime. See:
+
+ 'Access to binman entry offsets at run time (symbols)'
+
+ in the binman README for more information.
+
+ The ELF file 'vpl/u-boot-vpl' must also be available for this to work, since
+ binman uses that to look up symbols to write into the VPL binary.
+ """
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node)
+ self.elf_fname = 'vpl/u-boot-vpl'
+
+ def GetDefaultFilename(self):
+ return 'vpl/u-boot-vpl-nodtb.bin'
+
+ def WriteSymbols(self, section):
+ elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 0b1774046f7..ecb35956031 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -44,12 +44,14 @@ U_BOOT_DATA = b'1234'
U_BOOT_IMG_DATA = b'img'
U_BOOT_SPL_DATA = b'56780123456789abcdefghijklm'
U_BOOT_TPL_DATA = b'tpl9876543210fedcbazywvuts'
+U_BOOT_VPL_DATA = b'vpl76543210fedcbazywxyz_'
BLOB_DATA = b'89'
ME_DATA = b'0abcd'
VGA_DATA = b'vga'
U_BOOT_DTB_DATA = b'udtb'
U_BOOT_SPL_DTB_DATA = b'spldtb'
U_BOOT_TPL_DTB_DATA = b'tpldtb'
+U_BOOT_VPL_DTB_DATA = b'vpldtb'
X86_START16_DATA = b'start16'
X86_START16_SPL_DATA = b'start16spl'
X86_START16_TPL_DATA = b'start16tpl'
@@ -60,6 +62,7 @@ PPC_MPC85XX_BR_DATA = b'ppcmpc85xxbr'
U_BOOT_NODTB_DATA = b'nodtb with microcode pointer somewhere in here'
U_BOOT_SPL_NODTB_DATA = b'splnodtb with microcode pointer somewhere in here'
U_BOOT_TPL_NODTB_DATA = b'tplnodtb with microcode pointer somewhere in here'
+U_BOOT_VPL_NODTB_DATA = b'vplnodtb'
U_BOOT_EXP_DATA = U_BOOT_NODTB_DATA + U_BOOT_DTB_DATA
U_BOOT_SPL_EXP_DATA = U_BOOT_SPL_NODTB_DATA + U_BOOT_SPL_DTB_DATA
U_BOOT_TPL_EXP_DATA = U_BOOT_TPL_NODTB_DATA + U_BOOT_TPL_DTB_DATA
@@ -140,6 +143,7 @@ class TestFunctional(unittest.TestCase):
TestFunctional._MakeInputFile('u-boot.img', U_BOOT_IMG_DATA)
TestFunctional._MakeInputFile('spl/u-boot-spl.bin', U_BOOT_SPL_DATA)
TestFunctional._MakeInputFile('tpl/u-boot-tpl.bin', U_BOOT_TPL_DATA)
+ TestFunctional._MakeInputFile('vpl/u-boot-vpl.bin', U_BOOT_VPL_DATA)
TestFunctional._MakeInputFile('blobfile', BLOB_DATA)
TestFunctional._MakeInputFile('me.bin', ME_DATA)
TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
@@ -165,6 +169,8 @@ class TestFunctional(unittest.TestCase):
U_BOOT_SPL_NODTB_DATA)
TestFunctional._MakeInputFile('tpl/u-boot-tpl-nodtb.bin',
U_BOOT_TPL_NODTB_DATA)
+ TestFunctional._MakeInputFile('vpl/u-boot-vpl-nodtb.bin',
+ U_BOOT_VPL_NODTB_DATA)
TestFunctional._MakeInputFile('fsp.bin', FSP_DATA)
TestFunctional._MakeInputFile('cmc.bin', CMC_DATA)
TestFunctional._MakeInputFile('vbt.bin', VBT_DATA)
@@ -296,6 +302,7 @@ class TestFunctional(unittest.TestCase):
TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA)
TestFunctional._MakeInputFile('spl/u-boot-spl.dtb', U_BOOT_SPL_DTB_DATA)
TestFunctional._MakeInputFile('tpl/u-boot-tpl.dtb', U_BOOT_TPL_DTB_DATA)
+ TestFunctional._MakeInputFile('vpl/u-boot-vpl.dtb', U_BOOT_VPL_DTB_DATA)
def _RunBinman(self, *args, **kwargs):
"""Run binman using the command line
@@ -431,8 +438,8 @@ class TestFunctional(unittest.TestCase):
shutil.rmtree(tmpdir)
return data
- def _GetDtbContentsForSplTpl(self, dtb_data, name):
- """Create a version of the main DTB for SPL or SPL
+ def _GetDtbContentsForSpls(self, dtb_data, name):
+ """Create a version of the main DTB for SPL / TPL / VPL
For testing we don't actually have different versions of the DTB. With
U-Boot we normally run fdtgrep to remove unwanted nodes, but for tests
@@ -502,11 +509,11 @@ class TestFunctional(unittest.TestCase):
# For testing purposes, make a copy of the DT for SPL and TPL. Add
# a node indicating which it is, so aid verification.
- for name in ['spl', 'tpl']:
+ for name in ['spl', 'tpl', 'vpl']:
dtb_fname = '%s/u-boot-%s.dtb' % (name, name)
outfile = os.path.join(self._indir, dtb_fname)
TestFunctional._MakeInputFile(dtb_fname,
- self._GetDtbContentsForSplTpl(dtb_data, name))
+ self._GetDtbContentsForSpls(dtb_data, name))
try:
retcode = self._DoTestFile(fname, map=map, update_dtb=update_dtb,
@@ -613,6 +620,16 @@ class TestFunctional(unittest.TestCase):
tools.read_file(cls.ElfTestFile(src_fname)))
@classmethod
+ def _SetupVplElf(cls, src_fname='bss_data'):
+ """Set up an ELF file with a '_dt_ucode_base_size' symbol
+
+ Args:
+ Filename of ELF file to use as VPL
+ """
+ TestFunctional._MakeInputFile('vpl/u-boot-vpl',
+ tools.read_file(cls.ElfTestFile(src_fname)))
+
+ @classmethod
def _SetupDescriptor(cls):
with open(cls.TestFile('descriptor.bin'), 'rb') as fd:
TestFunctional._MakeInputFile('descriptor.bin', fd.read())
@@ -1907,21 +1924,24 @@ class TestFunctional(unittest.TestCase):
data = self._DoReadFileRealDtb('082_fdt_update_all.dts')
base_expected = {
- 'section:image-pos': 0,
- 'u-boot-tpl-dtb:size': 513,
- 'u-boot-spl-dtb:size': 513,
- 'u-boot-spl-dtb:offset': 493,
- 'image-pos': 0,
- 'section/u-boot-dtb:image-pos': 0,
- 'u-boot-spl-dtb:image-pos': 493,
- 'section/u-boot-dtb:size': 493,
- 'u-boot-tpl-dtb:image-pos': 1006,
- 'section/u-boot-dtb:offset': 0,
- 'section:size': 493,
'offset': 0,
+ 'image-pos': 0,
+ 'size': 2320,
'section:offset': 0,
- 'u-boot-tpl-dtb:offset': 1006,
- 'size': 1519
+ 'section:image-pos': 0,
+ 'section:size': 565,
+ 'section/u-boot-dtb:offset': 0,
+ 'section/u-boot-dtb:image-pos': 0,
+ 'section/u-boot-dtb:size': 565,
+ 'u-boot-spl-dtb:offset': 565,
+ 'u-boot-spl-dtb:image-pos': 565,
+ 'u-boot-spl-dtb:size': 585,
+ 'u-boot-tpl-dtb:offset': 1150,
+ 'u-boot-tpl-dtb:image-pos': 1150,
+ 'u-boot-tpl-dtb:size': 585,
+ 'u-boot-vpl-dtb:image-pos': 1735,
+ 'u-boot-vpl-dtb:offset': 1735,
+ 'u-boot-vpl-dtb:size': 585,
}
# We expect three device-tree files in the output, one after the other.
@@ -1929,11 +1949,12 @@ class TestFunctional(unittest.TestCase):
# and 'tpl' in the TPL tree, to make sure they are distinct from the
# main U-Boot tree. All three should have the same postions and offset.
start = 0
- for item in ['', 'spl', 'tpl']:
+ self.maxDiff = None
+ for item in ['', 'spl', 'tpl', 'vpl']:
dtb = fdt.Fdt.FromData(data[start:])
dtb.Scan()
props = self._GetPropTree(dtb, BASE_DTB_PROPS + REPACK_DTB_PROPS +
- ['spl', 'tpl'])
+ ['spl', 'tpl', 'vpl'])
expected = dict(base_expected)
if item:
expected[item] = 0
@@ -1953,7 +1974,7 @@ class TestFunctional(unittest.TestCase):
# over to the expected place.
start = 0
for fname in ['u-boot.dtb.out', 'spl/u-boot-spl.dtb.out',
- 'tpl/u-boot-tpl.dtb.out']:
+ 'tpl/u-boot-tpl.dtb.out', 'vpl/u-boot-vpl.dtb.out']:
dtb = fdt.Fdt.FromData(data[start:])
size = dtb._fdt_obj.totalsize()
pathname = tools.get_output_filename(os.path.split(fname)[1])
@@ -1961,7 +1982,7 @@ class TestFunctional(unittest.TestCase):
name = os.path.split(fname)[0]
if name:
- orig_indata = self._GetDtbContentsForSplTpl(dtb_data, name)
+ orig_indata = self._GetDtbContentsForSpls(dtb_data, name)
else:
orig_indata = dtb_data
self.assertNotEqual(outdata, orig_indata,
@@ -5351,16 +5372,6 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
"Node '/binman/u-boot': Please use 'extend-size' instead of 'expand-size'",
str(e.exception))
- def testMkimageMissingBlob(self):
- """Test using mkimage to build an image"""
- with test_util.capture_sys_output() as (stdout, stderr):
- self._DoTestFile('229_mkimage_missing.dts', allow_missing=True,
- allow_fake_blobs=True)
- err = stderr.getvalue()
- self.assertRegex(
- err,
- "Image '.*' has faked external blobs and is non-functional: .*")
-
def testFitSplitElf(self):
"""Test an image with an FIT with an split-elf operation"""
if not elf.ELF_TOOLS:
@@ -5461,24 +5472,6 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
"Node '/binman/fit': subnode 'images/@atf-SEQ': Failed to read ELF file: Magic number does not match",
str(exc.exception))
- def testFitSplitElfBadDirective(self):
- """Test a FIT split-elf invalid fit,xxx directive in an image node"""
- if not elf.ELF_TOOLS:
- self.skipTest('Python elftools not available')
- err = self._check_bad_fit('227_fit_bad_dir.dts')
- self.assertIn(
- "Node '/binman/fit': subnode 'images/@atf-SEQ': Unknown directive 'fit,something'",
- err)
-
- def testFitSplitElfBadDirectiveConfig(self):
- """Test a FIT split-elf with invalid fit,xxx directive in config"""
- if not elf.ELF_TOOLS:
- self.skipTest('Python elftools not available')
- err = self._check_bad_fit('228_fit_bad_dir_config.dts')
- self.assertEqual(
- "Node '/binman/fit': subnode 'configurations/@config-SEQ': Unknown directive 'fit,config'",
- err)
-
def checkFitSplitElf(self, **kwargs):
"""Test an split-elf FIT with a missing ELF file
@@ -5505,6 +5498,25 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
err = stderr.getvalue()
return out, err
+ def testFitSplitElfBadDirective(self):
+ """Test a FIT split-elf invalid fit,xxx directive in an image node"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
+ err = self._check_bad_fit('227_fit_bad_dir.dts')
+ self.assertIn(
+ "Node '/binman/fit': subnode 'images/@atf-SEQ': Unknown directive 'fit,something'",
+ err)
+
+ def testFitSplitElfBadDirectiveConfig(self):
+ """Test a FIT split-elf with invalid fit,xxx directive in config"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
+ err = self._check_bad_fit('228_fit_bad_dir_config.dts')
+ self.assertEqual(
+ "Node '/binman/fit': subnode 'configurations/@config-SEQ': Unknown directive 'fit,config'",
+ err)
+
+
def testFitSplitElfMissing(self):
"""Test an split-elf FIT with a missing ELF file"""
if not elf.ELF_TOOLS:
@@ -5531,31 +5543,41 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
fname = tools.get_output_filename('binman-fake/missing.elf')
self.assertTrue(os.path.exists(fname))
+ def testMkimageMissingBlob(self):
+ """Test using mkimage to build an image"""
+ with test_util.capture_sys_output() as (stdout, stderr):
+ self._DoTestFile('229_mkimage_missing.dts', allow_missing=True,
+ allow_fake_blobs=True)
+ err = stderr.getvalue()
+ self.assertRegex(
+ err,
+ "Image '.*' has faked external blobs and is non-functional: .*")
+
def testPreLoad(self):
"""Test an image with a pre-load header"""
entry_args = {
'pre-load-key-path': '.',
}
- data, _, _, _ = self._DoReadFileDtb('225_pre_load.dts',
+ data, _, _, _ = self._DoReadFileDtb('230_pre_load.dts',
entry_args=entry_args)
self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)])
self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)])
self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)])
- data = self._DoReadFile('225_pre_load.dts')
+ data = self._DoReadFile('230_pre_load.dts')
self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)])
self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)])
self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)])
def testPreLoadPkcs(self):
"""Test an image with a pre-load header with padding pkcs"""
- data = self._DoReadFile('226_pre_load_pkcs.dts')
+ data = self._DoReadFile('231_pre_load_pkcs.dts')
self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)])
self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)])
self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)])
def testPreLoadPss(self):
"""Test an image with a pre-load header with padding pss"""
- data = self._DoReadFile('227_pre_load_pss.dts')
+ data = self._DoReadFile('232_pre_load_pss.dts')
self.assertEqual(PRE_LOAD_MAGIC, data[:len(PRE_LOAD_MAGIC)])
self.assertEqual(PRE_LOAD_VERSION, data[4:4 + len(PRE_LOAD_VERSION)])
self.assertEqual(PRE_LOAD_HDR_SIZE, data[8:8 + len(PRE_LOAD_HDR_SIZE)])
@@ -5563,22 +5585,22 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testPreLoadInvalidPadding(self):
"""Test an image with a pre-load header with an invalid padding"""
with self.assertRaises(ValueError) as e:
- data = self._DoReadFile('228_pre_load_invalid_padding.dts')
+ data = self._DoReadFile('233_pre_load_invalid_padding.dts')
def testPreLoadInvalidSha(self):
"""Test an image with a pre-load header with an invalid hash"""
with self.assertRaises(ValueError) as e:
- data = self._DoReadFile('229_pre_load_invalid_sha.dts')
+ data = self._DoReadFile('234_pre_load_invalid_sha.dts')
def testPreLoadInvalidAlgo(self):
"""Test an image with a pre-load header with an invalid algo"""
with self.assertRaises(ValueError) as e:
- data = self._DoReadFile('230_pre_load_invalid_algo.dts')
+ data = self._DoReadFile('235_pre_load_invalid_algo.dts')
def testPreLoadInvalidKey(self):
"""Test an image with a pre-load header with an invalid key"""
with self.assertRaises(ValueError) as e:
- data = self._DoReadFile('231_pre_load_invalid_key.dts')
+ data = self._DoReadFile('236_pre_load_invalid_key.dts')
def _CheckSafeUniqueNames(self, *images):
"""Check all entries of given images for unsafe unique names"""
@@ -5593,7 +5615,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testSafeUniqueNames(self):
"""Test entry unique names are safe in single image configuration"""
- data = self._DoReadFileRealDtb('230_unique_names.dts')
+ data = self._DoReadFileRealDtb('237_unique_names.dts')
orig_image = control.images['image']
image_fname = tools.get_output_filename('image.bin')
@@ -5603,7 +5625,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testSafeUniqueNamesMulti(self):
"""Test entry unique names are safe with multiple images"""
- data = self._DoReadFileRealDtb('231_unique_names_multi.dts')
+ data = self._DoReadFileRealDtb('238_unique_names_multi.dts')
orig_image = control.images['image']
image_fname = tools.get_output_filename('image.bin')
@@ -5613,7 +5635,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testReplaceCmdWithBintool(self):
"""Test replacing an entry that needs a bintool to pack"""
- data = self._DoReadFileRealDtb('232_replace_with_bintool.dts')
+ data = self._DoReadFileRealDtb('239_replace_with_bintool.dts')
expected = U_BOOT_DATA + b'aa'
self.assertEqual(expected, data[:len(expected)])
@@ -5632,7 +5654,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testReplaceCmdOtherWithBintool(self):
"""Test replacing an entry when another needs a bintool to pack"""
- data = self._DoReadFileRealDtb('232_replace_with_bintool.dts')
+ data = self._DoReadFileRealDtb('239_replace_with_bintool.dts')
expected = U_BOOT_DATA + b'aa'
self.assertEqual(expected, data[:len(expected)])
@@ -5672,7 +5694,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testExtractFit(self):
"""Test extracting a FIT section"""
- self._DoReadFileRealDtb('233_fit_extract_replace.dts')
+ self._DoReadFileRealDtb('240_fit_extract_replace.dts')
image_fname = tools.get_output_filename('image.bin')
fit_data = control.ReadEntry(image_fname, 'fit')
@@ -5691,7 +5713,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testExtractFitSubentries(self):
"""Test extracting FIT section subentries"""
- self._DoReadFileRealDtb('233_fit_extract_replace.dts')
+ self._DoReadFileRealDtb('240_fit_extract_replace.dts')
image_fname = tools.get_output_filename('image.bin')
for entry_path, expected in [
@@ -5710,7 +5732,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
new_data = b'x' * len(U_BOOT_DATA)
data, expected_fdtmap, _ = self._RunReplaceCmd(
'fit/kernel/u-boot', new_data,
- dts='233_fit_extract_replace.dts')
+ dts='240_fit_extract_replace.dts')
self.assertEqual(new_data, data)
path, fdtmap = state.GetFdtContents('fdtmap')
@@ -5722,7 +5744,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
new_data = b'ub' * len(U_BOOT_NODTB_DATA)
data, expected_fdtmap, _ = self._RunReplaceCmd(
'fit/fdt-1/u-boot-nodtb', new_data,
- dts='233_fit_extract_replace.dts')
+ dts='240_fit_extract_replace.dts')
self.assertEqual(new_data, data)
# Will be repacked, so fdtmap must change
@@ -5736,7 +5758,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
expected = new_data.ljust(len(U_BOOT_NODTB_DATA), b'\0')
data, expected_fdtmap, _ = self._RunReplaceCmd(
'fit/fdt-1/u-boot-nodtb', new_data,
- dts='233_fit_extract_replace.dts')
+ dts='240_fit_extract_replace.dts')
self.assertEqual(expected, data)
path, fdtmap = state.GetFdtContents('fdtmap')
@@ -5748,14 +5770,14 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
new_data = b'w' * len(COMPRESS_DATA + U_BOOT_DATA)
with self.assertRaises(ValueError) as exc:
self._RunReplaceCmd('section', new_data,
- dts='234_replace_section_simple.dts')
+ dts='241_replace_section_simple.dts')
self.assertIn(
"Node '/section': Replacing sections is not implemented yet",
str(exc.exception))
def testMkimageImagename(self):
"""Test using mkimage with -n holding the data too"""
- data = self._DoReadFile('235_mkimage_name.dts')
+ data = self._DoReadFile('242_mkimage_name.dts')
# Check that the data appears in the file somewhere
self.assertIn(U_BOOT_SPL_DATA, data)
@@ -5772,7 +5794,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testMkimageImage(self):
"""Test using mkimage with -n holding the data too"""
- data = self._DoReadFile('236_mkimage_image.dts')
+ data = self._DoReadFile('243_mkimage_image.dts')
# Check that the data appears in the file somewhere
self.assertIn(U_BOOT_SPL_DATA, data)
@@ -5793,20 +5815,20 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testMkimageImageNoContent(self):
"""Test using mkimage with -n and no data"""
with self.assertRaises(ValueError) as exc:
- self._DoReadFile('237_mkimage_image_no_content.dts')
+ self._DoReadFile('244_mkimage_image_no_content.dts')
self.assertIn('Could not complete processing of contents',
str(exc.exception))
def testMkimageImageBad(self):
"""Test using mkimage with imagename node and data-to-imagename"""
with self.assertRaises(ValueError) as exc:
- self._DoReadFile('238_mkimage_image_bad.dts')
+ self._DoReadFile('245_mkimage_image_bad.dts')
self.assertIn('Cannot use both imagename node and data-to-imagename',
str(exc.exception))
def testCollectionOther(self):
"""Test a collection where the data comes from another section"""
- data = self._DoReadFile('239_collection_other.dts')
+ data = self._DoReadFile('246_collection_other.dts')
self.assertEqual(U_BOOT_NODTB_DATA + U_BOOT_DTB_DATA +
tools.get_bytes(0xff, 2) + U_BOOT_NODTB_DATA +
tools.get_bytes(0xfe, 3) + U_BOOT_DTB_DATA,
@@ -5814,20 +5836,20 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testMkimageCollection(self):
"""Test using a collection referring to an entry in a mkimage entry"""
- data = self._DoReadFile('240_mkimage_coll.dts')
+ data = self._DoReadFile('247_mkimage_coll.dts')
expect = U_BOOT_SPL_DATA + U_BOOT_DATA
self.assertEqual(expect, data[:len(expect)])
def testCompressDtbPrependInvalid(self):
"""Test that invalid header is detected"""
with self.assertRaises(ValueError) as e:
- self._DoReadFileDtb('235_compress_dtb_prepend_invalid.dts')
+ self._DoReadFileDtb('248_compress_dtb_prepend_invalid.dts')
self.assertIn("Node '/binman/u-boot-dtb': Invalid prepend in "
"'u-boot-dtb': 'invalid'", str(e.exception))
def testCompressDtbPrependLength(self):
"""Test that compress with length header works as expected"""
- data = self._DoReadFileRealDtb('236_compress_dtb_prepend_length.dts')
+ data = self._DoReadFileRealDtb('249_compress_dtb_prepend_length.dts')
image = control.images['image']
entries = image.GetEntries()
self.assertIn('u-boot-dtb', entries)
@@ -5860,7 +5882,7 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testInvalidCompress(self):
"""Test that invalid compress algorithm is detected"""
with self.assertRaises(ValueError) as e:
- self._DoTestFile('237_compress_dtb_invalid.dts')
+ self._DoTestFile('250_compress_dtb_invalid.dts')
self.assertIn("Unknown algorithm 'invalid'", str(e.exception))
def testCompUtilCompressions(self):
@@ -5893,10 +5915,86 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
def testCompressDtbZstd(self):
"""Test that zstd compress of device-tree files failed"""
with self.assertRaises(ValueError) as e:
- self._DoTestFile('238_compress_dtb_zstd.dts')
+ self._DoTestFile('251_compress_dtb_zstd.dts')
self.assertIn("Node '/binman/u-boot-dtb': The zstd compression "
"requires a length header", str(e.exception))
+ def testMkimageMultipleDataFiles(self):
+ """Test passing multiple files to mkimage in a mkimage entry"""
+ data = self._DoReadFile('252_mkimage_mult_data.dts')
+ # Size of files are packed in their 4B big-endian format
+ expect = struct.pack('>I', len(U_BOOT_TPL_DATA))
+ expect += struct.pack('>I', len(U_BOOT_SPL_DATA))
+ # Size info is always followed by a 4B zero value.
+ expect += tools.get_bytes(0, 4)
+ expect += U_BOOT_TPL_DATA
+ # All but last files are 4B-aligned
+ align_pad = len(U_BOOT_TPL_DATA) % 4
+ if align_pad:
+ expect += tools.get_bytes(0, align_pad)
+ expect += U_BOOT_SPL_DATA
+ self.assertEqual(expect, data[-len(expect):])
+
+ def testMkimageMultipleNoContent(self):
+ """Test passing multiple data files to mkimage with one data file having no content"""
+ with self.assertRaises(ValueError) as exc:
+ self._DoReadFile('253_mkimage_mult_no_content.dts')
+ self.assertIn('Could not complete processing of contents',
+ str(exc.exception))
+
+ def testMkimageFilename(self):
+ """Test using mkimage to build a binary with a filename"""
+ retcode = self._DoTestFile('254_mkimage_filename.dts')
+ self.assertEqual(0, retcode)
+ fname = tools.get_output_filename('mkimage-test.bin')
+ self.assertTrue(os.path.exists(fname))
+
+ def testVpl(self):
+ """Test that an image with VPL and its device tree can be created"""
+ # ELF file with a '__bss_size' symbol
+ self._SetupVplElf()
+ data = self._DoReadFile('255_u_boot_vpl.dts')
+ self.assertEqual(U_BOOT_VPL_DATA + U_BOOT_VPL_DTB_DATA, data)
+
+ def testVplNoDtb(self):
+ """Test that an image with vpl/u-boot-vpl-nodtb.bin can be created"""
+ self._SetupVplElf()
+ data = self._DoReadFile('256_u_boot_vpl_nodtb.dts')
+ self.assertEqual(U_BOOT_VPL_NODTB_DATA,
+ data[:len(U_BOOT_VPL_NODTB_DATA)])
+
+ def testExpandedVpl(self):
+ """Test that an expanded entry type is selected for TPL when needed"""
+ self._SetupVplElf()
+
+ entry_args = {
+ 'vpl-bss-pad': 'y',
+ 'vpl-dtb': 'y',
+ }
+ self._DoReadFileDtb('257_fdt_incl_vpl.dts', use_expanded=True,
+ entry_args=entry_args)
+ image = control.images['image']
+ entries = image.GetEntries()
+ self.assertEqual(1, len(entries))
+
+ # We only have u-boot-vpl, which be expanded
+ self.assertIn('u-boot-vpl', entries)
+ entry = entries['u-boot-vpl']
+ self.assertEqual('u-boot-vpl-expanded', entry.etype)
+ subent = entry.GetEntries()
+ self.assertEqual(3, len(subent))
+ self.assertIn('u-boot-vpl-nodtb', subent)
+ self.assertIn('u-boot-vpl-bss-pad', subent)
+ self.assertIn('u-boot-vpl-dtb', subent)
+
+ def testVplBssPadMissing(self):
+ """Test that a missing symbol is detected"""
+ self._SetupVplElf('u_boot_ucode_ptr')
+ with self.assertRaises(ValueError) as e:
+ self._DoReadFile('258_vpl_bss_pad.dts')
+ self.assertIn('Expected __bss_size symbol in vpl/u-boot-vpl',
+ str(e.exception))
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/binman/state.py b/tools/binman/state.py
index a302e1f00eb..56e5bf8bc10 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -22,6 +22,7 @@ OUR_PATH = os.path.dirname(os.path.realpath(__file__))
DTB_TYPE_FNAME = {
'u-boot-spl-dtb': 'spl/u-boot-spl.dtb',
'u-boot-tpl-dtb': 'tpl/u-boot-tpl.dtb',
+ 'u-boot-vpl-dtb': 'vpl/u-boot-vpl.dtb',
}
# Records the device-tree files known to binman, keyed by entry type (e.g.
@@ -292,7 +293,7 @@ def GetAllFdts():
"""Yield all device tree files being used by binman
Yields:
- Device trees being used (U-Boot proper, SPL, TPL)
+ Device trees being used (U-Boot proper, SPL, TPL, VPL)
"""
if main_dtb:
yield main_dtb
diff --git a/tools/binman/test/082_fdt_update_all.dts b/tools/binman/test/082_fdt_update_all.dts
index 284975cc289..1aea56989f0 100644
--- a/tools/binman/test/082_fdt_update_all.dts
+++ b/tools/binman/test/082_fdt_update_all.dts
@@ -14,5 +14,7 @@
};
u-boot-tpl-dtb {
};
+ u-boot-vpl-dtb {
+ };
};
};
diff --git a/tools/binman/test/225_dev.key b/tools/binman/test/230_dev.key
index b36bad2cfb3..b36bad2cfb3 100644
--- a/tools/binman/test/225_dev.key
+++ b/tools/binman/test/230_dev.key
diff --git a/tools/binman/test/225_pre_load.dts b/tools/binman/test/230_pre_load.dts
index c1ffe1a2ff4..c0c24729f82 100644
--- a/tools/binman/test/225_pre_load.dts
+++ b/tools/binman/test/230_pre_load.dts
@@ -10,7 +10,7 @@
pre-load {
content = <&image>;
algo-name = "sha256,rsa2048";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <0x11223344>;
};
diff --git a/tools/binman/test/226_pre_load_pkcs.dts b/tools/binman/test/231_pre_load_pkcs.dts
index 3db0a37f774..530638c56b6 100644
--- a/tools/binman/test/226_pre_load_pkcs.dts
+++ b/tools/binman/test/231_pre_load_pkcs.dts
@@ -11,7 +11,7 @@
content = <&image>;
algo-name = "sha256,rsa2048";
padding-name = "pkcs-1.5";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <0x11223344>;
};
diff --git a/tools/binman/test/227_pre_load_pss.dts b/tools/binman/test/232_pre_load_pss.dts
index b1b01d5ad58..371e0fdb408 100644
--- a/tools/binman/test/227_pre_load_pss.dts
+++ b/tools/binman/test/232_pre_load_pss.dts
@@ -11,7 +11,7 @@
content = <&image>;
algo-name = "sha256,rsa2048";
padding-name = "pss";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <0x11223344>;
};
diff --git a/tools/binman/test/228_pre_load_invalid_padding.dts b/tools/binman/test/233_pre_load_invalid_padding.dts
index 84fe289183f..9cb4cb570bc 100644
--- a/tools/binman/test/228_pre_load_invalid_padding.dts
+++ b/tools/binman/test/233_pre_load_invalid_padding.dts
@@ -11,7 +11,7 @@
content = <&image>;
algo-name = "sha256,rsa2048";
padding-name = "padding";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <1>;
};
diff --git a/tools/binman/test/229_pre_load_invalid_sha.dts b/tools/binman/test/234_pre_load_invalid_sha.dts
index a2b6725c892..8ded98df533 100644
--- a/tools/binman/test/229_pre_load_invalid_sha.dts
+++ b/tools/binman/test/234_pre_load_invalid_sha.dts
@@ -11,7 +11,7 @@
content = <&image>;
algo-name = "sha2560,rsa2048";
padding-name = "pkcs-1.5";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <1>;
};
diff --git a/tools/binman/test/230_pre_load_invalid_algo.dts b/tools/binman/test/235_pre_load_invalid_algo.dts
index 34c8d34f157..145286caa3e 100644
--- a/tools/binman/test/230_pre_load_invalid_algo.dts
+++ b/tools/binman/test/235_pre_load_invalid_algo.dts
@@ -11,7 +11,7 @@
content = <&image>;
algo-name = "sha256,rsa20480";
padding-name = "pkcs-1.5";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <1>;
};
diff --git a/tools/binman/test/231_pre_load_invalid_key.dts b/tools/binman/test/236_pre_load_invalid_key.dts
index 08d5a75ddfd..df858c3a28b 100644
--- a/tools/binman/test/231_pre_load_invalid_key.dts
+++ b/tools/binman/test/236_pre_load_invalid_key.dts
@@ -11,7 +11,7 @@
content = <&image>;
algo-name = "sha256,rsa4096";
padding-name = "pkcs-1.5";
- key-name = "tools/binman/test/225_dev.key";
+ key-name = "tools/binman/test/230_dev.key";
header-size = <4096>;
version = <1>;
};
diff --git a/tools/binman/test/230_unique_names.dts b/tools/binman/test/237_unique_names.dts
index 6780d37f71f..6780d37f71f 100644
--- a/tools/binman/test/230_unique_names.dts
+++ b/tools/binman/test/237_unique_names.dts
diff --git a/tools/binman/test/231_unique_names_multi.dts b/tools/binman/test/238_unique_names_multi.dts
index db63afb445e..db63afb445e 100644
--- a/tools/binman/test/231_unique_names_multi.dts
+++ b/tools/binman/test/238_unique_names_multi.dts
diff --git a/tools/binman/test/232_replace_with_bintool.dts b/tools/binman/test/239_replace_with_bintool.dts
index d7fabd2cd83..d7fabd2cd83 100644
--- a/tools/binman/test/232_replace_with_bintool.dts
+++ b/tools/binman/test/239_replace_with_bintool.dts
diff --git a/tools/binman/test/233_fit_extract_replace.dts b/tools/binman/test/240_fit_extract_replace.dts
index b44d05afe1a..b44d05afe1a 100644
--- a/tools/binman/test/233_fit_extract_replace.dts
+++ b/tools/binman/test/240_fit_extract_replace.dts
diff --git a/tools/binman/test/234_replace_section_simple.dts b/tools/binman/test/241_replace_section_simple.dts
index c9d5c328561..c9d5c328561 100644
--- a/tools/binman/test/234_replace_section_simple.dts
+++ b/tools/binman/test/241_replace_section_simple.dts
diff --git a/tools/binman/test/235_mkimage_name.dts b/tools/binman/test/242_mkimage_name.dts
index fbc82f1f8d6..fbc82f1f8d6 100644
--- a/tools/binman/test/235_mkimage_name.dts
+++ b/tools/binman/test/242_mkimage_name.dts
diff --git a/tools/binman/test/236_mkimage_image.dts b/tools/binman/test/243_mkimage_image.dts
index 6b8f4a4a401..6b8f4a4a401 100644
--- a/tools/binman/test/236_mkimage_image.dts
+++ b/tools/binman/test/243_mkimage_image.dts
diff --git a/tools/binman/test/237_mkimage_image_no_content.dts b/tools/binman/test/244_mkimage_image_no_content.dts
index 7306c06af45..7306c06af45 100644
--- a/tools/binman/test/237_mkimage_image_no_content.dts
+++ b/tools/binman/test/244_mkimage_image_no_content.dts
diff --git a/tools/binman/test/238_mkimage_image_bad.dts b/tools/binman/test/245_mkimage_image_bad.dts
index 54d2c99d628..54d2c99d628 100644
--- a/tools/binman/test/238_mkimage_image_bad.dts
+++ b/tools/binman/test/245_mkimage_image_bad.dts
diff --git a/tools/binman/test/239_collection_other.dts b/tools/binman/test/246_collection_other.dts
index 09de20e5bca..09de20e5bca 100644
--- a/tools/binman/test/239_collection_other.dts
+++ b/tools/binman/test/246_collection_other.dts
diff --git a/tools/binman/test/240_mkimage_coll.dts b/tools/binman/test/247_mkimage_coll.dts
index 30860118860..30860118860 100644
--- a/tools/binman/test/240_mkimage_coll.dts
+++ b/tools/binman/test/247_mkimage_coll.dts
diff --git a/tools/binman/test/235_compress_dtb_prepend_invalid.dts b/tools/binman/test/248_compress_dtb_prepend_invalid.dts
index ee32670a913..ee32670a913 100644
--- a/tools/binman/test/235_compress_dtb_prepend_invalid.dts
+++ b/tools/binman/test/248_compress_dtb_prepend_invalid.dts
diff --git a/tools/binman/test/236_compress_dtb_prepend_length.dts b/tools/binman/test/249_compress_dtb_prepend_length.dts
index 1570233637a..1570233637a 100644
--- a/tools/binman/test/236_compress_dtb_prepend_length.dts
+++ b/tools/binman/test/249_compress_dtb_prepend_length.dts
diff --git a/tools/binman/test/237_compress_dtb_invalid.dts b/tools/binman/test/250_compress_dtb_invalid.dts
index 228139060bc..228139060bc 100644
--- a/tools/binman/test/237_compress_dtb_invalid.dts
+++ b/tools/binman/test/250_compress_dtb_invalid.dts
diff --git a/tools/binman/test/238_compress_dtb_zstd.dts b/tools/binman/test/251_compress_dtb_zstd.dts
index 90cf85d1e2c..90cf85d1e2c 100644
--- a/tools/binman/test/238_compress_dtb_zstd.dts
+++ b/tools/binman/test/251_compress_dtb_zstd.dts
diff --git a/tools/binman/test/252_mkimage_mult_data.dts b/tools/binman/test/252_mkimage_mult_data.dts
new file mode 100644
index 00000000000..a092bc39bf3
--- /dev/null
+++ b/tools/binman/test/252_mkimage_mult_data.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ mkimage {
+ args = "-T script";
+ multiple-data-files;
+
+ u-boot-tpl {
+ };
+
+ u-boot-spl {
+ };
+ };
+ };
+};
diff --git a/tools/binman/test/253_mkimage_mult_no_content.dts b/tools/binman/test/253_mkimage_mult_no_content.dts
new file mode 100644
index 00000000000..dd65666c62e
--- /dev/null
+++ b/tools/binman/test/253_mkimage_mult_no_content.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ mkimage {
+ args = "-T script";
+ multiple-data-files;
+
+ _testing {
+ return-unknown-contents;
+ };
+
+ u-boot-spl {
+ };
+ };
+ };
+};
diff --git a/tools/binman/test/254_mkimage_filename.dts b/tools/binman/test/254_mkimage_filename.dts
new file mode 100644
index 00000000000..4483790ae86
--- /dev/null
+++ b/tools/binman/test/254_mkimage_filename.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ mkimage {
+ filename = "mkimage-test.bin";
+ args = "-T script";
+
+ u-boot-spl {
+ };
+ };
+ };
+};
diff --git a/tools/binman/test/255_u_boot_vpl.dts b/tools/binman/test/255_u_boot_vpl.dts
new file mode 100644
index 00000000000..a3a281a91e0
--- /dev/null
+++ b/tools/binman/test/255_u_boot_vpl.dts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+ binman {
+ u-boot-vpl {
+ };
+ u-boot-vpl-dtb {
+ };
+ };
+};
diff --git a/tools/binman/test/256_u_boot_vpl_nodtb.dts b/tools/binman/test/256_u_boot_vpl_nodtb.dts
new file mode 100644
index 00000000000..055016badd5
--- /dev/null
+++ b/tools/binman/test/256_u_boot_vpl_nodtb.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ u-boot-vpl-nodtb {
+ };
+ };
+};
diff --git a/tools/binman/test/257_fdt_incl_vpl.dts b/tools/binman/test/257_fdt_incl_vpl.dts
new file mode 100644
index 00000000000..435256fe317
--- /dev/null
+++ b/tools/binman/test/257_fdt_incl_vpl.dts
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ u-boot-vpl {
+ };
+ };
+};
diff --git a/tools/binman/test/258_vpl_bss_pad.dts b/tools/binman/test/258_vpl_bss_pad.dts
new file mode 100644
index 00000000000..d308dcade17
--- /dev/null
+++ b/tools/binman/test/258_vpl_bss_pad.dts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ u-boot-vpl {
+ };
+
+ u-boot-vpl-bss-pad {
+ };
+
+ u-boot {
+ };
+ };
+};
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 16bcd4d9a77..da4fe32da22 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -84,7 +84,7 @@ static unsigned char kwboot_msg_debug[] = {
#define KWBOOT_MSG_RSP_TIMEO 50 /* ms */
/* Defines known to work on Armada XP */
-#define KWBOOT_MSG_RSP_TIMEO_AXP 1000 /* ms */
+#define KWBOOT_MSG_RSP_TIMEO_AXP 10 /* ms */
/*
* Xmodem Transfers
diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
index 9226b66f840..8c5c9cc2ccc 100644
--- a/tools/patman/patman.rst
+++ b/tools/patman/patman.rst
@@ -3,7 +3,7 @@
.. Simon Glass <sjg@chromium.org>
.. v1, v2, 19-Oct-11
.. revised v3 24-Nov-11
-.. revised v4 04-Jul-2020, with Patchwork integration
+.. revised v4 Independence Day 2020, with Patchwork integration
Patman patch manager
====================
@@ -11,21 +11,15 @@ Patman patch manager
This tool is a Python script which:
- Creates patch directly from your branch
-
- Cleans them up by removing unwanted tags
-
- Inserts a cover letter with change lists
-
- Runs the patches through checkpatch.pl and its own checks
-
- Optionally emails them out to selected people
It also has some Patchwork features:
- shows review tags from Patchwork so you can update your local patches
-
- pulls these down into a new branch on request
-
- lists comments received on a series
It is intended to automate patch creation and make it a less
@@ -53,15 +47,12 @@ This tool requires a certain way of working:
- Maintain a number of branches, one for each patch series you are
working on
-
- Add tags into the commits within each branch to indicate where the
series should be sent, cover letter, version, etc. Most of these are
normally in the top commit so it is easy to change them with 'git
commit --amend'
-
- Each branch tracks the upstream branch, so that this script can
automatically determine the number of commits in it (optional)
-
- Check out a branch, and run this script to create and send out your
patches. Weeks later, change the patches and repeat, knowing that you
will get a consistent result each time.
@@ -623,41 +614,35 @@ and it will create and send the version 2 series.
General points
--------------
-1. When you change back to the us-cmd branch days or weeks later all your
+#. When you change back to the us-cmd branch days or weeks later all your
information is still there, safely stored in the commits. You don't need
to remember what version you are up to, who you sent the last lot of patches
to, or anything about the change logs.
-
-2. If you put tags in the subject, patman will Cc the maintainers
+#. If you put tags in the subject, patman will Cc the maintainers
automatically in many cases.
-
-3. If you want to keep the commits from each series you sent so that you can
+#. If you want to keep the commits from each series you sent so that you can
compare change and see what you did, you can either create a new branch for
each version, or just tag the branch before you start changing it:
-.. code-block:: bash
+ .. code-block:: bash
git tag sent/us-cmd-rfc
# ...later...
git tag sent/us-cmd-v2
-4. If you want to modify the patches a little before sending, you can do
+#. If you want to modify the patches a little before sending, you can do
this in your editor, but be careful!
-
-5. If you want to run git send-email yourself, use the -n flag which will
+#. If you want to run git send-email yourself, use the -n flag which will
print out the command line patman would have used.
-
-6. It is a good idea to add the change log info as you change the commit,
+#. It is a good idea to add the change log info as you change the commit,
not later when you can't remember which patch you changed. You can always
go back and change or remove logs from commits.
-
-7. Some mailing lists have size limits and when we add binary contents to
+#. Some mailing lists have size limits and when we add binary contents to
our patches it's easy to exceed the size limits. Use "--no-binary" to
generate patches without any binary contents. You are supposed to include
a link to a git repository in your "Commit-notes", "Series-notes" or
"Cover-letter" for maintainers to fetch the original commit.
-
-8. Patches will have no changelog entries for revisions where they did not
+#. Patches will have no changelog entries for revisions where they did not
change. For clarity, if there are no changes for this patch in the most
recent revision of the series, a note will be added. For example, a patch
with the following tags in the commit::
@@ -669,15 +654,15 @@ General points
Series-changes: 4
- Another change
-would have a changelog of:::
+ would have a changelog of:::
- (no changes since v4)
+ (no changes since v4)
- Changes in v4:
- - Another change
+ Changes in v4:
+ - Another change
- Changes in v2:
- - Some change
+ Changes in v2:
+ - Some change
Other thoughts
diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c
index 56200bd9276..7a8d74bb8e4 100644
--- a/tools/sunxi_toc0.c
+++ b/tools/sunxi_toc0.c
@@ -34,7 +34,7 @@
#define pr_warn(fmt, args...) fprintf(stderr, pr_fmt(fmt), "warning", ##args)
#define pr_info(fmt, args...) fprintf(stderr, pr_fmt(fmt), "info", ##args)
-#if defined(LIBRESSL_VERSION_NUMBER)
+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL
#define RSA_get0_n(key) (key)->n
#define RSA_get0_e(key) (key)->e
#define RSA_get0_d(key) (key)->d
diff --git a/tools/termios_linux.h b/tools/termios_linux.h
index 45f5c1233c0..0806a91180a 100644
--- a/tools/termios_linux.h
+++ b/tools/termios_linux.h
@@ -29,6 +29,7 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <asm/ioctls.h>
#include <asm/termbits.h>
#if defined(BOTHER) && defined(TCGETS2)