aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-09 18:39:42 -0600
committerSimon Glass <sjg@chromium.org>2020-07-25 14:46:57 -0600
commitb3295fd4e3d61a7ceabbad10a293db2dcd38b38b (patch)
treef8a1abd9b1c8b619cd7fae59b7ad5def222ffa62
parent0ba4b3dfee57a4e5803abd881e9654fb0414a3c1 (diff)
downloadu-boot-b3295fd4e3d61a7ceabbad10a293db2dcd38b38b.zip
u-boot-b3295fd4e3d61a7ceabbad10a293db2dcd38b38b.tar.gz
u-boot-b3295fd4e3d61a7ceabbad10a293db2dcd38b38b.tar.bz2
binman: Allow zero-length entries to overlap
Some binary blobs unfortunately obtain their position in the image from other binary blobs, such as Intel's 'descriptor'. In this case we cannot rely on packing to work. It is not possible to produce a valid image in any case, due to the missing blobs. Allow zero-length overlaps so that this does not cause any problems. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
-rw-r--r--tools/binman/etype/section.py2
-rw-r--r--tools/binman/ftest.py4
-rw-r--r--tools/binman/test/160_pack_overlap_zero.dts18
3 files changed, 23 insertions, 1 deletions
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 7cd12c0..73c5553 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -226,7 +226,7 @@ class Entry_section(Entry):
"at %#x (%d)" %
(entry.offset, entry.offset, self._skip_at_start,
self._skip_at_start))
- if entry.offset < offset:
+ if entry.offset < offset and entry.size:
entry.Raise("Offset %#x (%d) overlaps with previous entry '%s' "
"ending at %#x (%d)" %
(entry.offset, entry.offset, prev_name, offset, offset))
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 146d4c5..614ac4e 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3421,6 +3421,10 @@ class TestFunctional(unittest.TestCase):
err = stderr.getvalue()
self.assertRegex(err, "Image 'main-section'.*missing.*: intel-ifwi")
+ def testPackOverlap(self):
+ """Test that zero-size overlapping regions are ignored"""
+ self._DoTestFile('160_pack_overlap_zero.dts')
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/binman/test/160_pack_overlap_zero.dts b/tools/binman/test/160_pack_overlap_zero.dts
new file mode 100644
index 0000000..731aa1c
--- /dev/null
+++ b/tools/binman/test/160_pack_overlap_zero.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ u-boot {
+ };
+
+ fill {
+ size = <0>;
+ offset = <3>;
+ };
+ };
+};