[PATCH 1/3] scripts: fix_size: check magic

Sascha Hauer s.hauer at pengutronix.de
Fri Jan 31 12:57:14 EST 2014


On Wed, Jan 29, 2014 at 12:05:06PM +0100, Sascha Hauer wrote:
> Instead of passing the offset to the fix_size tool check the image to
> fixup for a valid header so that only recognized files are fixed up.
> This makes the usage of this tool safer.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  arch/arm/pbl/Makefile |  2 +-
>  scripts/fix_size.c    | 32 +++++++++++++++++++++++++-------
>  2 files changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile
> index bfa73b9..5e90f3d 100644
> --- a/arch/arm/pbl/Makefile
> +++ b/arch/arm/pbl/Makefile
> @@ -23,7 +23,7 @@ $(obj)/zbarebox.bin:	$(obj)/zbarebox FORCE
>  	$(call if_changed,objcopy)
>  	$(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
>  	$(Q)$(kecho) '  Barebox: fix size'
> -	$(Q)$(objtree)/scripts/fix_size -f $(objtree)/$@ -o 0x2c $(FIX_SIZE)
> +	$(Q)$(objtree)/scripts/fix_size -f $(objtree)/$@ $(FIX_SIZE)

I had to squash in a -i option to ignore invalid headers and return
successfully instead of failing. This is necessary for zynq which
doesn't generate an image with a barebox header but instead with a zynq
header. Before this patch fix_size silently corrupted the image.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list