dde_linux: generate proper KBUILD_MODNAME

This commit remedies the somewhat lazy attempt to address unique names
for drivers where the name is directly derived from KBUILD_MODNAME,
e.g. rtlwifi, and also modifies the name accordingly to the rules
of Linux' build-system. The last part becomes necessary as driver
matching tables may rely on that as has already happend with the
ti-sn65dsi86 driver.
This commit is contained in:
Josef Söntgen 2024-05-30 18:40:12 +02:00 committed by Norman Feske
parent 8943a3e949
commit 191306531c
2 changed files with 11 additions and 4 deletions

View File

@ -172,11 +172,15 @@ vpath %.S $(LX_GEN_DIR)
CUSTOM_TARGET_DEPS += $(TARGET_SOURCE_LIST)
# Define helper to generate unique KBUILD_MODNAME from filename and the
# last path element as using the file name is not enough for certain
# drivers (e.g., rtlwifi)
# Define a helper to generate a proper (see contrib 'scripts/Makefile.lib')
# KBUILD_MODNAME from the file-name and also allow to set the modname.
# We need to provide this hook because normally the Linux build-system
# would evaluate the driver's Makefile to adapt the modname for multi-module
# drivers, e.g., rtlwifi, where KBUILD_MODNAME is used directly and has to
# be different (and we cannot use the file-name to derive the modname as the
# file-name is the same).
define GEN_KBUILD_MODNAME =
$(lastword $(subst /, ,$(dir $(1))))-$(notdir $(1))
$(if $(KBUILD_MODNAME_$(1)),$(KBUILD_MODNAME_$(1)),$(subst -,_,$(basename $(notdir $(1)))))
endef
# Define per-compilation-unit CC_OPT defines needed by MODULE* macros in Linux

View File

@ -24,6 +24,9 @@ CC_C_OPT += -I$(LX_SRC_DIR)/drivers/net/wireless/ath/
CC_C_OPT += -I$(LX_SRC_DIR)/drivers/net/wireless/ath/ath9k
CC_C_OPT += -I$(LX_SRC_DIR)/include/linux
KBUILD_MODNAME_drivers/net/wireless/realtek/rtlwifi/rtl8188ce/sw := rtl8188ce
KBUILD_MODNAME_drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw := rtl8188ee
vpath %.c $(REP_DIR)/src/lib/pc
vpath %.cc $(REP_DIR)/src/lib/pc