uboot-imx: backport upstream patch for binman
authorZoltan HERPAI <[email protected]>
Mon, 31 Mar 2025 11:20:42 +0000 (11:20 +0000)
committerZoltan HERPAI <[email protected]>
Mon, 31 Mar 2025 12:23:35 +0000 (14:23 +0200)
Backport a patch from upstream for binman, to allow specifying
"include" directories when looking for image files.

Signed-off-by: Zoltan HERPAI <[email protected]>
package/boot/uboot-imx/patches/0005-binman_Allow-providing-tools-and-blob-dirs.patch [new file with mode: 0644]

diff --git a/package/boot/uboot-imx/patches/0005-binman_Allow-providing-tools-and-blob-dirs.patch b/package/boot/uboot-imx/patches/0005-binman_Allow-providing-tools-and-blob-dirs.patch
new file mode 100644 (file)
index 0000000..149ce46
--- /dev/null
@@ -0,0 +1,85 @@
+From 7945077f7934fff2b9a5fba2860fe330e86093f1 Mon Sep 17 00:00:00 2001
+From: Simon Glass <[email protected]>
+Date: Tue, 23 Nov 2021 21:09:48 -0700
+Subject: [PATCH] binman: Allow providing tools and blob directories
+
+At present it is necessary to symlink files containing external blobs into
+the U-Boot tree in order for binman to find them. This is not very
+convenient.
+
+Add two new environment/Makefile variables to help with this. Add
+documentation as well, fixing a related nit.
+
+Signed-off-by: Simon Glass <[email protected]>
+---
+ Makefile                |  2 ++
+ tools/binman/binman.rst | 31 ++++++++++++++++++++++++++++++-
+ 2 files changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 57c3643d9a81..1885f3642019 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1303,11 +1303,13 @@ default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE))
+ quiet_cmd_binman = BINMAN  $@
+ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
++              $(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \
+                 --toolpath $(objtree)/tools \
+               $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
+               build -u -d u-boot.dtb -O . -m --allow-missing \
+               -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+               -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
++              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
+               -a atf-bl31-path=${BL31} \
+               -a opensbi-path=${OPENSBI} \
+               -a default-dt=$(default_dt) \
+diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
+index 35de93bd898a..210d0c5c51b1 100644
+--- a/tools/binman/binman.rst
++++ b/tools/binman/binman.rst
+@@ -942,7 +942,7 @@ Replacing files in an image
+ ---------------------------
+ You can replace files in an existing firmware image created by binman, provided
+-that there is an 'fdtmap' entry in the image. For example:
++that there is an 'fdtmap' entry in the image. For example::
+     $ binman replace -i image.bin section/cbfs/u-boot
+@@ -1081,6 +1081,35 @@ the tool's output will be used for the target or for the host machine. If those
+ aren't given, it will also try to derive target-specific versions from the
+ CROSS_COMPILE environment variable during a cross-compilation.
++If the tool is not available in the path you can use BINMAN_TOOLPATHS to specify
++a space-separated list of paths to search, e.g.::
++
++   BINMAN_TOOLPATHS="/tools/g12a /tools/tegra" binman ...
++
++
++External blobs
++--------------
++
++Binary blobs, even if the source code is available, complicate building
++firmware. The instructions can involve multiple steps and the binaries may be
++hard to build or obtain. Binman at least provides a unified description of how
++to build the final image, no matter what steps are needed to get there.
++
++Binman also provides a `blob-ext` entry type that pulls in a binary blob from an
++external file. If the file is missing, binman can optionally complete the build
++and just report a warning. Use the `-M/--allow-missing` option to enble this.
++This is useful in CI systems which want to check that everything is correct but
++don't have access to the blobs.
++
++If the blobs are in a different directory, you can specify this with the `-I`
++option.
++
++For U-Boot, you can use set the BINMAN_INDIRS environment variable to provide a
++space-separated list of directories to search for binary blobs::
++
++   BINMAN_INDIRS="odroid-c4/fip/g12a \
++       odroid-c4/build/board/hardkernel/odroidc4/firmware \
++       odroid-c4/build/scp_task" binman ...
+ Code coverage
+ -------------