diff options
Diffstat (limited to 'firmware/Makefile')
-rw-r--r-- | firmware/Makefile | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/firmware/Makefile b/firmware/Makefile index 87bd033f6e..f6ff5b831b 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -30,16 +30,17 @@ firmware-$(CONFIG_FIRMWARE_CCBV2_OPTEE) += ccbv2_optee.bin # leading /, it's relative to $(srctree). fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR)) fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) +fwobjdir := $(objtree)/firmware obj-pbl-y := $(addsuffix .gen.o, $(firmware-y)) -FWNAME = $(patsubst $(obj)/%.gen.S,%,$@) +FWNAME = $(patsubst $(obj)/%.extgen.S,%,$(patsubst $(obj)/%.gen.S,%,$@)) FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME)))) ASM_ALIGN = $(if $(CONFIG_64BIT),3,2) filechk_fwbin = { \ echo "/* Generated by $(src)/Makefile */" ;\ - echo " .section .rodata.$(FWSTR)" ;\ + echo " .section $2,\"$3\"" ;\ echo " .p2align $(ASM_ALIGN)" ;\ echo ".global _fw_$(FWSTR)_start" ;\ echo "_fw_$(FWSTR)_start:" ;\ @@ -48,19 +49,48 @@ filechk_fwbin = { \ echo "_fw_$(FWSTR)_end:" ;\ } +__fwbin_sha = { \ + echo " .section .rodata.$(FWSTR).sha" ;\ + echo " .p2align $(ASM_ALIGN)" ;\ + echo ".global _fw_$(FWSTR)_sha_start" ;\ + echo "_fw_$(FWSTR)_sha_start:" ;\ + echo " .incbin \"$(fwobjdir)/$(FWNAME).sha.bin\"" ;\ + echo ".global _fw_$(FWSTR)_sha_end" ;\ + echo "_fw_$(FWSTR)_sha_end:" ;\ +} + +filechk_fwbin_ext = { \ + $(filechk_fwbin) ;\ + $(__fwbin_sha) ;\ +} + $(obj)/%.gen.S: FORCE - $(call filechk,fwbin) + $(call filechk,fwbin,.rodata.$(FWSTR),) + +$(obj)/%.extgen.S: $(obj)/%.sha.bin FORCE + $(call filechk,fwbin_ext,.pblext.$(FWSTR),a) + +$(obj)/%.sha.bin: $(obj)/%.sum FORCE + $(call if_changed,sha256bin) + +$(obj)/%.sum: $(obj)/% FORCE + $(call if_changed,sha256sum) + +clean-files += *.sha.bin *.sum # The .o files depend on the binaries directly; the .S files don't. $(patsubst %,$(obj)/%.gen.o, $(obj-pbl-y)): $(obj)/%.gen.o: $(fwdir)/% # The same for pbl: $(patsubst %,$(obj)/%.gen.pbl.o, $(obj-pbl-y)): $(obj)/%.gen.pbl.o: $(fwdir)/% +$(patsubst %,$(obj)/%.extgen.pbl.o, $(pbl-y)): $(obj)/%.extgen.pbl.o: $(fwdir)/% -obj-pbl-y += $(patsubst %,%.gen.o, $(fw-external-y)) +pbl-y := $(addsuffix .extgen.o, $(fw-external-y)) targets := $(patsubst $(obj)/%,%, \ $(shell find $(obj) -name \*.gen.S 2>/dev/null)) +targets += $(patsubst $(obj)/%,%, \ + $(shell find $(obj) -name \*.extgen.S 2>/dev/null)) # just to build a built-in.o. Otherwise compilation fails when no # firmware is built. |