diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-06-27 07:52:35 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-06-28 08:14:14 +0200 |
commit | 5b171b7b7edaf75e310c7a583c1a975f78f41cc1 (patch) | |
tree | a891a023c37b0950eaae8b49b6573416825142f6 /firmware | |
parent | 0e2c95dd80a4f4c8ee3894c67e1ed9a41abf091e (diff) | |
download | barebox-5b171b7b7edaf75e310c7a583c1a975f78f41cc1.tar.gz barebox-5b171b7b7edaf75e310c7a583c1a975f78f41cc1.tar.xz |
firmware: turn missing firmware into linker error
Appending to firmware-y results in an assembly file being generated that
defines a section embedding the firmware in question verbatim via .incbin.
To update the assembly file as required, the target has a dependency on
the firmware. When the firmware is missing, the build will abort there.
In preparation for deferring missing PBL firmware errors till the very
end, let's remove the firmware dependency if the missing firmware file
is built into PBL and replace the .incbin with a reference to an ultimately
undefined variable.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230627055239.3908872-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/Makefile | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/firmware/Makefile b/firmware/Makefile index b53404319a..924ff0da14 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -42,6 +42,7 @@ obj-pbl-y := $(addsuffix .gen.o, $(firmware-y)) FWNAME = $(patsubst $(obj)/%.extgen.S,%,$(patsubst $(obj)/%.gen.S,%,$@)) FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME)))) +FWNAME_EXISTS = $(if $(wildcard $(fwdir)/$(FWNAME)),1,0) filechk_fwbin = { \ echo "/* Generated by $(src)/Makefile */" ;\ @@ -51,7 +52,11 @@ filechk_fwbin = { \ echo " .p2align $(ASM_LGPTR)" ;\ echo ".global _fw_$(FWSTR)_start" ;\ echo "_fw_$(FWSTR)_start:" ;\ + echo "\#if $(FWNAME_EXISTS)" ;\ echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\ + echo "\#else" ;\ + echo "ASM_PTR _fwname_$(FWSTR)" ;\ + echo "\#endif" ;\ echo ".global _fw_$(FWSTR)_end" ;\ echo "_fw_$(FWSTR)_end:" ;\ } @@ -89,7 +94,7 @@ clean-files += *.sha.bin *.sum $(patsubst %.gen.o,$(obj)/%.gen.o, $(obj-pbl-y)): $(obj)/%.gen.o: $(fwdir)/% # The same for pbl: -$(patsubst %.gen.o,$(obj)/%.gen.pbl.o, $(obj-pbl-y) $(pbl-y)): $(obj)/%.gen.pbl.o: $(fwdir)/% +$(patsubst %.gen.o,$(obj)/%.gen.pbl.o, $(obj-pbl-y) $(pbl-y)): $(obj)/%.gen.pbl.o: $(wildcard $(fwdir)/%) $(patsubst %.gen.o,$(obj)/%.extgen.pbl.o, $(pbl-y)): $(obj)/%.extgen.pbl.o: $(fwdir)/% pbl-y += $(addsuffix .extgen.o, $(fw-external-y)) |