* [PATCH 1/2] firmware: export firmware directory
@ 2025-03-14 9:45 Sascha Hauer
2025-03-14 9:45 ` [PATCH 2/2] ARM: k3r5: Honour CONFIG_EXTRA_FIRMWARE_DIR Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-03-14 9:45 UTC (permalink / raw)
To: Barebox List
The recently added k3r5 code needs firmware blobs as part of the image
generation. It hardcodes the firmware path to $(srctree)/firmware which
is the default, but could changed with CONFIG_EXTRA_FIRMWARE_DIR.
Move setting of $(fwdir) to the toplevel Makefile and export it to make
it available to images/Makefile.k3. As fwdir is a bad name for an
exported variable rename it to FIRMWARE_DIR.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Makefile | 6 ++++++
firmware/Makefile | 14 +++++---------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 40d7553dfc..2341625d64 100644
--- a/Makefile
+++ b/Makefile
@@ -515,6 +515,12 @@ export LDFLAGS_barebox LDFLAGS_pbl LDFLAGS_elf
export CFLAGS_UBSAN
export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE
+# Create $(FIRMWARE_DIR) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
+# leading /, it's relative to $(srctree).
+FIRMWARE_DIR := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR))
+FIRMWARE_DIR := $(addprefix $(srctree)/,$(filter-out /%,$(FIRMWARE_DIR)))$(filter /%,$(FIRMWARE_DIR))
+export FIRMWARE_DIR
+
# Files to ignore in find ... statements
export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
diff --git a/firmware/Makefile b/firmware/Makefile
index 2f47e04bee..a3fdaa0f7c 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -42,10 +42,6 @@ fw-external-$(CONFIG_FIRMWARE_LS1046A_ATF) += ls1046a-bl31.bin
pbl-firmware-$(CONFIG_FIRMWARE_CCBV2_OPTEE) += ccbv2_optee.bin
pbl-firmware-$(CONFIG_FIRMWARE_TQMA6UL_OPTEE) += mba6ul_optee.bin
-# Create $(fwdir) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
-# leading /, it's relative to $(srctree).
-fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR))
-fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
fwobjdir := $(objtree)/firmware
pbl-y := $(addsuffix .gen.o, $(pbl-firmware-y))
@@ -54,7 +50,7 @@ pbl-fwext-y := $(addsuffix .extgen.o, $(fw-external-y))
FWNAME = $(patsubst $(obj)/%.extgen.S,%,$(patsubst $(obj)/%.gen.S,%,$@))
FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME))))
-FWNAME_EXISTS = $(if $(wildcard $(fwdir)/$(FWNAME)),1,0)
+FWNAME_EXISTS = $(if $(wildcard $(FIRMWARE_DIR)/$(FWNAME)),1,0)
filechk_fwbin = { \
echo "/* Generated by $(src)/Makefile */" ;\
@@ -65,7 +61,7 @@ filechk_fwbin = { \
echo ".global _fw_$(FWSTR)_start" ;\
echo "_fw_$(FWSTR)_start:" ;\
echo "\#if $(FWNAME_EXISTS)" ;\
- echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\
+ echo " .incbin \"$(FIRMWARE_DIR)/$(FWNAME)\"" ;\
echo "\#elif defined(__PBL__)" ;\
echo "ASM_PTR _fwname_$(FWSTR)" ;\
echo "\#endif" ;\
@@ -103,12 +99,12 @@ $(obj)/%.sha.bin: $(obj)/%.sum FORCE
$(call if_changed,sha256bin)
$(obj)/%.sum: FORCE
- $(if $(wildcard $(fwdir)/$*), $(call if_changed,sha256sum,$(fwdir)/$*), @touch $@)
+ $(if $(wildcard $(FIRMWARE_DIR)/$*), $(call if_changed,sha256sum,$(FIRMWARE_DIR)/$*), @touch $@)
clean-files += *.sha.bin *.sum
# This dependency is used if missing firmware should fail the build immediately
-fwdep-required-y = $(fwdir)/%
+fwdep-required-y = $(FIRMWARE_DIR)/%
# This dependency expands to nothing if the file doesn't exist. This allows
# delaying the firmware check:
#
@@ -117,7 +113,7 @@ fwdep-required-y = $(fwdir)/%
#
# This way, we allow users to build defconfigs with multiple images without requiring
# them to install all firmware for all platforms if only few are of interest.
-fwdep-required-n = $$(wildcard $(fwdir)/%)
+fwdep-required-n = $$(wildcard $(FIRMWARE_DIR)/%)
.SECONDEXPANSION:
# The .o files depend on the binaries directly if available; the .S files don't.
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] ARM: k3r5: Honour CONFIG_EXTRA_FIRMWARE_DIR
2025-03-14 9:45 [PATCH 1/2] firmware: export firmware directory Sascha Hauer
@ 2025-03-14 9:45 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-03-14 9:45 UTC (permalink / raw)
To: Barebox List
barebox expects the firmware blobs in CONFIG_EXTRA_FIRMWARE_DIR, but the
ti-fs-firmware is searched for in $(srctree)/firmware/ instead. Use
$(FIRMWARE_DIR) instead to use the correct directory when changed from
the default.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
images/Makefile.k3 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/images/Makefile.k3 b/images/Makefile.k3
index 466a84af99..fd42877837 100644
--- a/images/Makefile.k3
+++ b/images/Makefile.k3
@@ -25,9 +25,9 @@ ifdef CONFIG_MACH_K3_CORTEX_R5
SYSFWDATA_am625=$(objtree)/arch/arm/mach-k3/combined-sysfw-cfg-am625.k3cfg
DMDATA_am625=$(objtree)/arch/arm/mach-k3/combined-dm-cfg-am625.k3cfg
-SYSFW_am625_hs_fs=$(srctree)/firmware/ti-fs-firmware-am62x-hs-fs-enc.bin
-SYSFW_am625_gp=$(srctree)/firmware/ti-fs-firmware-am62x-gp.bin
-INNERDATA_am625=$(srctree)/firmware/ti-fs-firmware-am62x-hs-fs-cert.bin
+SYSFW_am625_hs_fs=$(FIRMWARE_DIR)/ti-fs-firmware-am62x-hs-fs-enc.bin
+SYSFW_am625_gp=$(FIRMWARE_DIR)/ti-fs-firmware-am62x-gp.bin
+INNERDATA_am625=$(FIRMWARE_DIR)/ti-fs-firmware-am62x-hs-fs-cert.bin
KEY_custmpk=$(srctree)/arch/arm/mach-k3/custMpk.pem
KEY_degenerate=$(srctree)/arch/arm/mach-k3/ti-degenerate-key.pem
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-14 9:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14 9:45 [PATCH 1/2] firmware: export firmware directory Sascha Hauer
2025-03-14 9:45 ` [PATCH 2/2] ARM: k3r5: Honour CONFIG_EXTRA_FIRMWARE_DIR Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox