Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Neal Frager via buildroot <buildroot@buildroot.org>
Cc: luca.ceresoli@bootlin.com, Neal Frager <neal.frager@amd.com>,
	kris.chaplin@amd.com, wesley@sonifex.co.uk,
	giulio.benetti@benettiengineering.com, michal.simek@amd.com,
	yann.morin.1998@free.fr
Subject: Re: [Buildroot] [PATCH v2 1/1] boot/uboot/uboot.mk: add pmufw.elf support
Date: Wed, 12 Oct 2022 22:33:15 +0200	[thread overview]
Message-ID: <20221012223315.68f43720@windsurf> (raw)
In-Reply-To: <20221012175426.32367-1-neal.frager@amd.com>

Hello,

On Wed, 12 Oct 2022 11:54:26 -0600
Neal Frager via buildroot <buildroot@buildroot.org> wrote:

> This patch adds support for zynqmp pmufw.elf files.
> It will allow buildroot to use pmufw.elf binaries directly
> from the Xilinx git repository built by petalinux.
> 
> https://github.com/Xilinx/ubuntu-firmware/tree/v2022.1_22.04_1/xlnx-firmware
> 
> It will solve the problem of the pmufw built by the
> zynqmp-pmufw-builder where soft resets crash.  Details of the issue
> can be found here:
> 
> https://lore.kernel.org/buildroot/87ilqccu3k.fsf@dell.be.48ers.dk/
> 
> Instead of using a pmufw binary built by the zynqmp-pmufw-builder, this patch
> enables a pmufw binary built by petalinux to solve the issue.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>

I think the whole commit log is a bit confusing. What this commit
allows is to use a PMU FW as an ELF binary in addition to allowing to
use a PMU FW provided as a raw binary.

And indeed, this will allow using the PMU FW provided by Petalinux in
addition to the ones of zynqmp-pmufw-builder, which is the motivation
for the change.

> +UBOOT_ZYNQMP_PMUFW_BASENAME=$(basename $(UBOOT_ZYNQMP_PMUFW_PATH))
> +UBOOT_ZYNQMP_PMUFW_SUFFIX=$(suffix $(UBOOT_ZYNQMP_PMUFW_PATH))

Spaces around = sign.

> +
> +ifeq ($(UBOOT_ZYNQMP_PMUFW_SUFFIX),.elf)
> +UBOOT_ZYNQMP_PMUFW_CONVERT=y

Ditto.

> +endif
> +
>  define UBOOT_ZYNQMP_KCONFIG_PMUFW
> -	$(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)")
> +	$(if $(UBOOT_ZYNQMP_PMUFW_CONVERT),
> +		objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_BASENAME).elf $(UBOOT_ZYNQMP_PMUFW_BASENAME).bin)

You could also write this like this:

	$(if $(filter %.elf,$(UBOOT_ZYNQMP_PMUFW_PATH)),
		objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_BASENAME).elf $(UBOOT_ZYNQMP_PMUFW_BASENAME).bin)

and get rid of UBOOT_ZYNQMP_PMUFW_CONVERT entirely.

I was wondering if the usage of objcopy was correct or whether
$(TARGET_OBJCOPY) would be more correct. But in fact none of them is
perfect I guess: the PMU FW is a Microblaze ELF binary, while
$(TARGET_OBJCOPY) will be an ARM64 objcopy, and plain objcopy will be
the machine native objcopy, very unlikely to be a Microblaze one :-)

So overall, I guess using objcopy is fine here.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-10-12 20:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 17:54 [Buildroot] [PATCH v2 1/1] boot/uboot/uboot.mk: add pmufw.elf support Neal Frager via buildroot
2022-10-12 20:33 ` Thomas Petazzoni via buildroot [this message]
2022-10-13  5:57   ` Frager, Neal via buildroot
2022-10-13  6:38     ` Thomas Petazzoni via buildroot
2022-10-13  6:41       ` Frager, Neal via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221012223315.68f43720@windsurf \
    --to=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=kris.chaplin@amd.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=michal.simek@amd.com \
    --cc=neal.frager@amd.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wesley@sonifex.co.uk \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox