diff mbox

[U-Boot,26/30] binman: Add support for u-boot.img as an input binary

Message ID 1469494766-26601-27-git-send-email-sjg@chromium.org
State Changes Requested
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 26, 2016, 12:59 a.m. UTC
Add an entry type for u-boot.img (a legacy U-Boot image) and a simple test.

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

 tools/binman/etype/u_boot_img.py    | 17 +++++++++++++++++
 tools/binman/func_test.py           |  7 +++++++
 tools/binman/test/36_u_boot_img.dts | 11 +++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_img.py
 create mode 100644 tools/binman/test/36_u_boot_img.dts
diff mbox

Patch

diff --git a/tools/binman/etype/u_boot_img.py b/tools/binman/etype/u_boot_img.py
new file mode 100644
index 0000000..744f1b4
--- /dev/null
+++ b/tools/binman/etype/u_boot_img.py
@@ -0,0 +1,17 @@ 
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+# Entry-type module for U-Boot binary
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_u_boot_img(Entry_blob):
+    def __init__(self, image, etype, node):
+        Entry_blob.__init__(self, image, etype, node)
+
+    def GetDefaultFilename(self):
+        return 'u-boot.img'
diff --git a/tools/binman/func_test.py b/tools/binman/func_test.py
index 4fc76bd..22066be 100644
--- a/tools/binman/func_test.py
+++ b/tools/binman/func_test.py
@@ -27,6 +27,7 @@  import tout
 
 # Contents of test files, corresponding to different entry types
 U_BOOT_DATA         = '1234'
+U_BOOT_IMG_DATA     = 'img'
 U_BOOT_SPL_DATA     = '567'
 BLOB_DATA           = '89'
 ME_DATA             = '0abcd'
@@ -60,6 +61,7 @@  class TestFunctional(unittest.TestCase):
 
         # Create some test files
         TestFunctional._MakeInputFile('u-boot.bin', U_BOOT_DATA)
+        TestFunctional._MakeInputFile('u-boot.img', U_BOOT_IMG_DATA)
         TestFunctional._MakeInputFile('spl/u-boot-spl.bin', U_BOOT_SPL_DATA)
         TestFunctional._MakeInputFile('blobfile', BLOB_DATA)
         TestFunctional._MakeInputFile('me.bin', ME_DATA)
@@ -643,3 +645,8 @@  class TestFunctional(unittest.TestCase):
         first = data[:len(U_BOOT_NODTB_DATA)]
         self.assertEqual('nodtb with microcode' + pos_and_size +
                          ' somewhere in here', first)
+
+    def testUBootImg(self):
+        """Test that u-boot.img can be put in a file"""
+        data = self._DoReadFile('36_u_boot_img.dts')
+        self.assertEqual(U_BOOT_IMG_DATA, data)
diff --git a/tools/binman/test/36_u_boot_img.dts b/tools/binman/test/36_u_boot_img.dts
new file mode 100644
index 0000000..aa5a3fe
--- /dev/null
+++ b/tools/binman/test/36_u_boot_img.dts
@@ -0,0 +1,11 @@ 
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		u-boot-img {
+		};
+	};
+};