Skip to contentSkip to conversation

Makefile: pass external DTB provided by make variable EXT_DTB to binman

PATCH Superseded [email protected] 2 participants 2 messages Sep 18, 2024 – Sep 19, 2024 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: pass external DTB provided by make variable EXT_DTB to binman

From: Alexander Kochetkov <[email protected]>

Yocto build is using EXT_DTB to repack U-boot during signed FIT kernel creation. First, it takes the DTB from U-boot, than it creates signed FIT kernel image and places kernel key into the DTB. After that it executes:
make EXT_DTB=/path/to/dtb/with/kernel/key

---
 Makefile | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
Makefile +10 -1
index 1c754ceb595..21b47cb2b59 100644
@@ -1367,7 +1367,16 @@ u-boot.ldr:	u-boot
 # ---------------------------------------------------------------------------
 # Use 'make BINMAN_DEBUG=1' to enable debugging
 # Use 'make BINMAN_VERBOSE=3' to set vebosity level
+
+ifneq ($(EXT_DTB),)
+of_list := $(basename $(notdir $(EXT_DTB)))
+of_list_dir := $(dir $(EXT_DTB))
+default_dt := $(of_list)
+else
+of_list := $(CONFIG_OF_LIST)
+of_list_dir := $(dt_dir)
 default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE))
+endif
 
 quiet_cmd_binman = BINMAN  $@
 cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
@@ -1377,7 +1386,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		build -u -d u-boot.dtb -O . -m \
 		--allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
-		-I $(dt_dir) -a of-list=$(CONFIG_OF_LIST) \
+		-I $(of_list_dir) -a of-list=$(of_list) \
 		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
 		-a atf-bl31-path=${BL31} \
 		-a tee-os-path=${TEE} \
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 5 lines · On Wed, 18 Sept 2024 at 11:04, <[email protected]> wrote:

From: Alexander Kochetkov <[email protected]>

Yocto build is using EXT_DTB to repack U-boot during signed FIT kernel creation. First, it takes the DTB from U-boot, than

U-Boot (please fix both)

s/than/then/

Quoted 8 lines

it creates signed FIT kernel image and places kernel key into the DTB. After that it executes:
make EXT_DTB=/path/to/dtb/with/kernel/key

---
 Makefile | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

How do you handle a FIT with multiple configurations?

Quoted 32 lines
Makefile +10 -2
index 1c754ceb595..21b47cb2b59 100644
@@ -1367,7 +1367,16 @@ u-boot.ldr:      u-boot
 # ---------------------------------------------------------------------------
 # Use 'make BINMAN_DEBUG=1' to enable debugging
 # Use 'make BINMAN_VERBOSE=3' to set vebosity level
+
+ifneq ($(EXT_DTB),)
+of_list := $(basename $(notdir $(EXT_DTB)))
+of_list_dir := $(dir $(EXT_DTB))
+default_dt := $(of_list)
+else
+of_list := $(CONFIG_OF_LIST)
+of_list_dir := $(dt_dir)
 default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE))
+endif
 
 quiet_cmd_binman = BINMAN  $@
 cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
@@ -1377,7 +1386,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                build -u -d u-boot.dtb -O . -m \
                --allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
                -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
-               -I $(dt_dir) -a of-list=$(CONFIG_OF_LIST) \
+               -I $(of_list_dir) -a of-list=$(of_list) \
                $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
                -a atf-bl31-path=${BL31} \
                -a tee-os-path=${TEE} \
--
Quoted 2 lines

2.17.1

Regards,
Simon