Sometimes it's useful to be able to include the barebox-
generated dtb. An example would be the FIP image target
for TF-A and stm32mp1 targets.

Prefix the barebox-installed dtbs with "barebox-" as they can
have the same name as kernel dtbs for example.

This can partly go away if/when barebox decides to promote
dtbs to the barebox-flash-images file.
Although one would probably still want to rename the dtbs
to avoid a name collision.

Signed-off-by: Christian Melki <[email protected]>
---
 platforms/barebox.in | 8 ++++++++
 rules/barebox.make   | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/platforms/barebox.in b/platforms/barebox.in
index c8192f0c9..2a89df074 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -89,6 +89,14 @@ config BAREBOX_BAREBOXENV
          environment. Enable this option to access the barebox environment
          from the target Linux system.
 
+config BAREBOX_INSTALL_DTBS
+       prompt "install dtbs"
+       bool
+       help
+         Install barebox generated dtbs into the image directory.
+        These dtbs can, for example, be used when constructing a
+        FIP image for TF-A boot.
+
 config BAREBOX_BAREBOXCRC32
        prompt "install 'bareboxcrc32'"
        bool
diff --git a/rules/barebox.make b/rules/barebox.make
index 581fd1ff9..7aa04f02c 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -180,6 +180,11 @@ endif
 
        @$(call world/image-clean, BAREBOX)
 
+ifdef PTXCONF_BAREBOX_INSTALL_DTBS
+       @$(foreach dtb, $(shell find $(BAREBOX_BUILD_DIR) -name "*.dtb"), \
+               $(call ptx/image-install, BAREBOX, $(dtb), barebox-$(notdir 
$(dtb)));)
+endif
+
        @$(foreach image, $(shell cat 
$(BAREBOX_BUILD_DIR)/barebox-flash-images), \
                $(call ptx/image-install, BAREBOX, 
$(BAREBOX_BUILD_DIR)/$(image)); \
                if [ ! -e $(IMAGEDIR)/barebox-image ]; then \
-- 
2.34.1


Reply via email to