summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorJonas Karlman <jonas@kwiboo.se>2023-01-21 19:02:12 +0000
committerSimon Glass <sjg@chromium.org>2023-01-26 10:47:45 -0700
commitf584d44c2371b9d0027ac30fe4af5475926caecc (patch)
treee9e6c73410f6b2a4592dd50f1681812dc606737d /tools/binman/ftest.py
parent99e3a2cd4e74b8d6fd7cca3d3dc8e106170ac532 (diff)
binman: Add support for selecting firmware to use with split-elf
In some cases it is desired for SPL to start TF-A instead of U-Boot proper. Add support for a new property fit,firmware that picks a valid entry and prepends the remaining valid entries to the loadables list generated by the split-elf generator. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index cd275725717..0c4d34dfe48 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6337,6 +6337,50 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
}
self.assertEqual(expected, props)
+ def testFitFirmwareLoadables(self):
+ """Test an image with an FIT that use fit,firmware"""
+ if not elf.ELF_TOOLS:
+ self.skipTest('Python elftools not available')
+ entry_args = {
+ 'of-list': 'test-fdt1',
+ 'default-dt': 'test-fdt1',
+ 'atf-bl31-path': 'bl31.elf',
+ 'tee-os-path': 'missing.bin',
+ }
+ test_subdir = os.path.join(self._indir, TEST_FDT_SUBDIR)
+ data = self._DoReadFileDtb(
+ '276_fit_firmware_loadables.dts',
+ entry_args=entry_args,
+ extra_indirs=[test_subdir])[0]
+
+ dtb = fdt.Fdt.FromData(data)
+ dtb.Scan()
+
+ node = dtb.GetNode('/configurations/conf-uboot-1')
+ self.assertEqual('u-boot', node.props['firmware'].value)
+ self.assertEqual(['atf-1', 'atf-2'],
+ fdt_util.GetStringList(node, 'loadables'))
+
+ node = dtb.GetNode('/configurations/conf-atf-1')
+ self.assertEqual('atf-1', node.props['firmware'].value)
+ self.assertEqual(['u-boot', 'atf-2'],
+ fdt_util.GetStringList(node, 'loadables'))
+
+ node = dtb.GetNode('/configurations/conf-missing-uboot-1')
+ self.assertEqual('u-boot', node.props['firmware'].value)
+ self.assertEqual(['atf-1', 'atf-2'],
+ fdt_util.GetStringList(node, 'loadables'))
+
+ node = dtb.GetNode('/configurations/conf-missing-atf-1')
+ self.assertEqual('atf-1', node.props['firmware'].value)
+ self.assertEqual(['u-boot', 'atf-2'],
+ fdt_util.GetStringList(node, 'loadables'))
+
+ node = dtb.GetNode('/configurations/conf-missing-tee-1')
+ self.assertEqual('atf-1', node.props['firmware'].value)
+ self.assertEqual(['u-boot', 'atf-2'],
+ fdt_util.GetStringList(node, 'loadables'))
+
if __name__ == "__main__":
unittest.main()