Skip to contentSkip to conversation

Makefile: Fake external blob with BINMAN_ALLOW_MISSING=1

PATCH In review Simon Glass 3 participants 5 messages Nov 6, 2024 – Nov 18, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makefile: Fake external blob with BINMAN_ALLOW_MISSING=1

This flag was lost by a previous change and has never been restored. Without it, binman cannot fully handle missing blobs which are themselves inputs to mkimage.

Discussion on this at [1] indicated that this was necessary but the patch was not updated.

Restore the flag so that all missing blobs are reported.

Fixes 93685d0dcb9 ("Makefile: With BINMAN_ALLOW_MISSING=1 don't error")

---

Changes in v2:
- Use Link: and avoid a line break

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 7275a02f24c..f92f46b3ab7 100644
@@ -1398,7 +1398,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                 --toolpath $(objtree)/tools \
 		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
 		build -u -d u-boot.dtb -O . -m \
-		--allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
+		--allow-missing --fake-ext-blobs \
+		$(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
 		$(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
 		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Simon Glass

This flag was lost by a previous change and has never been restored. Without it, binman cannot fully handle missing blobs which are themselves inputs to mkimage.

Discussion on this at [1] indicated that this was necessary but the patch was not updated.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#2 lore raw
In reply to Simon Glass

Hi Simon,

Quoted 10 lines · Simon Glass

This flag was lost by a previous change and has never been restored. Without it, binman cannot fully handle missing blobs which are themselves inputs to mkimage.

Discussion on this at [1] indicated that this was necessary but the patch was not updated.

Restore the flag so that all missing blobs are reported.

sorry I'm picking this up so late;
As I am working on OP-TEE addition to imx8m boards [1], this patch got my interest. I applied the patch on top of my patchstack and tried to build (phycore-imx8mp) with missing tee.bin binary and got unexpected results:

Image 'image' has faked external blobs and is non-functional: tee.bin

Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Some images are invalid

So build fails even though tee.bin is marked as optional. Did I miss another patch that must be used in conjunction with this one?

Before this patch, I see the following output.

Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

With successful build.

Yannic

[1] https://lore.kernel.org/u-boot/[email protected]

Quoted 25 lines
Fixes 93685d0dcb9 ("Makefile: With BINMAN_ALLOW_MISSING=1 don't error")

---

Changes in v2:
- Use Link: and avoid a line break

 Makefile | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 7275a02f24c..f92f46b3ab7 100644
@@ -1398,7 +1398,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                  --toolpath $(objtree)/tools \
  		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
  		build -u -d u-boot.dtb -O . -m \
-		--allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
+		--allow-missing --fake-ext-blobs \
+		$(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
  		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
  		$(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
  		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
#3 lore raw

Hi Yannic,

Quoted 38 lines · Yannic Moog

Hi Simon,

Quoted 10 lines · Simon Glass

This flag was lost by a previous change and has never been restored. Without it, binman cannot fully handle missing blobs which are themselves inputs to mkimage.

Discussion on this at [1] indicated that this was necessary but the patch was not updated.

Restore the flag so that all missing blobs are reported.

sorry I'm picking this up so late;
As I am working on OP-TEE addition to imx8m boards [1], this patch got my interest. I applied the patch on top of my patchstack and tried to build (phycore-imx8mp) with missing tee.bin binary and got unexpected results:

Image 'image' has faked external blobs and is non-functional: tee.bin

Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Some images are invalid

So build fails even though tee.bin is marked as optional. Did I miss another patch that must be used in conjunction with this one?

Before this patch, I see the following output.

Quoted 8 lines

Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

With successful build.

The previous behaviour was a bug, at least that's what I concluded. It was ignored sections within sections, in some cases.

Do you have tee in there twice? It seems strange to get this case.

If you can't figure it out, can you send patches or share a tree?

Quoted 16 lines

Yannic

[1] https://lore.kernel.org/u-boot/[email protected]

Quoted 11 lines
Fixes 93685d0dcb9 ("Makefile: With BINMAN_ALLOW_MISSING=1 don't error")

---

Changes in v2:
- Use Link: and avoid a line break

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 15 lines
Quoted 5 lines
Makefile +0 -0
index 7275a02f24c..f92f46b3ab7 100644

Makefile cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ · line 1405

Quoted 9 lines
Makefile +2 -1
@@ -1398,7 +1398,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                 --toolpath $(objtree)/tools \
              $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
              build -u -d u-boot.dtb -O . -m \
-             --allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
+             --allow-missing --fake-ext-blobs \
+             $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
              -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \

Regards,
Simon

#4 lore raw
Quoted 61 lines · Simon Glass

Hi Yannic,

Quoted 58 lines · Yannic Moog

Hi Simon,

Quoted 5 lines · Simon Glass

This flag was lost by a previous change and has never been restored.
Without it, binman cannot fully handle missing blobs which are themselves inputs to mkimage.

Quoted 8 lines

Discussion on this at [1] indicated that this was necessary but the
patch was not updated.

Restore the flag so that all missing blobs are reported.

Link:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

sorry I'm picking this up so late;
As I am working on OP-TEE addition to imx8m boards [1], this patch got my interest.
I applied the patch on top of my patchstack and tried to build (phycore-imx8mp) with missing tee.bin
binary and got unexpected results:

Image 'image' has faked external blobs and is non-functional:
tee.bin

Image 'image' is missing optional external blobs but is still
functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
   See the documentation for your board. You may need to build Open Portable
   Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Some images are invalid

So build fails even though tee.bin is marked as optional. Did I miss another patch that must be used in conjunction with this one?

Before this patch, I see the following output.

Image 'image' is missing optional external blobs but is still
functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
   See the documentation for your board. You may need to build Open Portable
   Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin

Quoted 7 lines
Quoted 1 line

With successful build.

The previous behaviour was a bug, at least that's what I concluded. It
was ignored sections within sections, in some cases.

Do you have tee in there twice? It seems strange to get this case.

No, not as far as I am aware.

Quoted 2 lines

If you can't figure it out, can you send patches or share a tree?

Yes, I did supply patches in my previous comment, see [1] (Based on imx tree).

Anyway, I did some digging in binman and so far this is what I found:

Since in this patch you add --fake-ext-blobs the default False will be overridden in the call to binman.
This Truth value is propagated until the following happens:

Entry_tee_os.ObtainContents() -> Entry_blob.ObtainContents() (this calls get_input_filename() which return None since tee is missing)
-> Entry.check_fake_fname().
check_fake_fname sets faked to True and this causes tee-os to be added to the list of faked entries when control.CheckForProblems() calls Entry_blob.CheckFakedBlobs() leading to the output in my previous message.

Yannic

[1]
https://patchwork.ozlabs.org/project/uboot/list/?series=431695&state=*

Quoted 41 lines
Quoted 29 lines

Yannic

[1]
https://lore.kernel.org/u-boot/[email protected]

Quoted 22 lines
Fixes 93685d0dcb9 ("Makefile: With BINMAN_ALLOW_MISSING=1 don't

error")
---

Changes in v2:
- Use Link: and avoid a line break

 Makefile | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -1
index 7275a02f24c..f92f46b3ab7 100644
@@ -1398,7 +1398,8 @@ cmd_binman = $(srctree)/tools/binman/binman
 $(if $(BINMAN_DEBUG),-D) \
                  --toolpath $(objtree)/tools \
               $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
               build -u -d u-boot.dtb -O . -m \
-             --allow-missing $(if $(BINMAN_ALLOW_MISSING),--
Quoted 9 lines
Quoted 8 lines
Makefile +2 -0
 ignore-missing) \
+             --allow-missing --fake-ext-blobs \
+             $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
               -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR)

\
              $(foreach f,$(of_list_dirs),-I $(f)) -a of- list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \

Regards,
Simon