]> git.sur5r.net Git - u-boot/commitdiff
binman: Allow unit addresses for binaries
authorSimon Glass <sjg@chromium.org>
Fri, 1 Jun 2018 15:38:11 +0000 (09:38 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 7 Jun 2018 19:25:07 +0000 (11:25 -0800)
Allow the same binary to appear multiple times in an image by using the
device-tree unit-address feature (u-boot@0, u-boot@1).

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/README
tools/binman/etype/entry.py
tools/binman/ftest.py
tools/binman/test/54_unit_address.dts [new file with mode: 0644]

index b20098177ee99120423a40f6cb3da561b442bf6c..196dda1fb4c6e30816e440d5c1735ad94f0d52a4 100644 (file)
@@ -387,6 +387,10 @@ end-at-4gb:
 Examples of the above options can be found in the tests. See the
 tools/binman/test directory.
 
+It is possible to have the same binary appear multiple times in the image,
+either by using a unit number suffix (u-boot@0, u-boot@1) or by using a
+different name for each and specifying the type with the 'type' attribute.
+
 
 Special properties
 ------------------
index c331312c491ab34c83dbb159e00be0ded4ffd2dd..23e436a2e9ddc057ecf26ef72f6cd73987bd9ee3 100644 (file)
@@ -72,7 +72,12 @@ class Entry(object):
         """
         if not etype:
             etype = fdt_util.GetString(node, 'type', node.name)
+
+        # Convert something like 'u-boot@0' to 'u_boot' since we are only
+        # interested in the type.
         module_name = etype.replace('-', '_')
+        if '@' in module_name:
+            module_name = module_name.split('@')[0]
         module = modules.get(module_name)
 
         # Import the module if we have not already done so.
index a3abbc4b84b4d09c4d1d92bafa335edb55558ea6..b5e8736fbb5ee590bc7913751f6e4afddffe23ca 100644 (file)
@@ -909,6 +909,11 @@ class TestFunctional(unittest.TestCase):
                     sym_values + U_BOOT_SPL_DATA[16:])
         self.assertEqual(expected, data)
 
+    def testPackUnitAddress(self):
+        """Test that we support multiple binaries with the same name"""
+        data = self._DoReadFile('54_unit_address.dts')
+        self.assertEqual(U_BOOT_DATA + U_BOOT_DATA, data)
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/54_unit_address.dts b/tools/binman/test/54_unit_address.dts
new file mode 100644 (file)
index 0000000..3216dbb
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               u-boot@0 {
+               };
+               u-boot@1 {
+               };
+       };
+};