return self.GetEntryContents()
def GetData(self):
- section_data = tools.GetBytes(self._pad_byte, self.size)
+ section_data = b''
for entry in self._entries.values():
data = entry.GetData()
- base = self.pad_before + entry.offset - self._skip_at_start
- section_data = (section_data[:base] + data +
- section_data[base + len(data):])
+ base = self.pad_before + (entry.offset or 0) - self._skip_at_start
+ pad = base - len(section_data)
+ if pad > 0:
+ section_data += tools.GetBytes(self._pad_byte, pad)
+ section_data += data
+ if self.size:
+ pad = self.size - len(section_data)
+ if pad > 0:
+ section_data += tools.GetBytes(self._pad_byte, pad)
self.Detail('GetData: %d entries, total size %#x' %
(len(self._entries), len(section_data)))
return section_data
expected4 = sym_values + U_BOOT_TPL_DATA[16:]
self.assertEqual(expected4, data[upto3:])
+ def testPackX86RomIfwiSectiom(self):
+ """Test that a section can be placed in an IFWI region"""
+ self._SetupIfwi('fitimage.bin')
+ data = self._DoReadFile('151_x86_rom_ifwi_section.dts')
+ self._CheckIfwi(data)
+
if __name__ == "__main__":
unittest.main()
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ sort-by-offset;
+ end-at-4gb;
+ size = <0x800000>;
+ intel-descriptor {
+ filename = "descriptor.bin";
+ };
+
+ intel-ifwi {
+ offset-unset;
+ filename = "fitimage.bin";
+ convert-fit;
+
+ section {
+ ifwi-replace;
+ ifwi-subpart = "IBBP";
+ ifwi-entry = "IBBL";
+ u-boot-tpl {
+ };
+ u-boot-dtb {
+ };
+ };
+ };
+ };
+};