mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-07-22 01:43:37 -04:00
Some firmware images contain a comma, such as: EXTRA_FIRMWARE "brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt" as Broadcom firmware simply tags the device tree compatible string at the end of the firmware parameter file. And the compatible string contains a comma. This doesn't play well with gas: drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S: Assembler messages: drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:4: Error: bad instruction `_fw_brcm_brcmfmac4334_sdio_samsung,gt_s7710_txt_bin:' drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:9: Error: bad instruction `_fw_brcm_brcmfmac4334_sdio_samsung,gt_s7710_txt_name:' drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:15: Error: can't resolve `.rodata' {.rodata section} - `_fw_brcm_brcmfmac4334_sdio_samsung' {*UND* section} make[6]: *** [../scripts/Makefile.build:357: drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.o] Error 1 We need to get rid of the comma from the labels used by the assembly stub generator. Replacing a comma using GNU Make subst requires a helper variable. Cc: Stephan Gerhold <stephan@gerhold.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20191115225911.3260-1-linus.walleij@linaro.org Acked-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
41 lines
1.5 KiB
Makefile
41 lines
1.5 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# 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))
|
|
|
|
obj-y := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE)))
|
|
|
|
FWNAME = $(patsubst $(obj)/%.gen.S,%,$@)
|
|
comma := ,
|
|
FWSTR = $(subst $(comma),_,$(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME)))))
|
|
ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long)
|
|
ASM_ALIGN = $(if $(CONFIG_64BIT),3,2)
|
|
PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
|
|
|
|
filechk_fwbin = \
|
|
echo "/* Generated by $(src)/Makefile */" ;\
|
|
echo " .section .rodata" ;\
|
|
echo " .p2align $(ASM_ALIGN)" ;\
|
|
echo "_fw_$(FWSTR)_bin:" ;\
|
|
echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\
|
|
echo "_fw_end:" ;\
|
|
echo " .section .rodata.str,\"aMS\",$(PROGBITS),1" ;\
|
|
echo " .p2align $(ASM_ALIGN)" ;\
|
|
echo "_fw_$(FWSTR)_name:" ;\
|
|
echo " .string \"$(FWNAME)\"" ;\
|
|
echo " .section .builtin_fw,\"a\",$(PROGBITS)" ;\
|
|
echo " .p2align $(ASM_ALIGN)" ;\
|
|
echo " $(ASM_WORD) _fw_$(FWSTR)_name" ;\
|
|
echo " $(ASM_WORD) _fw_$(FWSTR)_bin" ;\
|
|
echo " $(ASM_WORD) _fw_end - _fw_$(FWSTR)_bin"
|
|
|
|
$(obj)/%.gen.S: FORCE
|
|
$(call filechk,fwbin)
|
|
|
|
# The .o files depend on the binaries directly; the .S files don't.
|
|
$(addprefix $(obj)/, $(obj-y)): $(obj)/%.gen.o: $(fwdir)/%
|
|
|
|
targets := $(patsubst $(obj)/%,%, \
|
|
$(shell find $(obj) -name \*.gen.S 2>/dev/null))
|