+ def testSplDtb(self):
+ """Test that an image with spl/u-boot-spl.dtb can be created"""
+ data = self._DoReadFile('51_u_boot_spl_dtb.dts')
+ self.assertEqual(U_BOOT_SPL_DTB_DATA, data[:len(U_BOOT_SPL_DTB_DATA)])
+
+ def testSplNoDtb(self):
+ """Test that an image with spl/u-boot-spl-nodtb.bin can be created"""
+ data = self._DoReadFile('52_u_boot_spl_nodtb.dts')
+ self.assertEqual(U_BOOT_SPL_NODTB_DATA, data[:len(U_BOOT_SPL_NODTB_DATA)])
+
+ def testSymbols(self):
+ """Test binman can assign symbols embedded in U-Boot"""
+ elf_fname = self.TestFile('u_boot_binman_syms')
+ syms = elf.GetSymbols(elf_fname, ['binman', 'image'])
+ addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start')
+ self.assertEqual(syms['_binman_u_boot_spl_prop_pos'].address, addr)
+
+ with open(self.TestFile('u_boot_binman_syms')) as fd:
+ TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
+ data = self._DoReadFile('53_symbols.dts')
+ sym_values = struct.pack('<LQL', 0x24 + 0, 0x24 + 24, 0x24 + 20)
+ expected = (sym_values + U_BOOT_SPL_DATA[16:] + chr(0xff) +
+ U_BOOT_DATA +
+ sym_values + U_BOOT_SPL_DATA[16:])
+ self.assertEqual(expected, data)
+
+ def testPackUnitAddress(self):
+ """Test that we support multiple binaries with the same name"""
+ data = self._DoReadFile('54_unit_address.dts')
+ self.assertEqual(U_BOOT_DATA + U_BOOT_DATA, data)
+
+ def testSections(self):
+ """Basic test of sections"""
+ data = self._DoReadFile('55_sections.dts')
+ expected = U_BOOT_DATA + '!' * 12 + U_BOOT_DATA + 'a' * 12 + '&' * 8
+ self.assertEqual(expected, data)
+
+ def testMap(self):
+ """Tests outputting a map of the images"""
+ _, _, map_data = self._DoReadFileDtb('55_sections.dts', map=True)
+ self.assertEqual('''Position Size Name
+00000000 00000010 section@0
+ 00000000 00000004 u-boot
+00000010 00000010 section@1
+ 00000000 00000004 u-boot
+''', map_data)
+
+ def testNamePrefix(self):
+ """Tests that name prefixes are used"""
+ _, _, map_data = self._DoReadFileDtb('56_name_prefix.dts', map=True)
+ self.assertEqual('''Position Size Name
+00000000 00000010 section@0
+ 00000000 00000004 ro-u-boot
+00000010 00000010 section@1
+ 00000000 00000004 rw-u-boot
+''', map_data)