binman: Support a list of strings with the mkimage etype
At present the 'args' property of the mkimage entry type is a string. This makes it difficult to include CONFIG options in that property. In particular, this does not work: args = "-n CONFIG_SYS_SOC -E" since the preprocessor does not operate within strings, nor does this: args = "-n" CONFIG_SYS_SOC" "-E" since the device tree compiler does not understand string concatenation. With this new feature, we can do: args = "-n", CONFIG_SYS_SOC, "-E"; Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -263,7 +263,7 @@ class TestElf(unittest.TestCase):
|
|||||||
if not elf.ELF_TOOLS:
|
if not elf.ELF_TOOLS:
|
||||||
self.skipTest('Python elftools not available')
|
self.skipTest('Python elftools not available')
|
||||||
fname = self.ElfTestFile('embed_data')
|
fname = self.ElfTestFile('embed_data')
|
||||||
segments, entry = elf.read_segments(tools.ReadFile(fname))
|
segments, entry = elf.read_segments(tools.read_file(fname))
|
||||||
|
|
||||||
def test_read_segments_fail(self):
|
def test_read_segments_fail(self):
|
||||||
"""Test for read_segments() without elftools"""
|
"""Test for read_segments() without elftools"""
|
||||||
@@ -272,7 +272,7 @@ class TestElf(unittest.TestCase):
|
|||||||
elf.ELF_TOOLS = False
|
elf.ELF_TOOLS = False
|
||||||
fname = self.ElfTestFile('embed_data')
|
fname = self.ElfTestFile('embed_data')
|
||||||
with self.assertRaises(ValueError) as e:
|
with self.assertRaises(ValueError) as e:
|
||||||
elf.read_segments(tools.ReadFile(fname))
|
elf.read_segments(tools.read_file(fname))
|
||||||
self.assertIn('Python elftools package is not available',
|
self.assertIn('Python elftools package is not available',
|
||||||
str(e.exception))
|
str(e.exception))
|
||||||
finally:
|
finally:
|
||||||
@@ -282,7 +282,7 @@ class TestElf(unittest.TestCase):
|
|||||||
"""Test for read_segments() with an invalid ELF file"""
|
"""Test for read_segments() with an invalid ELF file"""
|
||||||
fname = self.ElfTestFile('embed_data')
|
fname = self.ElfTestFile('embed_data')
|
||||||
with self.assertRaises(ValueError) as e:
|
with self.assertRaises(ValueError) as e:
|
||||||
elf.read_segments(tools.GetBytes(100, 100))
|
elf.read_segments(tools.get_bytes(100, 100))
|
||||||
self.assertIn('Magic number does not match', str(e.exception))
|
self.assertIn('Magic number does not match', str(e.exception))
|
||||||
|
|
||||||
|
|
||||||
|
@@ -931,6 +931,17 @@ This calls mkimage to create an imximage with u-boot-spl.bin as the input
|
|||||||
file. The output from mkimage then becomes part of the image produced by
|
file. The output from mkimage then becomes part of the image produced by
|
||||||
binman.
|
binman.
|
||||||
|
|
||||||
|
To use CONFIG options in the arguments, use a string list instead, as in
|
||||||
|
this example which also produces four arguments::
|
||||||
|
|
||||||
|
mkimage {
|
||||||
|
args = "-n", CONFIG_SYS_SOC, "-T imximage";
|
||||||
|
|
||||||
|
u-boot-spl {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
|
Entry: opensbi: RISC-V OpenSBI fw_dynamic blob
|
||||||
|
@@ -31,10 +31,21 @@ class Entry_mkimage(Entry):
|
|||||||
This calls mkimage to create an imximage with u-boot-spl.bin as the input
|
This calls mkimage to create an imximage with u-boot-spl.bin as the input
|
||||||
file. The output from mkimage then becomes part of the image produced by
|
file. The output from mkimage then becomes part of the image produced by
|
||||||
binman.
|
binman.
|
||||||
|
|
||||||
|
To use CONFIG options in the arguments, use a string list instead, as in
|
||||||
|
this example which also produces four arguments::
|
||||||
|
|
||||||
|
mkimage {
|
||||||
|
args = "-n", CONFIG_SYS_SOC, "-T imximage";
|
||||||
|
|
||||||
|
u-boot-spl {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, section, etype, node):
|
def __init__(self, section, etype, node):
|
||||||
super().__init__(section, etype, node)
|
super().__init__(section, etype, node)
|
||||||
self._args = fdt_util.GetString(self._node, 'args').split(' ')
|
self._args = fdt_util.GetArgs(self._node, 'args')
|
||||||
self._mkimage_entries = OrderedDict()
|
self._mkimage_entries = OrderedDict()
|
||||||
self.align_default = None
|
self.align_default = None
|
||||||
self.ReadEntries()
|
self.ReadEntries()
|
||||||
|
Reference in New Issue
Block a user