# SPDX-License-Identifier: GPL-2.0 # # kbuild file for firmware/ # # Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a # leading /, it's relative to $(srctree). fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR)) fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) fw-external-y := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE)) fw-external-$(CONFIG_TOUCHSCREEN_NT36xxx) += tsp_novatek/NT36525B_BOE_0583_HDp_SEC_A23e_PID724D_V00_20220330.bin fw-external-$(CONFIG_TOUCHSCREEN_ILITEK_ILI9881X) += tsp_ilitek/ili9881x_a12.hex fw-external-$(CONFIG_TOUCHSCREEN_NT36xxx_HOSTDL_SPI) += tsp_novatek/nt36525_a12_csot.bin tsp_novatek/nt36525_a12_mp_csot.bin \ tsp_novatek/nt36525_a12_dtc.bin tsp_novatek/nt36525_a12_mp_dtc.bin \ tsp_novatek/nt36525_a12_boe.bin tsp_novatek/nt36525_a12_mp_boe.bin \ tsp_novatek/nt36675_a12_ltps.bin tsp_novatek/nt36675_a12_mp_ltps.bin fw-external-$(CONFIG_TOUCHSCREEN_NOVATEK_NT36523_SPI) += tsp_novatek/nt36672_a13ve_csot.bin tsp_novatek/nt36672_a13ve_csot_mp.bin fw-external-$(CONFIG_TOUCHSCREEN_NOVATEK_NT36523_I2C) += tsp_novatek/nt36525b_a23ex.bin fw-external-$(CONFIG_TOUCHSCREEN_SYNA_TCM2) += tsp_synaptics/PR3482364-S3908_M52_BOE_PRA_3102000C_20210903.img fw-external-$(CONFIG_TOUCHSCREEN_HIMAX_HX83XXX_SPI) += tsp_himax/hx83102j_birdie.bin tsp_himax/hx83112f_boe_a13ve.bin fw-external-$(CONFIG_TOUCHSCREEN_HIMAX_HX83XXX_I2C) += tsp_himax/hx83102d_a23ex.bin fw-external-$(CONFIG_TOUCHSCREEN_GOODIX_9895_BRL) += tsp_goodix/A33_GT9895_COMBINED_20220517_v20.bin fw-external-$(CONFIG_TOUCHSCREEN_GOODIX_BRL) += tsp_goodix/gt9895_a34x.bin fw-external-$(CONFIG_TOUCHSCREEN_SYNAPTICS) += tsp_synaptics/s3908_m53x_boe.bin tsp_synaptics/s3908_m52xq_sdc.bin fw-external-$(CONFIG_SENSORS_A96T3X6_A12) += abov/a96t356_a12_main.bin abov/a96t356_a12_sub.bin \ abov/a96t356_a12_usa_main.bin abov/a96t356_a12_usa_sub.bin \ abov/a96t356_a12_kor_main.bin abov/a96t356_a12_kor_sub.bin fw-external-$(CONFIG_SENSORS_A96T396_BIRDIE) += abov/a96t396_birdie_main.bin abov/a96t396_birdie_sub.bin abov/a96t396_birdie_wifi.bin fw-external-$(CONFIG_EPEN_WACOM_WEZ01) += epen/w9021_birdie.bin fw-external-$(CONFIG_KEYBOARD_STM32_POGO) += keyboard_stm/stm32_birdie.bin quiet_cmd_fwbin = MK_FW $@ cmd_fwbin = FWNAME="$(patsubst firmware/%.gen.S,%,$@)"; \ FWSTR="$(subst /,_,$(subst .,_,$(subst -,_,$(patsubst \ firmware/%.gen.S,%,$@))))"; \ ASM_WORD=$(if $(CONFIG_64BIT),.quad,.long); \ ASM_ALIGN=$(if $(CONFIG_64BIT),3,2); \ PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ echo "/* Generated by firmware/Makefile */" > $@;\ echo " .section .rodata" >>$@;\ echo " .p2align 4" >>$@;\ echo "_fw_$${FWSTR}_bin:" >>$@;\ echo " .incbin \"$(2)\"" >>$@;\ 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" >>$@; # One of these files will change, or come into existence, whenever # the configuration changes between 32-bit and 64-bit. The .S files # need to change when that happens. wordsize_deps := $(wildcard include/config/64bit.h include/config/32bit.h \ include/config/ppc32.h include/config/ppc64.h \ include/config/superh32.h include/config/superh64.h \ include/config/x86_32.h include/config/x86_64.h \ firmware/Makefile) $(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \ include/config/extra/firmware/dir.h $(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@)) # The .o files depend on the binaries directly; the .S files don't. $(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/% obj-y += $(patsubst %,%.gen.o, $(fw-external-y)) ifeq ($(KBUILD_SRC),) # Makefile.build only creates subdirectories for O= builds, but external # firmware might live outside the kernel source tree _dummy := $(foreach d,$(addprefix $(obj)/,$(dir $(fw-external-y))), $(shell [ -d $(d) ] || mkdir -p $(d))) endif targets := $(patsubst $(obj)/%,%, \ $(shell find $(obj) -name \*.gen.S 2>/dev/null))