Skip to contentSkip to conversation

Makefile: binman: Search board directory before srctree

PATCH In review Wadim Egorov 3 participants 13 messages May 15 – May 25 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: binman: Search board directory before srctree

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 552328f9f2c..1ec29dfe0be 100644
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		build -u -d $(binman_dtb) -O . -m \
 		--allow-missing --fake-ext-blobs \
 		$(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+		-I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
 		$(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
 		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
 		-a atf-bl1-path=${BL1} \
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Wadim Egorov

Makefile: binman: Search board directory before srctree

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Quoted 7 lines

Move the board directory ahead of the srctree root so that the most-specific match wins.

Makefile | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
In reply to Wadim Egorov
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		build -u -d $(binman_dtb) -O . -m \
 		--allow-missing --fake-ext-blobs \
 		$(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+		-I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
 		$(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
 		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
 		-a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Signature · 1 line
Tom
#3 lore raw

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 16 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

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

Quoted 13 lines
Makefile +1 -1
index 552328f9f2c..1ec29dfe0be 100644
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

Regards,
Simon

#4 lore raw
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 16 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

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

Quoted 13 lines
Makefile +1 -1
index 552328f9f2c..1ec29dfe0be 100644
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Quoted 2 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

That's also a bad practice and what BINMAN_INDIRS is for.

Signature · 1 line
Tom
#5 lore raw

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 5 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Regards,
Simon

#6 lore raw
Quoted 59 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 4 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

Quoted 6 lines
Quoted 1 line

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Well, the first step would be getting some more feedback on how people override some of these files for example. Even more environment files seems like a bad idea and I'm not sure what BINMAN_INDIRS can't cover today.

Signature · 1 line
Tom
#7 lore raw

Hi Tom,

Quoted 65 lines · Tom Rini
Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 5 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Quoted 7 lines
Quoted 2 lines

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Well, the first step would be getting some more feedback on how people override some of these files for example. Even more environment files seems like a bad idea and I'm not sure what BINMAN_INDIRS can't cover today.

Assuming you mean 'environment variables', we do need the actual filename, not just the directory. We could have default filenames for each entry type, I suppose. Some do already.

Regards,
Simon

#8 lore raw
Quoted 71 lines · Simon Glass

Hi Tom,

Quoted 68 lines · Tom Rini
Quoted 65 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 5 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Quoted 8 lines
Quoted 4 lines

Well, the first step would be getting some more feedback on how people override some of these files for example. Even more environment files seems like a bad idea and I'm not sure what BINMAN_INDIRS can't cover today.

Assuming you mean 'environment variables', we do need the actual filename, not just the directory. We could have default filenames for each entry type, I suppose. Some do already.

Yes, I think moving that way is the right direction. I was going to use -scp-path=$(SCP) as an example of something to move away from, but it looks like that's already being done in a way BINMAN_INDIRS should handle.

Signature · 1 line
Tom
#9 lore raw

Hi Tom,

Quoted 78 lines · Tom Rini
Quoted 76 lines · Simon Glass

Hi Tom,

Quoted 72 lines · Tom Rini
Quoted 59 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 4 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

Quoted 6 lines
Quoted 1 line

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Well, the first step would be getting some more feedback on how people override some of these files for example. Even more environment files seems like a bad idea and I'm not sure what BINMAN_INDIRS can't cover today.

Quoted 8 lines
Quoted 3 lines

Assuming you mean 'environment variables', we do need the actual filename, not just the directory. We could have default filenames for each entry type, I suppose. Some do already.

Yes, I think moving that way is the right direction. I was going to use -scp-path=$(SCP) as an example of something to move away from, but it looks like that's already being done in a way BINMAN_INDIRS should handle.

Yes, the idea is that '-a scp-path=$(SCP)' tells the scp entry-type the filename to use. I'm pretty sure we could update the tests to set that entry-arg, so we don't need the source dir in the path.

But in any case this patch is correct for now.

Regards,
Simon

#10 lore raw
Quoted 85 lines · Simon Glass

Hi Tom,

Quoted 82 lines · Tom Rini
Quoted 79 lines · Simon Glass

Hi Tom,

Quoted 65 lines · Tom Rini
Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 5 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Quoted 7 lines
Quoted 2 lines

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Well, the first step would be getting some more feedback on how people override some of these files for example. Even more environment files seems like a bad idea and I'm not sure what BINMAN_INDIRS can't cover today.

Assuming you mean 'environment variables', we do need the actual filename, not just the directory. We could have default filenames for each entry type, I suppose. Some do already.

Quoted 8 lines
Quoted 4 lines

Yes, I think moving that way is the right direction. I was going to use -scp-path=$(SCP) as an example of something to move away from, but it looks like that's already being done in a way BINMAN_INDIRS should handle.

Yes, the idea is that '-a scp-path=$(SCP)' tells the scp entry-type the filename to use. I'm pretty sure we could update the tests to set that entry-arg, so we don't need the source dir in the path.

But we shouldn't need anything at all if BINMAN_INDIRS is set to include that path. We currently just have "scp.bin" in the dts file. Adding -scp-path was a solution that made sense at the time, but as we've needed to deal with more blobs, we added a generic solution, and now just need to deprecate and remove the original per-blob solution.

Quoted 1 line

But in any case this patch is correct for now.

Agreed.

Signature · 1 line
Tom
#11 lore raw

Hi Tom,

Quoted 96 lines · Tom Rini
Quoted 85 lines · Simon Glass

Hi Tom,

Quoted 82 lines · Tom Rini
Quoted 79 lines · Simon Glass

Hi Tom,

Quoted 65 lines · Tom Rini
Quoted 63 lines · Simon Glass

Hi Tom,

Quoted 40 lines · Tom Rini
Quoted 38 lines · Simon Glass

Hi Tom,

Quoted 34 lines · Tom Rini
Quoted 21 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

Move the board directory ahead of the srctree root so that the most-specific match wins.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 552328f9f2c..1ec29dfe0be 100644

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

Quoted 8 lines
Makefile +1 -1
@@ -1682,7 +1682,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
              build -u -d $(binman_dtb) -O . -m \
              --allow-missing --fake-ext-blobs \
              $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
-             -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
+             -I . -I $(srctree)/board/$(BOARDDIR) -I $(srctree) \
              $(foreach f,$(of_list_dirs),-I $(f)) -a of-list=$(of_list) \
              $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
              -a atf-bl1-path=${BL1} \

Why do we need to look in $(srctree) itself?

Quoted 8 lines
Quoted 4 lines

See for example:

arch/arm/dts/k3-j721e-binman.dtsi:308: private-key = "arch/arm/mach-k3/keys/custMpk.pem";

That's not great, I'm sorry I missed it at the time. I wonder how easy replacing that key is with a non-dummy key. Hopefully it's done in a way that doesn't encourage checking private keys in to repositories..

Typically we would use an environment var passed in from the Makefile, as we do with BL31, TEE, TI_DM, etc.

Quoted 5 lines
Quoted 3 lines

Also, people sometimes put files in the source tree, e.g. BL31 images, in the hope that they will be found.

That's also a bad practice and what BINMAN_INDIRS is for.

Yes, but that came quite a bit later with the bintool stuff (2021).

Quoted 7 lines
Quoted 2 lines

Anyway, with a bit of work I believe we could drop the source dir. Would you like to look at it, or should I?

Well, the first step would be getting some more feedback on how people override some of these files for example. Even more environment files seems like a bad idea and I'm not sure what BINMAN_INDIRS can't cover today.

Assuming you mean 'environment variables', we do need the actual filename, not just the directory. We could have default filenames for each entry type, I suppose. Some do already.

Quoted 8 lines
Quoted 4 lines

Yes, I think moving that way is the right direction. I was going to use -scp-path=$(SCP) as an example of something to move away from, but it looks like that's already being done in a way BINMAN_INDIRS should handle.

Yes, the idea is that '-a scp-path=$(SCP)' tells the scp entry-type the filename to use. I'm pretty sure we could update the tests to set that entry-arg, so we don't need the source dir in the path.

Quoted 5 lines

But we shouldn't need anything at all if BINMAN_INDIRS is set to include that path. We currently just have "scp.bin" in the dts file. Adding -scp-path was a solution that made sense at the time, but as we've needed to deal with more blobs, we added a generic solution, and now just need to deprecate and remove the original per-blob solution.

We still need the SCP option in Makefile though, right? For BL31 we often have different filenames - see the Rockchip rkbin directory, for example. So we cannot always use the same filename.

But if you are just saying that we should define GetDefaultFilename() in scp.py (to return 'scp.bin'), so as to avoid needing 'scp.bin' in the DT node, then yes that should work.

Quoted 4 lines
Quoted 2 lines

But in any case this patch is correct for now.

Agreed.

Regards,
Simon

#12 lore raw
In reply to Wadim Egorov
Quoted 9 lines · Wadim Egorov

A file like rm-cfg.yaml accidentally left in the source tree root shadows the board-specific copy. binman builds the wrong YAML, the resulting rm-cfg.bin may match a different SoC, and we end up with the following error:

k3_system_controller sysctrler: k3_sysctrler_start:
Boot Notification response failed. ret = -110

[...]

Applied to u-boot/master, thanks!

[1/1] Makefile: binman: Search board directory before srctree

      commit: a20893480124414befecbc0200cb329a0fdf094e
Signature · 1 line
Tom