summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>2022-02-09 22:02:35 +0300
committerSimon Glass <sjg@chromium.org>2022-02-22 10:05:44 -0700
commitee813c86f99006bf37826d195e7212cf98803de6 (patch)
tree3c564e2bba9b9d8092dd847b0362dfd298cb6397 /tools/binman/ftest.py
parent17a0dc6abfdbf392f6a27074f2633608038c4221 (diff)
binman: Skip processing "hash" subnodes of FIT subsections
Binman's FIT entry type can have image subentries with "hash" subnodes intended to be processed by mkimage, but not binman. However, the Entry class and any subclass that reuses its implementation tries to process these unconditionally. This can lead to an error when boards specify hash algorithms that binman doesn't support, but mkimage supports. Let entries skip processing these "hash" subnodes based on an instance variable, and set this instance variable for FIT subsections. Also re-enable processing of calculated and missing properties of FIT entries which was disabled to mitigate this issue. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 59b6d52fbe4..b6801b72756 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -5160,5 +5160,29 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
self.assertRegex(err,
"Image 'main-section'.*missing bintools.*: futility")
+ def testFitSubentryHashSubnode(self):
+ """Test an image with a FIT inside"""
+ data, _, _, out_dtb_name = self._DoReadFileDtb(
+ '221_fit_subentry_hash.dts', use_real_dtb=True, update_dtb=True)
+
+ mkimage_dtb = fdt.Fdt.FromData(data)
+ mkimage_dtb.Scan()
+ binman_dtb = fdt.Fdt(out_dtb_name)
+ binman_dtb.Scan()
+
+ # Check that binman didn't add hash values
+ fnode = binman_dtb.GetNode('/binman/fit/images/kernel/hash')
+ self.assertNotIn('value', fnode.props)
+
+ fnode = binman_dtb.GetNode('/binman/fit/images/fdt-1/hash')
+ self.assertNotIn('value', fnode.props)
+
+ # Check that mkimage added hash values
+ fnode = mkimage_dtb.GetNode('/images/kernel/hash')
+ self.assertIn('value', fnode.props)
+
+ fnode = mkimage_dtb.GetNode('/images/fdt-1/hash')
+ self.assertIn('value', fnode.props)
+
if __name__ == "__main__":
unittest.main()