blob: 19172b0ac57c3fe17aa086ea386b88ef18016654 [file] [log] [blame]
# SPDX-License-Identifier: GPL-2.0
#
# kbuild file for firmware/
#
CONFIG_EXTRA_FIRMWARE_DIR="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_EXYNOS9610_ACPM) += exynos9610_acpm_fvp.fw
fw-external-$(CONFIG_EXYNOS9610_ACPM) += exynos9610_acpm_tmu.fw
fw-external-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_DSX) += tsp_synaptics/synaptics_b0_h.fw
fw-shipped-$(CONFIG_TOUCHSCREEN_SEC_TS) += tsp_sec/y761_dream1.fw
fw-external-$(CONFIG_TOUCHSCREEN_MELFAS_MSS100) += tsp_melfas/mss100_a51.fw tsp_melfas/mss100_a51_old.fw \
tsp_melfas/mss100_m31.fw tsp_melfas/mss100_m21.fw tsp_melfas/mss100_m31s.fw
fw-external-$(CONFIG_TOUCHSCREEN_NOVATEK_NT36672A) += tsp_novatek/nt36672a_xcoverpro.fw tsp_novatek/nt36672a_xcoverpro_4BF245.fw
fw-external-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += tsp_himax/hx83102e_gta4xl.fw tsp_himax/hx83102e_gta4xl_old.fw
fw-external-$(CONFIG_EPEN_WACOM_W9019) += epen/wacom9019_gta4xl.fw
# Touch based grip sensor
fw-external-$(CONFIG_SENSORS_A96T3X6) += abov/a96t326_voguelte.fw
fw-external-$(CONFIG_SENSORS_TC3XXK) += coreriver/tc305k_a50ser.fw
fw-external-$(CONFIG_SENSORS_A96T3X6_M30S) += abov/a96t326_m30s.fw
fw-external-$(CONFIG_SENSORS_A96T3X6_A51) += abov/a96t356_a51.fw abov/a96t356_a51_sub.fw
fw-external-$(CONFIG_SENSORS_A96T3X6_A51_USA) += abov/a96t356_a51_usa.fw abov/a96t356_a51_usa_sub.fw
fw-external-$(CONFIG_SENSORS_A96T3X6_TABA4XL) += abov/a96t356_taba4xl.fw abov/a96t356_taba4xl_wifi.fw
fw-external-$(CONFIG_SENSORS_A96T3X6_M31) += abov/a96t326_m31.fw
# sensorhub
fw-external-$(CONFIG_SENSORS_SSP) += sensorhub/shub_bl.fw
fw-external-$(CONFIG_SENSORS_SSP_A51) += sensorhub/a51_bring_up.fw
fw-external-$(CONFIG_SENSORS_SSP_A51) += sensorhub/shub_exynos9611_a51.fw
fw-external-$(CONFIG_SENSORS_SSP_XCOVERPRO) += sensorhub/shub_exynos9611_g715.fw
fw-external-$(CONFIG_SENSORS_SSP_GTA4XL) += sensorhub/shub_exynos9611_gta4xl.fw
fw-external-$(CONFIG_SENSORS_SSP_M31) += sensorhub/shub_ramen_m31.fw
fw-external-$(CONFIG_SENSORS_SSP_M21) += sensorhub/shub_ramen_m21.fw
fw-external-$(CONFIG_SENSORS_SSP_M31S) += sensorhub/shub_ramen_m31s.fw
fw-shipped-$(CONFIG_FIVE_TEE_DRIVER) += five/ffffffff000000000000000000000072.tlbin
quiet_cmd_ihex = IHEX $@
cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
quiet_cmd_ihex2fw = IHEX2FW $@
cmd_ihex2fw = $(objtree)/$(obj)/ihex2fw $< $@
quiet_cmd_h16tofw = H16TOFW $@
cmd_h16tofw = $(objtree)/$(obj)/ihex2fw -w $< $@
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)
# We need to use a relative path for the objtree, fwabs points to the source
# tree where .bin files are not generated
$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps)
$(call cmd,fwbin,$(patsubst %.gen.S,%,$@))
# The .o files depend on the binaries directly; the .S files don't.
$(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): %.gen.o: %
# .ihex is used just as a simple way to hold binary files in a source tree
# where binaries are frowned upon. They are directly converted with objcopy.
$(obj)/%: $(obj)/%.ihex
$(call cmd,ihex)
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))
# Without this, built-in.o won't be created when it's empty, and the
# final vmlinux link will fail.
obj- := dummy