Lines Matching +full:tpl +full:- +full:support
1 # SPDX-License-Identifier: GPL-2.0+
7 # python -m unittest func_test.TestFunctional.testHelp
35 U_BOOT_TPL_DATA = 'tpl'
77 In some cases a 'real' file must be used - these are also supplied in
93 TestFunctional._MakeInputFile('u-boot.bin', U_BOOT_DATA)
94 TestFunctional._MakeInputFile('u-boot.img', U_BOOT_IMG_DATA)
95 TestFunctional._MakeInputFile('spl/u-boot-spl.bin', U_BOOT_SPL_DATA)
96 TestFunctional._MakeInputFile('tpl/u-boot-tpl.bin', U_BOOT_TPL_DATA)
101 TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
102 TestFunctional._MakeInputFile('u-boot-br.bin', PPC_MPC85XX_BR_DATA)
103 TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
105 TestFunctional._MakeInputFile('tpl/u-boot-x86-16bit-tpl.bin',
107 TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA)
108 TestFunctional._MakeInputFile('spl/u-boot-spl-nodtb.bin',
110 TestFunctional._MakeInputFile('tpl/u-boot-tpl-nodtb.bin',
123 TestFunctional._MakeInputFile('u-boot', fd.read())
152 TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA)
153 TestFunctional._MakeInputFile('spl/u-boot-spl.dtb', U_BOOT_SPL_DTB_DATA)
154 TestFunctional._MakeInputFile('tpl/u-boot-tpl.dtb', U_BOOT_TPL_DTB_DATA)
179 if '-D' in sys.argv:
180 args = args + ['-D']
182 options.pager = 'binman-invalid-pager'
194 fname: Device-tree source filename to use (e.g. 005_simple.dts)
204 args = ['-p', '-I', self._indir, '-d', self.TestFile(fname)]
206 args.append('-D')
208 args.append('-m')
210 args.append('-up')
212 args.append('--fake-dtb')
215 args.append('-a%s=%s' % (arg, value))
218 args += ['-i', image]
221 def _SetupDtb(self, fname, outfile='u-boot.dtb'):
222 """Set up a new test device-tree file
229 outfile: Output filename for compiled device-tree binary
232 Contents of device-tree binary
246 U-Boot we normally run fdtgrep to remove unwanted nodes, but for tests
249 We still want the DTBs for SPL and TPL to be different though, since
251 an 'spl' or 'tpl' property to the top-level node.
268 Raises an assertion failure if binman returns a non-zero exit code.
271 fname: Device-tree source filename to use (e.g. 005_simple.dts)
273 the u-boot-dtb entry. Normally this is not needed and the
285 Output device tree binary filename ('u-boot.dtb' path)
288 # Use the compiled test file as the u-boot-dtb input
291 infile = os.path.join(self._indir, 'u-boot.dtb')
293 # For testing purposes, make a copy of the DT for SPL and TPL. Add
295 for name in ['spl', 'tpl']:
296 dtb_fname = '%s/u-boot-%s.dtb' % (name, name)
305 out_dtb_fname = tools.GetOutputFilename('u-boot.dtb.out')
325 """Helper function which discards the device-tree binary
328 fname: Device-tree source filename to use (e.g. 005_simple.dts)
330 the u-boot-dtb entry. Normally this is not needed and the
380 TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
410 """Get the totalsize field from a device-tree binary
413 dtb: Device-tree binary contents
416 Total size of device-tree binary, from the header
438 result = self._RunBinman('-h')
441 """Test that the full help is displayed with -H"""
442 result = self._RunBinman('-H')
452 """Test that the full help is displayed with -H"""
455 result = self._DoBinman('-H')
461 """Test that the basic help is displayed with -h"""
462 result = self._RunBinman('-h')
469 self._SetupDtb('005_simple.dts', 'sandbox/u-boot.dtb')
470 TestFunctional._MakeInputFile('sandbox/u-boot.bin', U_BOOT_DATA)
471 result = self._DoBinman('-b', 'sandbox')
478 self.assertIn("Must provide a board to process (use -b <board>)",
482 """Test that an invalid device-tree file generates an error"""
484 self._RunBinman('-d', 'missing_file')
490 """Test that an invalid device-tree source file generates an error
493 will come from the device-tree compiler (dtc).
496 self._RunBinman('-d', self.TestFile('001_invalid.dts'))
503 self._DoBinman('-d', self.TestFile('002_missing_node.dts'))
508 result = self._RunBinman('-d', self.TestFile('003_empty.dts'))
515 result = self._RunBinman('-d',
517 self.assertIn("Unknown entry type 'not-a-valid-type' in node "
518 "'/binman/not-a-valid-type'", str(e.exception))
559 self.assertIn("Node '/binman/u-boot': Alignment 23 must be a power "
571 # First u-boot
572 self.assertIn('u-boot', entries)
573 entry = entries['u-boot']
577 # Second u-boot, aligned to 16-byte boundary
578 self.assertIn('u-boot-align', entries)
579 entry = entries['u-boot-align']
583 # Third u-boot, size 23 bytes
584 self.assertIn('u-boot-size', entries)
585 entry = entries['u-boot-size']
590 # Fourth u-boot, placed immediate after the above
591 self.assertIn('u-boot-next', entries)
592 entry = entries['u-boot-next']
596 # Fifth u-boot, placed at a fixed offset
597 self.assertIn('u-boot-fixed', entries)
598 entry = entries['u-boot-fixed']
614 # First u-boot with padding before and after
615 self.assertIn('u-boot', entries)
616 entry = entries['u-boot']
621 # Second u-boot has an aligned size, but it has no effect
622 self.assertIn('u-boot-align-size-nop', entries)
623 entry = entries['u-boot-align-size-nop']
627 # Third u-boot has an aligned size too
628 self.assertIn('u-boot-align-size', entries)
629 entry = entries['u-boot-align-size']
633 # Fourth u-boot has an aligned end
634 self.assertIn('u-boot-align-end', entries)
635 entry = entries['u-boot-align-end']
639 # Fifth u-boot immediately afterwards
640 self.assertIn('u-boot-align-both', entries)
641 entry = entries['u-boot-align-both']
652 self.assertIn("Node '/binman/u-boot': Alignment 5 must be a power "
659 self.assertIn("Node '/binman/u-boot': Alignment size 55 must be a "
666 self.assertIn("Node '/binman/u-boot': Offset 0x5 (5) does not match "
673 self.assertIn("Node '/binman/u-boot': Size 0x5 (5) does not match "
674 "align-size 0x4 (4)", str(e.exception))
680 self.assertIn("Node '/binman/u-boot-align': Offset 0x3 (3) overlaps "
681 "with previous entry '/binman/u-boot' ending at 0x4 (4)",
688 self.assertIn("Node '/binman/u-boot': Entry contents size is 0x4 (4) "
719 "align-size 0x8 (8)", str(e.exception))
739 fname = tools.GetOutputFilename('test-name')
743 fname = tools.GetOutputFilename('test-name.xx')
762 self.assertIn("Node '/binman/u-boot-spl': Offset 0x0 (0) overlaps "
763 "with previous entry '/binman/u-boot' ending at 0x4 (4)",
767 """Test that a device tree can be added to U-Boot"""
772 """Test that the end-at-4gb property requires a size property"""
776 "using end-at-4gb", str(e.exception))
779 """Test that the end-at-4gb and skip-at-size property can't be used
783 self.assertIn("Section '/binman': Provide either 'end-at-4gb' or "
784 "'skip-at-start'", str(e.exception))
787 """Test that the end-at-4gb property checks for offset boundaries"""
790 self.assertIn("Node '/binman/u-boot': Offset 0x0 (0) is outside "
797 data = self._DoReadFile('029_x86-rom.dts')
805 self._DoTestFile('031_x86-rom-me.dts')
806 self.assertIn("Node '/binman/intel-descriptor': Cannot find FD "
812 self._DoTestFile('030_x86-rom-me-no-desc.dts')
813 self.assertIn("Node '/binman/intel-me': No offset set with "
814 "offset-unset: should another entry provide this correct "
819 data = self._DoReadFile('031_x86-rom-me.dts')
824 data = self._DoReadFile('032_intel-vga.dts')
829 data = self._DoReadFile('033_x86-start16.dts')
833 """Test that an image with powerpc-mpc85xx-bootpg-resetvec can be
849 Contents of first region (U-Boot or SPL)
851 in the above (two 4-byte words)
893 u-boot-nodtb.bin with a microcode pointer inserted at the correct
895 u-boot.dtb with the microcode removed
907 u-boot-nodtb.bin with a microcode pointer inserted at the correct
909 u-boot.dtb with the microcode
941 """Test that u-boot.img can be put in a file"""
949 self.assertIn("Node '/binman/u-boot-dtb-with-ucode': No /microcode "
953 """Test that a missing u-boot-dtb-with-ucode node is detected"""
956 self.assertIn("Node '/binman/u-boot-with-ucode-ptr': Cannot find "
957 "microcode region u-boot-dtb-with-ucode", str(e.exception))
960 """Test that a missing u-boot-ucode node is detected"""
963 self.assertIn("Node '/binman/u-boot-with-ucode-ptr': Cannot find "
964 "microcode region u-boot-ucode", str(e.exception))
967 """Test that a U-Boot binary without the microcode symbol is detected"""
971 TestFunctional._MakeInputFile('u-boot', fd.read())
975 self.assertIn("Node '/binman/u-boot-with-ucode-ptr': Cannot locate "
976 "_dt_ucode_base_size symbol in u-boot", str(e.exception))
981 TestFunctional._MakeInputFile('u-boot', fd.read())
987 self.assertIn("Node '/binman/u-boot-with-ucode-ptr': Microcode "
994 TestFunctional._MakeInputFile('u-boot', fd.read())
1006 self.assertEqual(chr(0) * (0x200 - used_len), third)
1013 "entry 'invalid-entry'", str(e.exception))
1017 data = self._DoReadFile('042_intel-fsp.dts')
1022 data = self._DoReadFile('043_intel-cmc.dts')
1027 data = self._DoReadFile('046_intel-vbt.dts')
1042 self.assertIn('Expected __bss_size symbol in spl/u-boot-spl',
1047 data = self._DoReadFile('048_x86-start16-spl.dts')
1054 u-boot-spl-nodtb.bin with a microcode pointer inserted at the
1056 u-boot.dtb with the microcode removed
1078 u-boot-ucode entry we have not yet seen the u-boot-dtb-with-ucode
1090 """Test that an image with spl/u-boot-spl.dtb can be created"""
1095 """Test that an image with spl/u-boot-spl-nodtb.bin can be created"""
1100 """Test binman can assign symbols embedded in U-Boot"""
1115 """Test that we support multiple binaries with the same name"""
1130 00000000 00000000 00000028 main-section
1132 00000000 00000000 00000004 u-boot
1134 00000010 00000000 00000004 u-boot
1136 00000020 00000000 00000004 u-boot
1143 00000000 00000000 00000028 main-section
1145 00000000 00000000 00000004 ro-u-boot
1147 00000010 00000000 00000004 rw-u-boot
1171 props = self._GetPropTree(dtb, ['offset', 'size', 'image-pos'])
1173 'image-pos': 0,
1177 '_testing:image-pos': 32,
1178 'section@0/u-boot:offset': 0,
1179 'section@0/u-boot:size': len(U_BOOT_DATA),
1180 'section@0/u-boot:image-pos': 0,
1183 'section@0:image-pos': 0,
1185 'section@1/u-boot:offset': 0,
1186 'section@1/u-boot:size': len(U_BOOT_DATA),
1187 'section@1/u-boot:image-pos': 16,
1190 'section@1:image-pos': 16,
1204 'test-str-arg': 'test1',
1205 'test-int-arg': '456',
1218 'test-int-arg': '456',
1230 'test-int-arg': '456',
1235 'properties/entry args: test-str-arg, test-int-fdt, test-int-arg',
1239 """Test that an invalid entry-argument format is detected"""
1240 args = ['-d', self.TestFile('064_entry_args_required.dts'), '-ano-value']
1243 self.assertIn("Invalid entry arguemnt 'no-value'", str(e.exception))
1246 """Test that an invalid entry-argument integer is detected"""
1248 'test-int-arg': 'abc',
1253 "'test-int-arg' (value 'abc') to integer",
1257 """Test that an invalid entry-argument datatype is detected
1264 'test-bad-datatype-arg': '12',
1275 'test-id': TEXT_DATA,
1276 'test-id2': TEXT_DATA2,
1277 'test-id3': TEXT_DATA3,
1281 expected = (TEXT_DATA + chr(0) * (8 - len(TEXT_DATA)) + TEXT_DATA2 +
1333 'cros-ec-rw-path': 'ecrw.bin',
1354 fname = pipe_list[0][-1]
1371 expected = GBB_DATA + GBB_DATA + 8 * chr(0) + (0x2180 - 16) * chr(0)
1422 """Test that we detect an entry that points to a non-entry"""
1429 """Test that an image with TPL and ots device tree can be created"""
1432 TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read())
1440 self.assertIn("Node '/binman/u-boot': Please use 'offset' instead of "
1453 "'test-id'", str(e.exception))
1456 """Test that an image with an x86 start16 TPL region can be created"""
1457 data = self._DoReadFile('081_x86-start16-tpl.dts')
1476 'section:image-pos': 0,
1477 'u-boot-tpl-dtb:size': 513,
1478 'u-boot-spl-dtb:size': 513,
1479 'u-boot-spl-dtb:offset': 493,
1480 'image-pos': 0,
1481 'section/u-boot-dtb:image-pos': 0,
1482 'u-boot-spl-dtb:image-pos': 493,
1483 'section/u-boot-dtb:size': 493,
1484 'u-boot-tpl-dtb:image-pos': 1006,
1485 'section/u-boot-dtb:offset': 0,
1489 'u-boot-tpl-dtb:offset': 1006,
1493 # We expect three device-tree files in the output, one after the other.
1495 # and 'tpl' in the TPL tree, to make sure they are distinct from the
1496 # main U-Boot tree. All three should have the same postions and offset.
1498 for item in ['', 'spl', 'tpl']:
1501 props = self._GetPropTree(dtb, ['offset', 'size', 'image-pos',
1502 'spl', 'tpl'])
1518 # binman as a file called u-boot.dtb. To fix this, copy the file
1520 #tools.WriteFile(os.path.join(self._indir, 'u-boot.dtb'),
1523 for fname in ['u-boot.dtb.out', 'spl/u-boot-spl.dtb.out',
1524 'tpl/u-boot-tpl.dtb.out']:
1548 return tools.Run('lz4', '-dc', out)
1562 props = self._GetPropTree(dtb, ['size', 'uncomp-size'])
1566 'blob:uncomp-size': len(COMPRESS_DATA),
1620 00000000 00000000 00000028 main-section
1622 00000008 00000008 00000004 u-boot
1624 0000000c 00000000 00000003 intel-mrc
1625 00000010 00000010 00000004 u-boot2
1628 0000001c 00000008 00000004 u-boot
1646 hash_node = dtb.GetNode('/binman/u-boot/hash').props['value']
1654 self.assertIn("Node \'/binman/u-boot\': Missing \'algo\' property for "
1660 self.assertIn("Node '/binman/u-boot': Unknown hash algorithm",
1676 """Test that x86 microcode can be handled correctly in TPL
1679 u-boot-tpl-nodtb.bin with a microcode pointer inserted at the correct
1681 u-boot-tpl.dtb with the microcode removed
1685 TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read())
1695 expected = U_BOOT_DATA + MRC_DATA + 'a' * (32 - 7)
1717 expected = U_BOOT_DATA + MRC_DATA + 'b' * (32 - 7)
1740 TestFunctional._MakeInputFile('-boot', fd.read())
1747 TestFunctional._MakeInputFile('-boot', fd.read())
1764 <none> 00000000 00000007 main-section
1765 <none> 00000000 00000004 u-boot
1766 <none> 00000003 00000004 u-boot-align