binman: Add support for u-boot.img as an input binary
authorSimon Glass <sjg@chromium.org>
Sat, 26 Nov 2016 03:15:54 +0000 (20:15 -0700)
committerSimon Glass <sjg@chromium.org>
Mon, 19 Dec 2016 19:09:55 +0000 (08:09 +1300)
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>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
tools/binman/etype/u_boot_img.py [new file with mode: 0644]
tools/binman/func_test.py
tools/binman/test/36_u_boot_img.dts [new file with mode: 0644]

diff --git a/tools/binman/etype/u_boot_img.py b/tools/binman/etype/u_boot_img.py
new file mode 100644 (file)
index 0000000..744f1b4
--- /dev/null
@@ -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'
index 341957b59f0f13e096013bb35c7d221de1622645..8dd118b7c2a0d3c5cfa38173442150764bc661d8 100644 (file)
@@ -713,3 +713,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 (file)
index 0000000..aa5a3fe
--- /dev/null
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               u-boot-img {
+               };
+       };
+};