[U-Boot] [PATCH V2 1/3] mkimage: ublimage must return if the header is not verified
Stefano Babic
sbabic at denx.de
Thu Sep 22 12:25:12 CEST 2011
Each image handler must return a not-zero value if the
header is not recognized to allow the main program to
iterate to the next handler.
Signed-off-by: Stefano Babic <sbabic at denx.de>
CC: Heiko Schocher <hs at denx.de>
---
Changes since V1:
- correct commit message (Heiko Schocher)
tools/ublimage.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/ublimage.c b/tools/ublimage.c
index 9987462..d6b4017 100644
--- a/tools/ublimage.c
+++ b/tools/ublimage.c
@@ -214,6 +214,11 @@ static int ublimage_check_image_types(uint8_t type)
static int ublimage_verify_header(unsigned char *ptr, int image_size,
struct mkimage_params *params)
{
+ struct ubl_header *ubl_hdr = (struct ubl_header *)ptr;
+
+ if ((ubl_hdr->magic & 0xFFFFFF00) != UBL_MAGIC_BASE)
+ return -1;
+
return 0;
}
--
1.7.1
More information about the U-Boot
mailing list