mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
binman: Handle missing bintools correctly in fit
At present these are handled as if they are allowed to be missing, but this is only true if the -M flag is provided. Fix this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
e00197f92d
commit
033828cf34
2 changed files with 11 additions and 1 deletions
|
@ -453,6 +453,8 @@ class Entry_fit(Entry_section):
|
||||||
args.update({'align': fdt_util.fdt32_to_cpu(align.value)})
|
args.update({'align': fdt_util.fdt32_to_cpu(align.value)})
|
||||||
if self.mkimage.run(reset_timestamp=True, output_fname=output_fname,
|
if self.mkimage.run(reset_timestamp=True, output_fname=output_fname,
|
||||||
**args) is None:
|
**args) is None:
|
||||||
|
if not self.GetAllowMissing():
|
||||||
|
self.Raise("Missing tool: 'mkimage'")
|
||||||
# Bintool is missing; just use empty data as the output
|
# Bintool is missing; just use empty data as the output
|
||||||
self.record_missing_bintool(self.mkimage)
|
self.record_missing_bintool(self.mkimage)
|
||||||
return tools.get_bytes(0, 1024)
|
return tools.get_bytes(0, 1024)
|
||||||
|
|
|
@ -3999,9 +3999,17 @@ class TestFunctional(unittest.TestCase):
|
||||||
self.assertEqual(expected, data[image_pos:image_pos+size])
|
self.assertEqual(expected, data[image_pos:image_pos+size])
|
||||||
|
|
||||||
def testFitMissing(self):
|
def testFitMissing(self):
|
||||||
|
"""Test that binman complains if mkimage is missing"""
|
||||||
|
with self.assertRaises(ValueError) as e:
|
||||||
|
self._DoTestFile('162_fit_external.dts',
|
||||||
|
force_missing_bintools='mkimage')
|
||||||
|
self.assertIn("Node '/binman/fit': Missing tool: 'mkimage'",
|
||||||
|
str(e.exception))
|
||||||
|
|
||||||
|
def testFitMissingOK(self):
|
||||||
"""Test that binman still produces a FIT image if mkimage is missing"""
|
"""Test that binman still produces a FIT image if mkimage is missing"""
|
||||||
with test_util.capture_sys_output() as (_, stderr):
|
with test_util.capture_sys_output() as (_, stderr):
|
||||||
self._DoTestFile('162_fit_external.dts',
|
self._DoTestFile('162_fit_external.dts', allow_missing=True,
|
||||||
force_missing_bintools='mkimage')
|
force_missing_bintools='mkimage')
|
||||||
err = stderr.getvalue()
|
err = stderr.getvalue()
|
||||||
self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage")
|
self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage")
|
||||||
|
|
Loading…
Reference in a new issue