information about what needs to be fixed. See missing-blob-help for the
message for each tag.
+assume-size:
+ Sets the assumed size of a blob entry if it is missing. This allows for a
+ check that the rest of the image fits into the available space, even when
+ the contents are not available. If the entry is missing, Binman will use
+ this assumed size for the entry size, including creating a fake file of that
+ size if requested.
+
no-expanded:
By default binman substitutes entries with expanded versions if available,
so that a `u-boot` entry type turns into `u-boot-expanded`, for example. The
self.overlap = fdt_util.GetBool(self._node, 'overlap')
if self.overlap:
self.required_props += ['offset', 'size']
+ self.assume_size = fdt_util.GetInt(self._node, 'assume-size', 0)
# This is only supported by blobs and sections at present
self.compress = fdt_util.GetString(self._node, 'compress', 'none')
self.external and (self.optional or self.section.GetAllowMissing()))
# Allow the file to be missing
if not self._pathname:
+ if not fake_size and self.assume_size:
+ fake_size = self.assume_size
self._pathname, faked = self.check_fake_fname(self._filename,
fake_size)
self.missing = True
if not faked:
- self.SetContents(b'')
+ content_size = 0
+ if self.assume_size: # Ensure we get test coverage on next line
+ content_size = self.assume_size
+ self.SetContents(tools.get_bytes(0, content_size))
return True
self.ReadBlobContents()
with self.assertRaises(ValueError) as e:
self._DoReadFile('323_capsule_accept_revert_missing.dts')
+ def test_assume_size(self):
+ """Test handling of the assume-size property for external blob"""
+ with self.assertRaises(ValueError) as e:
+ self._DoTestFile('326_assume_size.dts', allow_missing=True,
+ allow_fake_blobs=True)
+ self.assertIn("contents size 0xa (10) exceeds section size 0x9 (9)",
+ str(e.exception))
+
+ def test_assume_size_ok(self):
+ """Test handling of the assume-size where it fits OK"""
+ with test_util.capture_sys_output() as (stdout, stderr):
+ self._DoTestFile('327_assume_size_ok.dts', allow_missing=True,
+ allow_fake_blobs=True)
+ err = stderr.getvalue()
+ self.assertRegex(
+ err,
+ "Image '.*' has faked external blobs and is non-functional: .*")
+
+ def test_assume_size_no_fake(self):
+ """Test handling of the assume-size where it fits OK"""
+ with test_util.capture_sys_output() as (stdout, stderr):
+ self._DoTestFile('327_assume_size_ok.dts', allow_missing=True)
+ err = stderr.getvalue()
+ self.assertRegex(
+ err,
+ "Image '.*' is missing external blobs and is non-functional: .*")
+
+
if __name__ == "__main__":
unittest.main()
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ size = <9>;
+ blob-ext {
+ filename = "assume_blob";
+ assume-size = <10>;
+ };
+ };
+};
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ size = <10>;
+ blob-ext {
+ filename = "assume_blob";
+ assume-size = <10>;
+ };
+ };
+};