From f5556c3eba17bbcdc58d97984d3223476f005ee1 Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Wed, 23 Oct 2019 11:00:27 -0300 Subject: [PATCH] imgtool: fix header padding value check Commit 9117fded476768b458253902a7d9c87e3663802a added support for supplying an `--erased-val`, which defaults to 0xff. When padding a header, the checks were still validating against 0, which is the value used for padding by the Zephyr build system. Now when the user passes `--pad-header` this check is skipped (we already know the contents). Signed-off-by: Fabio Utzig --- scripts/imgtool/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/imgtool/image.py b/scripts/imgtool/image.py index 8adc87b3..cfc9b7cc 100644 --- a/scripts/imgtool/image.py +++ b/scripts/imgtool/image.py @@ -197,7 +197,7 @@ class Image(): """Perform some sanity checking of the image.""" # If there is a header requested, make sure that the image # starts with all zeros. - if self.header_size > 0: + if self.header_size > 0 and not self.pad_header: if any(v != 0 for v in self.payload[0:self.header_size]): raise Exception("Padding requested, but image does not start with zeros") if self.slot_size > 0: