From 191306531ca93cfd45eb41d2e20ab3f14c009be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 30 May 2024 18:40:12 +0200 Subject: [PATCH] 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. --- repos/dde_linux/lib/import/import-lx_emul_common.inc | 12 ++++++++---- repos/pc/lib/mk/pc_wifi.inc | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/repos/dde_linux/lib/import/import-lx_emul_common.inc b/repos/dde_linux/lib/import/import-lx_emul_common.inc index 78f2608f88..34994161eb 100644 --- a/repos/dde_linux/lib/import/import-lx_emul_common.inc +++ b/repos/dde_linux/lib/import/import-lx_emul_common.inc @@ -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 diff --git a/repos/pc/lib/mk/pc_wifi.inc b/repos/pc/lib/mk/pc_wifi.inc index 7040b5032b..338e4e0361 100644 --- a/repos/pc/lib/mk/pc_wifi.inc +++ b/repos/pc/lib/mk/pc_wifi.inc @@ -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