mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-22 06:32:23 +00:00
binman: Allow unit addresses for binaries
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>
This commit is contained in:
parent
48ae412424
commit
dd57c13bbc
4 changed files with 29 additions and 0 deletions
|
@ -387,6 +387,10 @@ end-at-4gb:
|
||||||
Examples of the above options can be found in the tests. See the
|
Examples of the above options can be found in the tests. See the
|
||||||
tools/binman/test directory.
|
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
|
Special properties
|
||||||
------------------
|
------------------
|
||||||
|
|
|
@ -72,7 +72,12 @@ class Entry(object):
|
||||||
"""
|
"""
|
||||||
if not etype:
|
if not etype:
|
||||||
etype = fdt_util.GetString(node, 'type', node.name)
|
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('-', '_')
|
module_name = etype.replace('-', '_')
|
||||||
|
if '@' in module_name:
|
||||||
|
module_name = module_name.split('@')[0]
|
||||||
module = modules.get(module_name)
|
module = modules.get(module_name)
|
||||||
|
|
||||||
# Import the module if we have not already done so.
|
# Import the module if we have not already done so.
|
||||||
|
|
|
@ -909,6 +909,11 @@ class TestFunctional(unittest.TestCase):
|
||||||
sym_values + U_BOOT_SPL_DATA[16:])
|
sym_values + U_BOOT_SPL_DATA[16:])
|
||||||
self.assertEqual(expected, data)
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
15
tools/binman/test/54_unit_address.dts
Normal file
15
tools/binman/test/54_unit_address.dts
Normal file
|
@ -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 {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue