mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory
@ 2025-03-13 12:21 Benjamin Gaignard
  2025-03-13 12:52 ` Christian Melki
  2025-03-13 14:28 ` Michael Tretter
  0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Gaignard @ 2025-03-13 12:21 UTC (permalink / raw)
  To: ptxdist; +Cc: Benjamin Gaignard

If ARM trusted firmware option has been selected copy the
generated bl32 binaries to barebox firmware directory so they
can be included in barebox build process.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
 rules/barebox.make | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/rules/barebox.make b/rules/barebox.make
index c0d9c5744..15c06d685 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -119,6 +119,16 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
 			$(BAREBOX_BUILD_DIR)/.config; \
 	fi
 endif
+
+ifdef PTXCONF_TF_A
+	mkdir -p $(BAREBOX_BUILD_DIR)/firmware/
+	@for i in `find $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/ -maxdepth 1 \
+	-type f -name *-bl31.bin -printf "%f\n"`; do \
+		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_BUILD_DIR)/firmware/; \
+		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_DIR)/firmware/; \
+	done
+endif
+
 	@$(call world/compile, BAREBOX)
 	@$(call touch)
 
-- 
2.43.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory
  2025-03-13 12:21 [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory Benjamin Gaignard
@ 2025-03-13 12:52 ` Christian Melki
  2025-03-13 14:28 ` Michael Tretter
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Melki @ 2025-03-13 12:52 UTC (permalink / raw)
  To: ptxdist

Hi Benjamin.

On 3/13/25 1:21 PM, Benjamin Gaignard wrote:
> If ARM trusted firmware option has been selected copy the
> generated bl32 binaries to barebox firmware directory so they
> can be included in barebox build process.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> ---
>  rules/barebox.make | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/rules/barebox.make b/rules/barebox.make
> index c0d9c5744..15c06d685 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -119,6 +119,16 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
>  			$(BAREBOX_BUILD_DIR)/.config; \
>  	fi
>  endif
> +
> +ifdef PTXCONF_TF_A
> +	mkdir -p $(BAREBOX_BUILD_DIR)/firmware/
> +	@for i in `find $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/ -maxdepth 1 \
> +	-type f -name *-bl31.bin -printf "%f\n"`; do \
> +		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_BUILD_DIR)/firmware/; \
> +		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_DIR)/firmware/; \
> +	done
> +endif
> +

I sort of get what you're trying to do, but this looks like all kinds of
weird. Naming, placement, constituents and targetinstall to pre-build?
I would suggest that a better interface for what is expected between
TF-A and BB is what is needed.

Regards,
Christian

>  	@$(call world/compile, BAREBOX)
>  	@$(call touch)
>  




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory
  2025-03-13 12:21 [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory Benjamin Gaignard
  2025-03-13 12:52 ` Christian Melki
@ 2025-03-13 14:28 ` Michael Tretter
  2025-03-13 14:47   ` Michael Olbrich
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Tretter @ 2025-03-13 14:28 UTC (permalink / raw)
  To: ptxdist; +Cc: Benjamin Gaignard

On Thu, 13 Mar 2025 13:21:50 +0100, Benjamin Gaignard wrote:
> If ARM trusted firmware option has been selected copy the
> generated bl32 binaries to barebox firmware directory so they
> can be included in barebox build process.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> ---
>  rules/barebox.make | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/rules/barebox.make b/rules/barebox.make
> index c0d9c5744..15c06d685 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -119,6 +119,16 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
>  			$(BAREBOX_BUILD_DIR)/.config; \
>  	fi
>  endif
> +
> +ifdef PTXCONF_TF_A
> +	mkdir -p $(BAREBOX_BUILD_DIR)/firmware/
> +	@for i in `find $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/ -maxdepth 1 \
> +	-type f -name *-bl31.bin -printf "%f\n"`; do \
> +		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_BUILD_DIR)/firmware/; \
> +		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_DIR)/firmware/; \
> +	done
> +endif
> +

There is already a (underdocumented) mechanism to copy binaries to the
barebox firmware directory: The PTXCONF_BAREBOX_FIRMWARE option and the
world/inject call.

Enable PTXCONF_BAREBOX_FIRMWARE and add the filenames of the binaries
that you want to install and their target location to the
BAREBOX_INJECT_FILES variable. The inject mechanism copies the files
from /usr/lib/firmware (BAREBOX_INJECT_PATH) to a specified location in
the barebox build directory.

Michael

>  	@$(call world/compile, BAREBOX)
>  	@$(call touch)
>  
> -- 
> 2.43.0
> 
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory
  2025-03-13 14:28 ` Michael Tretter
@ 2025-03-13 14:47   ` Michael Olbrich
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Olbrich @ 2025-03-13 14:47 UTC (permalink / raw)
  To: Michael Tretter; +Cc: Benjamin Gaignard, ptxdist

On Thu, Mar 13, 2025 at 03:28:33PM +0100, Michael Tretter wrote:
> On Thu, 13 Mar 2025 13:21:50 +0100, Benjamin Gaignard wrote:
> > If ARM trusted firmware option has been selected copy the
> > generated bl32 binaries to barebox firmware directory so they
> > can be included in barebox build process.
> > 
> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> > ---
> >  rules/barebox.make | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/rules/barebox.make b/rules/barebox.make
> > index c0d9c5744..15c06d685 100644
> > --- a/rules/barebox.make
> > +++ b/rules/barebox.make
> > @@ -119,6 +119,16 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
> >  			$(BAREBOX_BUILD_DIR)/.config; \
> >  	fi
> >  endif
> > +
> > +ifdef PTXCONF_TF_A
> > +	mkdir -p $(BAREBOX_BUILD_DIR)/firmware/
> > +	@for i in `find $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/ -maxdepth 1 \
> > +	-type f -name *-bl31.bin -printf "%f\n"`; do \
> > +		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_BUILD_DIR)/firmware/; \
> > +		cp $(PTXCONF_SYSROOT_TARGET)/usr/lib/firmware/$$i $(BAREBOX_DIR)/firmware/; \
> > +	done
> > +endif
> > +
> 
> There is already a (underdocumented) mechanism to copy binaries to the
> barebox firmware directory: The PTXCONF_BAREBOX_FIRMWARE option and the
> world/inject call.
> 
> Enable PTXCONF_BAREBOX_FIRMWARE and add the filenames of the binaries
> that you want to install and their target location to the
> BAREBOX_INJECT_FILES variable. The inject mechanism copies the files
> from /usr/lib/firmware (BAREBOX_INJECT_PATH) to a specified location in
> the barebox build directory.

The patches[1] that introduced this feature also contained integration for
rockchip firmware. I did not apply those patches, but they are a good place
to look at if you need to do your own integration in your BSP.

Michael


[1] https://lore.ptxdist.org/ptxdist/20220129070330.2601433-1-michael.riesch@wolfvision.net/

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-13 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-13 12:21 [ptxdist] [PATCH] barebox: Copy TF-A binaries in to barebox firmware directory Benjamin Gaignard
2025-03-13 12:52 ` Christian Melki
2025-03-13 14:28 ` Michael Tretter
2025-03-13 14:47   ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox