this size. If this is not provided, it will be set to the size of the
contents.
+min-size:
+ Sets the minimum size of the entry. This size includes explicit padding
+ ('pad-before' and 'pad-after'), but not padding added to meet alignment
+ requirements. While this does not affect the contents of the entry within
+ binman itself (the padding is performed only when its parent section is
+ assembled), the end result will be that the entry ends with the padding
+ bytes, so may grow. Defaults to 0.
+
pad-before:
Padding before the contents of the entry. Normally this is 0, meaning
that the contents start at the beginning of the entry. This can be used
offset: Offset of entry within the section, None if not known yet (in
which case it will be calculated by Pack())
size: Entry size in bytes, None if not known
+ min_size: Minimum entry size in bytes
pre_reset_size: size as it was before ResetForPack(). This allows us to
keep track of the size we started with and detect size changes
uncomp_size: Size of uncompressed data in bytes, if the entry is
self.name = node and (name_prefix + node.name) or 'none'
self.offset = None
self.size = None
+ self.min_size = 0
self.pre_reset_size = None
self.uncomp_size = None
self.data = None
self.Raise("Please use 'extend-size' instead of 'expand-size'")
self.offset = fdt_util.GetInt(self._node, 'offset')
self.size = fdt_util.GetInt(self._node, 'size')
+ self.min_size = fdt_util.GetInt(self._node, 'min-size', 0)
self.orig_offset = fdt_util.GetInt(self._node, 'orig-offset')
self.orig_size = fdt_util.GetInt(self._node, 'orig-size')
if self.GetImage().copy_to_orig:
else:
self.offset = tools.align(offset, self.align)
needed = self.pad_before + self.contents_size + self.pad_after
+ needed = max(needed, self.min_size)
needed = tools.align(needed, self.align_size)
size = self.size
if not size:
self.assertIn('image', control.images)
image = control.images['image']
entries = image.GetEntries()
- self.assertEqual(5, len(entries))
+ self.assertEqual(6, len(entries))
- # First u-boot with padding before and after
+ # First u-boot with padding before and after (included in minimum size)
self.assertIn('u-boot', entries)
entry = entries['u-boot']
self.assertEqual(0, entry.offset)
self.assertEqual(U_BOOT_DATA + tools.get_bytes(0, 64 - len(U_BOOT_DATA)),
data[pos:pos + entry.size])
+ # Sixth u-boot with both minimum size and aligned size
+ self.assertIn('u-boot-min-size', entries)
+ entry = entries['u-boot-min-size']
+ self.assertEqual(128, entry.offset)
+ self.assertEqual(32, entry.size)
+ self.assertEqual(U_BOOT_DATA, entry.data[:len(U_BOOT_DATA)])
+ self.assertEqual(U_BOOT_DATA + tools.get_bytes(0, 32 - len(U_BOOT_DATA)),
+ data[pos:pos + entry.size])
+
self.CheckNoGaps(entries)
- self.assertEqual(128, image.size)
+ self.assertEqual(160, image.size)
dtb = fdt.Fdt(out_dtb_fname)
dtb.Scan()
expected = {
'image-pos': 0,
'offset': 0,
- 'size': 128,
+ 'size': 160,
'u-boot:image-pos': 0,
'u-boot:offset': 0,
'u-boot-align-both:image-pos': 64,
'u-boot-align-both:offset': 64,
'u-boot-align-both:size': 64,
+
+ 'u-boot-min-size:image-pos': 128,
+ 'u-boot-min-size:offset': 128,
+ 'u-boot-min-size:size': 32,
}
self.assertEqual(expected, props)