【驱动】在内核源码中添加驱动程序

以wifi驱动(RTL8188EUS驱动)为例

添加源码

将源码rtl8188EUS添加到drivers/net/wireless/rtl818x/目录下

添加Kconfig

在drivers/net/wireless/rtl818x/rtl8188EUS添加Kconfig,内容如下:

config RTL8188EU
     tristate "Realtek 8188E USB WiFi"
     depends on RTL8187 && HOSTAP && RTL_CARDS && USB_RTL8150 && USB_RTL8152
     ---help---
       Help message of RTL8188EU

修改上层Kconfig

在drivers/net/wireless/rtl818x/Kconfig文件最后添加如下内容:

source "drivers/net/wireless/rtl818x/rtl8188EUS/Kconfig"

修改上层Makefile

在drivers/net/wireless/rtl818x/Makefile文件最后添加如下内容:

obj-$(CONFIG_RTL8188EU) += rtl8188EUS/

修改Makefile

(截取一部分)添加:obj-? 和xxx-objs

rtk_core := core/rtw_cmd.o \
        core/rtw_security.o \
        core/rtw_debug.o \
        core/rtw_io.o \
        core/rtw_ioctl_query.o \
        core/rtw_ioctl_set.o \
        core/rtw_ieee80211.o \
        core/rtw_mlme.o \
        core/rtw_mlme_ext.o \
        core/rtw_wlan_util.o \
        core/rtw_vht.o \
        core/rtw_pwrctrl.o \
        core/rtw_rf.o \
        core/rtw_recv.o \
        core/rtw_sta_mgt.o \
        core/rtw_ap.o \
        core/rtw_xmit.o \
        core/rtw_p2p.o \
        core/rtw_tdls.o \
        core/rtw_br_ext.o \
        core/rtw_iol.o \
        core/rtw_sreset.o \
        core/rtw_btcoex.o \
        core/rtw_beamforming.o \
        core/rtw_odm.o \
        core/efuse/rtw_efuse.o

$(MODULE_NAME)-y += $(rtk_core)

$(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o

$(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o   \
                    core/rtw_wapi_sms4.o

$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \
                    core/rtw_mp_ioctl.o

obj-$(CONFIG_RTL8188EU) += $(MODULE_NAME).o

ccflags-y += -Idrivers/net/wireless/rtl818x

你可能感兴趣的:(linux驱动)