diff mbox series

[2/2] boot/uboot: use $(TARGET_OBJCOPY) for ZynqMP pmufw.elf

Message ID 20240815-boot-uboot-clean-for-pmufw-v1-2-3f0d9909c0b4@collins.com
State New
Headers show
Series boot/uboot: clean-up for ZynqMP pmufw handling | expand

Commit Message

Brandon Maier Aug. 15, 2024, 2:22 p.m. UTC
Converting the pmufw.elf to a binary works with any objcopy, regardless
if it's from the host or cross-compiler. Prefer to use the
$(TARGET_OBJCOPY) as it's always available and reproducible.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
 boot/uboot/uboot.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Frager, Neal via buildroot Aug. 15, 2024, 5:43 p.m. UTC | #1
Hi Brandon,

> Converting the pmufw.elf to a binary works with any objcopy, regardless
> if it's from the host or cross-compiler. Prefer to use the
> $(TARGET_OBJCOPY) as it's always available and reproducible.

> Signed-off-by: Brandon Maier <brandon.maier@collins.com>

I confirm that objcopy is arch agnostic, so it does not matter whether it is
an x86 objcopy or arm objcopy when converting a microblaze .elf to .bin.

You have convinced me that this is worth changing because of your
reproducibility argument.

Reviewed-by: Neal Frager <neal.frager@amd.com>

Best regards,
Neal Frager
AMD
Luca Ceresoli Aug. 19, 2024, 8:38 a.m. UTC | #2
Hello Brandon,

On Thu, 15 Aug 2024 14:22:31 +0000
Brandon Maier <brandon.maier@collins.com> wrote:

> Converting the pmufw.elf to a binary works with any objcopy, regardless
> if it's from the host or cross-compiler. Prefer to use the
> $(TARGET_OBJCOPY) as it's always available and reproducible.
> 
> Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> ---
>  boot/uboot/uboot.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index 9de0776ace..08493996e5 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -463,7 +463,7 @@ endif #BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
>  ifeq ($(suffix $(UBOOT_ZYNQMP_PMUFW_PATH)),.elf)
>  UBOOT_ZYNQMP_PMUFW_PATH_FINAL = $(basename $(UBOOT_ZYNQMP_PMUFW_PATH)).bin
>  define UBOOT_ZYNQMP_PMUFW_CONVERT
> -	objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)
> +	$(TARGET_OBJCOPY) -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)

As I wrote earlier today (way after you sent this patch, so surely not
blaming you!) a short comment would help understand why we are using
the "wrong" objcopy.

E.g.:

 # objcopy is arch-agnostic so we can use $(TARGET_OBJCOPY) in lack of
 # a microblaze objcopy

But this can be added later, or in v2 in case you send one, so:

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Brandon Maier Aug. 19, 2024, 7:41 p.m. UTC | #3
Hi Luca,

On Mon Aug 19, 2024 at 8:38 AM UTC, Luca Ceresoli via buildroot wrote:
> Hello Brandon,
>
> On Thu, 15 Aug 2024 14:22:31 +0000
> Brandon Maier <brandon.maier@collins.com> wrote:
>
> > Converting the pmufw.elf to a binary works with any objcopy, regardless
> > if it's from the host or cross-compiler. Prefer to use the
> > $(TARGET_OBJCOPY) as it's always available and reproducible.
> >
> > Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> > ---
> >  boot/uboot/uboot.mk | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> > index 9de0776ace..08493996e5 100644
> > --- a/boot/uboot/uboot.mk
> > +++ b/boot/uboot/uboot.mk
> > @@ -463,7 +463,7 @@ endif #BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
> >  ifeq ($(suffix $(UBOOT_ZYNQMP_PMUFW_PATH)),.elf)
> >  UBOOT_ZYNQMP_PMUFW_PATH_FINAL = $(basename $(UBOOT_ZYNQMP_PMUFW_PATH)).bin
> >  define UBOOT_ZYNQMP_PMUFW_CONVERT
> > -	objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)
> > +	$(TARGET_OBJCOPY) -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)
>
> As I wrote earlier today (way after you sent this patch, so surely not
> blaming you!) a short comment would help understand why we are using
> the "wrong" objcopy.
>
> E.g.:
>
>  # objcopy is arch-agnostic so we can use $(TARGET_OBJCOPY) in lack of
>  # a microblaze objcopy

Agreed a comment would be good, I sent a v2 with this change.

Thank you!
Brandon Maier

>
> But this can be added later, or in v2 in case you send one, so:
>
> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
diff mbox series

Patch

diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 9de0776ace..08493996e5 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -463,7 +463,7 @@  endif #BR2_TARGET_UBOOT_ZYNQMP_PMUFW_PREBUILT
 ifeq ($(suffix $(UBOOT_ZYNQMP_PMUFW_PATH)),.elf)
 UBOOT_ZYNQMP_PMUFW_PATH_FINAL = $(basename $(UBOOT_ZYNQMP_PMUFW_PATH)).bin
 define UBOOT_ZYNQMP_PMUFW_CONVERT
-	objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)
+	$(TARGET_OBJCOPY) -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_PATH) $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)
 endef
 UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PMUFW_CONVERT
 else