From: Luca Ceresoli via buildroot <buildroot@buildroot.org>
To: Brandon Maier via buildroot <buildroot@buildroot.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Brandon Maier <brandon.maier@collins.com>,
Neal Frager <neal.frager@amd.com>
Subject: Re: [Buildroot] [PATCH] boot/uboot: fix dependency on xilinx-prebuilt
Date: Mon, 19 Aug 2024 09:51:32 +0200 [thread overview]
Message-ID: <20240819095132.5f49f19b@booty> (raw)
In-Reply-To: <D3GJE2B5H120.3AGKGHGRX6YB@collins.com>
Hello Brandon,
On Thu, 15 Aug 2024 13:58:07 +0000
Brandon Maier via buildroot <buildroot@buildroot.org> wrote:
> Hi Thomas,
>
> On Thu Aug 15, 2024 at 9:14 AM UTC, Thomas Petazzoni via buildroot wrote:
> > Hello Brandon,
> >
> > On Fri, 09 Aug 2024 16:30:18 +0000
> > Brandon Maier via buildroot <buildroot@buildroot.org> wrote:
> >
> > > When building with `make -j` and PER_PACKAGE_DIRECTORIES, a race
> > > condition occurs between xilinx-prebuilt and u-boot, resulting in the
> > > following error.
> > >
> > > objcopy -O binary -I elf32-little .../images/pmufw.elf .../images/pmufw.bin
> > > objcopy: '.../images/pmufw.elf': No such file
> > >
> > > U-Boot registers a KCONFIG_FIXUP_CMD that uses the pmufw.elf from
> > > xilinx-prebuilt. But KCONFIG_FIXUP_CMDS does not use the normal
> > > DEPENDENCIES, so xilinx-prebuilt is not guaranteed to have run before
> > > fixup.
> > >
> > > Instead move the `objcopy` call out to a PRE_BUILD_HOOK so it will run
> > > after xilinx-prebuilt has finished.
Thanks for having fixed this! I apologize for not having reviewed this
earlier -- vacation time + inbox full :(
> > > +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)
> >
> > Should we be using $(TARGET_OBJCOPY) instead of objcopy to use the
> > target toolchain objcopy?
>
> I'm not certain, as Neal pointed out the PMU.elf is a microblaze. I'm
> guessing this works today as `objcopy` probably doesn't need to support
> the target architecture to convert an ELF to a binary.
>
> If that is true, then maybe we should use $(TARGET_OBJCOPY) anyway. So
> we aren't relying on the build system's version of `objcopy`.
While both are "wrong but working", I agree using $(TARGET_OBJCOPY)
would make the process more reproducible and predictable. While there,
adding an explanatory comment would be a good idea.
> > > +endef
> > > +UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PMUFW_CONVERT
> > > +else
> > > +UBOOT_ZYNQMP_PMUFW_PATH_FINAL = $(UBOOT_ZYNQMP_PMUFW_PATH)
> > > +endif
> > > define UBOOT_ZYNQMP_KCONFIG_PMUFW
> > > - $(if $(filter %.elf,$(UBOOT_ZYNQMP_PMUFW_PATH)),
> > > - objcopy -O binary -I elf32-little $(UBOOT_ZYNQMP_PMUFW_BASENAME).elf $(UBOOT_ZYNQMP_PMUFW_BASENAME).bin
> > > - $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_BASENAME).bin"),
> > > - $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)"))
> > > + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH_FINAL)")
> >
> > This means this KCONFIG_SET_OPT is not unconditionally if I'm not
> > wrong (so even on platforms that are not Xilinx ones). Shouldn't it
> > only be done if $(UBOOT_ZYNQMP_PMUFW_PATH_FINAL) is not empty?
>
> This whole section is inside a `ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)`
> block, so it will only run on Xilinx ZynqMP platforms. However it's
> possible to set the PMUFW to an empty string and then it will set
> CONFIG_PMUFW_INIT_FILE to an empty string.
>
> If a developer set CONFIG_PMUFW_INIT_FILE in a custom U-Boot defconfig
> or frag, then this could overwrite it. Though I'm not sure if there's
> any practical use-case where this is an issue.
>
> I can send a patch to add the empty string check though, it seems
> harmless to add.
By a cursory look at the U-Boot code, it looks like the U-Boot build
would fail. If that's the case, I don't think we need an extra check
here: empty string would be just one of all possible incorrect settings
that just cause a build failure.
IOW, I'd only add a check if it can cause subtle issues that are
hard to notice and debug, like a "successful" build (returning zero)
producing non-working binaries.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2024-08-19 7:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 16:30 [Buildroot] [PATCH] boot/uboot: fix dependency on xilinx-prebuilt Brandon Maier via buildroot
2024-08-10 7:01 ` Frager, Neal via buildroot
2024-08-12 13:01 ` Brandon Maier via buildroot
2024-08-12 14:42 ` Frager, Neal via buildroot
2024-08-15 9:14 ` Thomas Petazzoni via buildroot
2024-08-15 11:04 ` Frager, Neal via buildroot
2024-08-15 13:58 ` Brandon Maier via buildroot
2024-08-19 7:51 ` Luca Ceresoli via buildroot [this message]
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=20240819095132.5f49f19b@booty \
--to=buildroot@buildroot.org \
--cc=brandon.maier@collins.com \
--cc=luca.ceresoli@bootlin.com \
--cc=neal.frager@amd.com \
--cc=thomas.petazzoni@bootlin.com \
/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