mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 17:22:22 +02:00
binman: Allow 'fill' entry to have a size of 0
The check for this should be for None, not 0. Fix it and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -23,7 +23,7 @@ class Entry_fill(Entry):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, section, etype, node):
|
def __init__(self, section, etype, node):
|
||||||
Entry.__init__(self, section, etype, node)
|
Entry.__init__(self, section, etype, node)
|
||||||
if not self.size:
|
if self.size is None:
|
||||||
self.Raise("'fill' entry must have a size property")
|
self.Raise("'fill' entry must have a size property")
|
||||||
self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
|
self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
|
||||||
|
|
||||||
|
@@ -1364,6 +1364,11 @@ class TestFunctional(unittest.TestCase):
|
|||||||
self.assertIn("Node '/binman/u-boot': Please use 'offset' instead of "
|
self.assertIn("Node '/binman/u-boot': Please use 'offset' instead of "
|
||||||
"'pos'", str(e.exception))
|
"'pos'", str(e.exception))
|
||||||
|
|
||||||
|
def testFillZero(self):
|
||||||
|
"""Test for an fill entry type with a size of 0"""
|
||||||
|
data = self._DoReadFile('80_fill_empty.dts')
|
||||||
|
self.assertEqual(chr(0) * 16, data)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
15
tools/binman/test/80_fill_empty.dts
Normal file
15
tools/binman/test/80_fill_empty.dts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
binman {
|
||||||
|
size = <16>;
|
||||||
|
fill {
|
||||||
|
size = <0>;
|
||||||
|
fill-byte = [ff];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
Reference in New Issue
Block a user