浅析如何添加自己的ko到make menuconfig中
其实向make menuconfig添加自己的选项,仅仅是为了向driver传递由用户自己决定的几个不同的宏值.
1.
luther@gliethttp:/vobs/works/lnx2625pxa/drivers/net/wireless$ mkdir bcmxxx
2.
luther@gliethttp:/vobs/works/lnx2625pxa/drivers/net/wireless$ vim Kconfig
追加如下内容:
config BCMXXX
tristate "BCMXXX WLAN driver support"
depends on WLAN_80211
select WIRELESS_EXT
select FW_LOADER
---help---
A driver for Broadcom xxx devices.
source "drivers/net/wireless/bcmxxx/Kconfig" //如果加入的bcmxxx模块有很多宏需要控制,那么加入该选项,进行进一步细致 控制,否则可以去掉
3.向/vobs/works/lnx2625pxa/.config添加,我们的BCMXXX编译时的缺省值.
因为我们的.config是由/vobs/works/lnx2625pxa/setup.sh PRODUCT=xxx产品名称 root=ramdisk来自动生成的,所以应该修改
/vobs/works/lnx2625pxa/arch/arm/configs/xxx产品名称_defconfig中的数值才行.
CONFIG_MRVL8688=m //默认为module
CONFIG_BCMXXX=m //默认为module
4.
luther@gliethttp:/vobs/works/lnx2625pxa$ make menuconfig
这样在
Device Drivers==>Network device support==>Wireless LAN==>就会有加入的
<M> BCMXXX WLAN driver support //这个选项了
对它的修改将直接影响到CONFIG_MRVL8688变量.
5.让他能够被make到
向上级可执行目录追加编译选项
drivers/net/wireless/Makefile|51| obj-$(CONFIG_MRVL8688) += mrvl8688/
luther@gliethttp:/vobs/works/lnx2625pxa/drivers/net/wireless$ vim Makefile
obj-$(CONFIG_BCMXXX) += bcmxxx/ //表示当执行make zImage或者make时,需要执行bcmxxx目录下的Makefile文件
但是因为bcmxxx在pc上的编译比较特殊,需要到bcmsdio/linux目录下执行,
luther@gliethttp:/vobs/works/broadcom/src/bcmsdio/linux$ make -j4
所以上面的地址也应该改为
obj-$(CONFIG_BCMXXX) += bcmxxx/bcmsdio/linux
luther@gliethttp:/vobs/works/broadcom/src/bcmsdio/linux$ vim Makefile
加入如下行
LINUXDIR := $(KBUILD_SRC) //内核/vobs/works/lnx2625pxa/Makefile导出export变量
obj-$(CONFIG_) += sd8688.o
6.将需要加入的bcmxxx驱动放到/vobs/works/lnx2625pxa/drivers/net/wireless/bcmxxx/目录下
然后编写Makefile,好了工作完成了
7.编译了
luther@gliethttp:/vobs/works/lnx2625pxa$ make -j4
====================================================================
在sd8688中作如下修改:
drivers/net/wireless/mrvl8688/Makefile|128| obj-$(CONFIG_MRVL8688) += sd8688.o
drivers/net/wireless/Makefile|51| obj-$(CONFIG_MRVL8688) += mrvl8688/
drivers/net/wireless/mrvl8688/Kconfig|2| bool "Marvell 8688 debugging"
drivers/net/wireless/mrvl8688/Kconfig|5| Marvell 8688 debugging messages. Choosing Y will result in additional debug
drivers/net/wireless/mrvl8688/Kconfig|10| prompt "Marvell 8688 debugging level"
drivers/net/wireless/mrvl8688/Kconfig|15| bool "Marvell 8688 debugging level 1"
drivers/net/wireless/mrvl8688/Kconfig|18| Marvell 8688 debugging level 1, only PRINTM(MSG,...), PRINTM(FATAL,...).
drivers/net/wireless/mrvl8688/Kconfig|21| bool "Marvell 8688 debugging level 2"
drivers/net/wireless/mrvl8688/Kconfig|24| Marvell 8688 debugging level 2, all PRINTM().
drivers/net/wireless/mrvl8688/Kconfig|28| bool "Marvell 8688 proc debug"
drivers/net/wireless/mrvl8688/Kconfig|31| Marvell 8688 proc debug messages. proc in /proc/net/wlan.
drivers/net/wireless/mrvl8688/Kconfig|34| bool "Marvell 8688 reassociation"
drivers/net/wireless/mrvl8688/Kconfig|37| Marvell 8688 re-association.
drivers/net/wireless/mrvl8688/Kconfig|40| bool "Marvell 8688 manufacturing firmware support"
drivers/net/wireless/mrvl8688/Kconfig|43| Marvell 8688 manufacturing firmware support.
drivers/net/wireless/mrvl8688/Kconfig|46| bool "Marvell 8688 big endian"
drivers/net/wireless/mrvl8688/Kconfig|49| Marvell 8688 big-endian platform.
drivers/net/wireless/mrvl8688/Kconfig|52| bool "Marvell 8688 DMA align"
drivers/net/wireless/mrvl8688/Kconfig|55| Marvell 8688 dma align.
drivers/net/wireless/Kconfig|265| tristate "Marvell 8688 WLAN driver support"
drivers/net/wireless/Kconfig|270| A driver for Marvell 8688 devices.
在drivers/net/wireless/Kconfig中
config MRVL8688 //对应CONFIG_MRVL8688变量,可以在.config中定义默认值
tristate "Marvell 8688 WLAN driver support"
depends on WLAN_80211
select WIRELESS_EXT
select FW_LOADER
---help---
A driver for Marvell 8688 devices.
source "drivers/net/wireless/mrvl8688/Kconfig" 表示调入相应Kconfig,放到下面
config MRVL8688_DEBUG //对应CONFIG_MRVL8688_DEBUG变量,可以在.config中定义默认值
bool "Marvell 8688 debugging"
depends on MRVL8688
---help---
Marvell 8688 debugging messages. Choosing Y will result in additional debug
messages being saved to your kernel logs, which may help debug any
problems.
choice //choice表示若干选一,项目之间互斥,有你没他
prompt "Marvell 8688 debugging level"
depends on MRVL8688_DEBUG
default MRVL8688_DEBUG_LEVEL1
config MRVL8688_DEBUG_LEVEL1
bool "Marvell 8688 debugging level 1"
depends on MRVL8688_DEBUG
---help---
Marvell 8688 debugging level 1, only PRINTM(MSG,...), PRINTM(FATAL,...).
config MRVL8688_DEBUG_LEVEL2
bool "Marvell 8688 debugging level 2"
depends on MRVL8688_DEBUG
---help---
Marvell 8688 debugging level 2, all PRINTM().
endchoice
其实向make menuconfig添加自己的选项,仅仅是为了向driver传递由用户自己决定的几个不同的宏值.
1.
luther@gliethttp:/vobs/works/lnx2625pxa/drivers/net/wireless$ mkdir bcmxxx
2.
luther@gliethttp:/vobs/works/lnx2625pxa/drivers/net/wireless$ vim Kconfig
追加如下内容:
config BCMXXX
tristate "BCMXXX WLAN driver support"
depends on WLAN_80211
select WIRELESS_EXT
select FW_LOADER
---help---
A driver for Broadcom xxx devices.
source "drivers/net/wireless/bcmxxx/Kconfig" //如果加入的bcmxxx模块有很多宏需要控制,那么加入该选项,进行进一步细致 控制,否则可以去掉
3.向/vobs/works/lnx2625pxa/.config添加,我们的BCMXXX编译时的缺省值.
因为我们的.config是由/vobs/works/lnx2625pxa/setup.sh PRODUCT=xxx产品名称 root=ramdisk来自动生成的,所以应该修改
/vobs/works/lnx2625pxa/arch/arm/configs/xxx产品名称_defconfig中的数值才行.
CONFIG_MRVL8688=m //默认为module
CONFIG_BCMXXX=m //默认为module
4.
luther@gliethttp:/vobs/works/lnx2625pxa$ make menuconfig
这样在
Device Drivers==>Network device support==>Wireless LAN==>就会有加入的
<M> BCMXXX WLAN driver support //这个选项了
对它的修改将直接影响到CONFIG_MRVL8688变量.
5.让他能够被make到
向上级可执行目录追加编译选项
drivers/net/wireless/Makefile|51| obj-$(CONFIG_MRVL8688) += mrvl8688/
luther@gliethttp:/vobs/works/lnx2625pxa/drivers/net/wireless$ vim Makefile
obj-$(CONFIG_BCMXXX) += bcmxxx/ //表示当执行make zImage或者make时,需要执行bcmxxx目录下的Makefile文件
但是因为bcmxxx在pc上的编译比较特殊,需要到bcmsdio/linux目录下执行,
luther@gliethttp:/vobs/works/broadcom/src/bcmsdio/linux$ make -j4
所以上面的地址也应该改为
obj-$(CONFIG_BCMXXX) += bcmxxx/bcmsdio/linux
luther@gliethttp:/vobs/works/broadcom/src/bcmsdio/linux$ vim Makefile
加入如下行
LINUXDIR := $(KBUILD_SRC) //内核/vobs/works/lnx2625pxa/Makefile导出export变量
obj-$(CONFIG_) += sd8688.o
6.将需要加入的bcmxxx驱动放到/vobs/works/lnx2625pxa/drivers/net/wireless/bcmxxx/目录下
然后编写Makefile,好了工作完成了
7.编译了
luther@gliethttp:/vobs/works/lnx2625pxa$ make -j4
====================================================================
在sd8688中作如下修改:
drivers/net/wireless/mrvl8688/Makefile|128| obj-$(CONFIG_MRVL8688) += sd8688.o
drivers/net/wireless/Makefile|51| obj-$(CONFIG_MRVL8688) += mrvl8688/
drivers/net/wireless/mrvl8688/Kconfig|2| bool "Marvell 8688 debugging"
drivers/net/wireless/mrvl8688/Kconfig|5| Marvell 8688 debugging messages. Choosing Y will result in additional debug
drivers/net/wireless/mrvl8688/Kconfig|10| prompt "Marvell 8688 debugging level"
drivers/net/wireless/mrvl8688/Kconfig|15| bool "Marvell 8688 debugging level 1"
drivers/net/wireless/mrvl8688/Kconfig|18| Marvell 8688 debugging level 1, only PRINTM(MSG,...), PRINTM(FATAL,...).
drivers/net/wireless/mrvl8688/Kconfig|21| bool "Marvell 8688 debugging level 2"
drivers/net/wireless/mrvl8688/Kconfig|24| Marvell 8688 debugging level 2, all PRINTM().
drivers/net/wireless/mrvl8688/Kconfig|28| bool "Marvell 8688 proc debug"
drivers/net/wireless/mrvl8688/Kconfig|31| Marvell 8688 proc debug messages. proc in /proc/net/wlan.
drivers/net/wireless/mrvl8688/Kconfig|34| bool "Marvell 8688 reassociation"
drivers/net/wireless/mrvl8688/Kconfig|37| Marvell 8688 re-association.
drivers/net/wireless/mrvl8688/Kconfig|40| bool "Marvell 8688 manufacturing firmware support"
drivers/net/wireless/mrvl8688/Kconfig|43| Marvell 8688 manufacturing firmware support.
drivers/net/wireless/mrvl8688/Kconfig|46| bool "Marvell 8688 big endian"
drivers/net/wireless/mrvl8688/Kconfig|49| Marvell 8688 big-endian platform.
drivers/net/wireless/mrvl8688/Kconfig|52| bool "Marvell 8688 DMA align"
drivers/net/wireless/mrvl8688/Kconfig|55| Marvell 8688 dma align.
drivers/net/wireless/Kconfig|265| tristate "Marvell 8688 WLAN driver support"
drivers/net/wireless/Kconfig|270| A driver for Marvell 8688 devices.
在drivers/net/wireless/Kconfig中
config MRVL8688 //对应CONFIG_MRVL8688变量,可以在.config中定义默认值
tristate "Marvell 8688 WLAN driver support"
depends on WLAN_80211
select WIRELESS_EXT
select FW_LOADER
---help---
A driver for Marvell 8688 devices.
source "drivers/net/wireless/mrvl8688/Kconfig" 表示调入相应Kconfig,放到下面
config MRVL8688_DEBUG //对应CONFIG_MRVL8688_DEBUG变量,可以在.config中定义默认值
bool "Marvell 8688 debugging"
depends on MRVL8688
---help---
Marvell 8688 debugging messages. Choosing Y will result in additional debug
messages being saved to your kernel logs, which may help debug any
problems.
choice //choice表示若干选一,项目之间互斥,有你没他
prompt "Marvell 8688 debugging level"
depends on MRVL8688_DEBUG
default MRVL8688_DEBUG_LEVEL1
config MRVL8688_DEBUG_LEVEL1
bool "Marvell 8688 debugging level 1"
depends on MRVL8688_DEBUG
---help---
Marvell 8688 debugging level 1, only PRINTM(MSG,...), PRINTM(FATAL,...).
config MRVL8688_DEBUG_LEVEL2
bool "Marvell 8688 debugging level 2"
depends on MRVL8688_DEBUG
---help---
Marvell 8688 debugging level 2, all PRINTM().
endchoice