kernel配置优化
程序员文章站
2022-05-29 09:12:32
...
kernel配置优化
一、概述
在嵌入式开发中,使用linux kernel不可避免,kernel支持的驱动非常庞大,删除不需要的驱动也是势在必行。那么那么多的配置,都有什么作用?该删除哪些呢?下面介绍一种快速明白相应配置的功能。
二、明确具体CONFIG作用
以USB模块为例
在kernel编译时使用的.config部分内容如下:
#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_RTL8152 is not set
CONFIG_USB_USBNET=y
# CONFIG_USB_NET_AX8817X is not set
# CONFIG_USB_NET_AX88179_178A is not set
CONFIG_USB_NET_CDCETHER=y
# CONFIG_USB_NET_CDC_EEM is not set
# CONFIG_USB_NET_CDC_NCM is not set
# CONFIG_USB_NET_CDC_MBIM is not set
# CONFIG_USB_NET_DM9601 is not set
# CONFIG_USB_NET_SMSC75XX is not set
# CONFIG_USB_NET_SMSC95XX is not set
# CONFIG_USB_NET_GL620A is not set
# CONFIG_USB_NET_NET1080 is not set
# CONFIG_USB_NET_PLUSB is not set
很明显有很多驱动都用不上,要确定具体一个CONFIG的作用,在kernel根目录执行(以CONFIG_USB_CATC为例)
linux-3.10$ grep -nr "USB_CATC" --include=Kconfig
drivers/net/usb/Kconfig:10:config USB_CATC
注意: 搜索时把前面的CONFIG_去掉,搜索出的结果是config USB_CATC形式的。有时会搜索出很多,因此需要这个规则。
查看Kconfig内容,部分内容如下:
#
# USB Network devices configuration
#
comment "Networking support is needed for USB Network Adapter support"
depends on USB && !NET
menu "USB Network Adapters"
depends on USB && NET
config USB_CATC
tristate "USB CATC NetMate-based Ethernet device support"
select CRC32
---help---
Say Y if you want to use one of the following 10Mbps USB Ethernet
device based on the EL1210A chip. Supported devices are:
Belkin F5U011
Belkin F5U111
CATC NetMate
CATC NetMate II
smartBridges smartNIC
This driver makes the adapter appear as a normal Ethernet interface,
typically on eth0, if it is the only ethernet device, or perhaps on
eth1, if you have a PCI or ISA ethernet card installed.
To compile this driver as a module, choose M here: the
module will be called catc.
看到这里已经很明白了吧。该段中不仅描述的驱动的作用,还描述了驱动的依赖。在下面的Kconfig格式解析说明。
三、Kconfig格式解析
待完成 …