[U-Boot] [PATCH 02/13] binman: Add support for including spl/u-boot-spl.dtb

Simon Glass sjg at chromium.org
Tue Nov 14 01:54:55 UTC 2017


This file contains the SPL device tree. Add support for including this by
itself in images.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/binman/etype/u_boot_spl_dtb.py    | 17 +++++++++++++++++
 tools/binman/ftest.py                   |  7 +++++++
 tools/binman/test/51_u_boot_spl_dtb.dts | 13 +++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_spl_dtb.py
 create mode 100644 tools/binman/test/51_u_boot_spl_dtb.dts

diff --git a/tools/binman/etype/u_boot_spl_dtb.py b/tools/binman/etype/u_boot_spl_dtb.py
new file mode 100644
index 00000000000..6c5ce1e996b
--- /dev/null
+++ b/tools/binman/etype/u_boot_spl_dtb.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg at chromium.org>
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+# Entry-type module for U-Boot device tree
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_u_boot_spl_dtb(Entry_blob):
+    def __init__(self, image, etype, node):
+        Entry_blob.__init__(self, image, etype, node)
+
+    def GetDefaultFilename(self):
+        return 'spl/u-boot-spl.dtb'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index c8155788afc..32bc7950b14 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -33,6 +33,7 @@ BLOB_DATA             = '89'
 ME_DATA               = '0abcd'
 VGA_DATA              = 'vga'
 U_BOOT_DTB_DATA       = 'udtb'
+U_BOOT_SPL_DTB_DATA   = 'spldtb'
 X86_START16_DATA      = 'start16'
 X86_START16_SPL_DATA  = 'start16spl'
 U_BOOT_NODTB_DATA     = 'nodtb with microcode pointer somewhere in here'
@@ -76,6 +77,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('me.bin', ME_DATA)
         TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
         TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA)
+        TestFunctional._MakeInputFile('spl/u-boot-spl.dtb', U_BOOT_SPL_DTB_DATA)
         TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
         TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
                                       X86_START16_SPL_DATA)
@@ -869,6 +871,11 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('50_intel_mrc.dts')
         self.assertEqual(MRC_DATA, data[:len(MRC_DATA)])
 
+    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)])
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/51_u_boot_spl_dtb.dts b/tools/binman/test/51_u_boot_spl_dtb.dts
new file mode 100644
index 00000000000..3912f86b4cd
--- /dev/null
+++ b/tools/binman/test/51_u_boot_spl_dtb.dts
@@ -0,0 +1,13 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		u-boot-spl-dtb {
+		};
+	};
+};
-- 
2.15.0.448.gf294e3d99a-goog



More information about the U-Boot mailing list