[PATCH v2 08/15] makefile: Avoid objcopy --gap-fill for .hex/.srec
Ilias Apalodimas
ilias.apalodimas at linaro.org
Sun Mar 30 08:47:14 CEST 2025
On Sun, 16 Mar 2025 at 00:18, Sam Edwards <cfsworks at gmail.com> wrote:
>
> This flag only makes sense for `binary` output, because .hex/.srec are
> sparse formats and represent gaps without filler. While the GNU binutils
> version of objcopy does not seem to mind the extra flag being passed,
> llvm-objcopy considers this a fatal error.
>
> There is already a version of the objcopy command template in the
> Makefile that doesn't use --gap-fill, which is provided for EFI. So use
> this other version for all .hex/.srec outputs as well.
>
> Signed-off-by: Sam Edwards <CFSworks at gmail.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
> Makefile | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 0694c425438..9c353af17cd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1067,7 +1067,7 @@ quiet_cmd_objcopy = OBJCOPY $@
> cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \
> $(OBJCOPYFLAGS_$(@F)) $< $@
>
> -# Provide a version which does not do this, for use by EFI
> +# Provide a version which does not do this, for use by EFI and hex/srec
> quiet_cmd_zobjcopy = OBJCOPY $@
> cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
>
> @@ -1282,7 +1282,7 @@ OBJCOPYFLAGS_u-boot.hex := -O ihex
> OBJCOPYFLAGS_u-boot.srec := -O srec
>
> u-boot.hex u-boot.srec: u-boot FORCE
> - $(call if_changed,objcopy)
> + $(call if_changed,zobjcopy)
>
> OBJCOPYFLAGS_u-boot-elf.srec := $(OBJCOPYFLAGS_u-boot.srec)
>
> @@ -1296,12 +1296,12 @@ OBJCOPYFLAGS_u-boot-elf.srec += --change-addresses=0x50000000
> endif
>
> u-boot-elf.srec: u-boot.elf FORCE
> - $(call if_changed,objcopy)
> + $(call if_changed,zobjcopy)
>
> OBJCOPYFLAGS_u-boot-spl.srec = $(OBJCOPYFLAGS_u-boot.srec)
>
> spl/u-boot-spl.srec: spl/u-boot-spl FORCE
> - $(call if_changed,objcopy)
> + $(call if_changed,zobjcopy)
>
> %.scif: %.srec
> $(Q)$(MAKE) $(build)=arch/arm/mach-renesas $@
> @@ -1436,7 +1436,7 @@ OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
> OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
>
> u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
> - $(call if_changed,objcopy)
> + $(call if_changed,zobjcopy)
>
> ifdef CONFIG_SPL_LOAD_FIT
> MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
> --
> 2.48.1
>
More information about the U-Boot
mailing list