linux内核的配置与编译过程

选择九鼎s5pv210开发板移植的Linux内核,下载地址为:
链接:http://pan.baidu.com/s/1sl15QMD 密码:by3o


1.首先检查Makefile
查看Makefile主要看一下Makefile中的两个变量:ARCH与CROSS_COMPILE;
(1)主要是检查交叉编译工具链有没有设置对。
CROSS_COMPILE ?= /usr/local/arm/arm-2009q3/bin/arm-none-linux-gnueabi-
(2)确认ARCH = arm。主要目的是为了编译时能找到arch/arm目录。

2.配置过程
(1)配置主要通过两步进行:
第一步,make xx_defconfig,在九鼎x210开发板中是make x210ii_qt_defconfig,如果在配置信息最后一行看到configuration written to .config这句,表明把所有的配置选项都写到.config文件中。
第二步,make menuconfig,在这个图形界面进行配置。

(2)make xx_defconfig和make menuconfig相配合
make xxx_defconfig这一步其实是参考别人已经做好的,这样做有很多好处:减少很多工作量,避开了很多自己不懂的配置项(譬如对内存管理的、调度系统的等模块的配置项),我们只用管自己需要管的。
其实make x210ii_qt_defconfig就相当于:cp arch/arm/configs/x210ii_qt_defconfig .config
在arch/arm/configs目录下有很多xxx_defconfig,这些文件都是别人手工配置好适合一定的开发板的.config文件后自己把.config文件保存过去的

make menuconfig其实就是读取第一步得到的.config,然后给我们一个图形化的界面,让我们可以更加容易的找到自己想要修改的配置项,然后更改配置。

(3)make menuconfig注意事项
执行之后的图形界面如图所示:

1.用法:
箭头按键导航整个菜单;
回车按键选择子菜单(注意选项后面有 —>的选项才是有子菜单的,没有这个标识的没有子菜单);
高亮的字母是热键(快捷键);
键盘按键Y、N、M三个按键的作用分别是将选中模块编入、去除、模块化,在menuconfig中选项前面的括号里,*表示编入,空白表示去除,M表示模块化;
双击ESC表示退出;
按下”?“按键可以显示帮助信息;
按下”/“按键可以输入搜索内容来全局搜索信息(类似于vi中的搜索);
[]不可以模块化,<>的才可以模块化。

2.menuconfig的工作原理
a. menuconfig显示的菜单内容是由内核源码树各个目录下的Kconfig文件来支持的。Kconfig文件中按照一定的格式包含了一个又一个的配置项,每一个配置项在make menuconfig中都会成为一个菜单项目。而且menuconfig中显示的菜单目录结构和源码目录中的Kconfig的目录结构是一样的。在相应的Kconfig文件中删除一个config项,则再次make menuconfig时这个项目已经看不到了。

b. menuconfig读取/写入.config文件
menuconfig的菜单内容来自于Kconfig文件,但是每一个菜单的选择结果(Y、N、M)却不是保存在Kconfig文件中的。Kconfig文件是不变的,Kconfig文件只是决定有没有这个菜单项,并不管这个菜单项的选择结果。menuconfig工作时在我们make menuconfig打开时,他会读取.config文件,并且用.config文件中的配置选择结果来初始化menuconfig中各个菜单项的选择值。

总结:菜单项的项目内容从Kconfig文件来,菜单项的选择值从.config文件来。

3.Kconfig文件分析
几乎在大部分的目录下都有一个Kconfig文件,随便找一个Kconfig文件进行分析,比如\kernel\drivers\net\wireless目录下的Kconfig文件,内容如下:

menuconfig WLANbool "Wireless LAN"depends on !S390depends on NETselect WIRELESSdefault y---help---This section contains all the pre 802.11 and 802.11 wirelessdevice drivers. For a complete list of drivers and documentationon them refer to the wireless wiki:http://wireless.kernel.org/en/users/Driversif WLANconfig PCMCIA_RAYCStristate "Aviator/Raytheon 2.4GHz wireless support"depends on PCMCIAselect WIRELESS_EXTselect WEXT_SPYselect WEXT_PRIV---help---Say Y here if you intend to attach an Aviator/Raytheon PCMCIA(PC-card) wireless Ethernet networking card to your computer.Please read the file <file:Documentation/networking/ray_cs.txt> fordetails.To compile this driver as a module, choose M here: the module will becalled ray_cs.  If unsure, say N.config LIBERTAS_THINFIRMtristate "Marvell 8xxx Libertas WLAN driver support with thin firmware"depends on MAC80211select FW_LOADER---help---A library for Marvell Libertas 8xxx devices using thinfirm.config LIBERTAS_THINFIRM_DEBUGbool "Enable full debugging output in the Libertas thin firmware module."depends on LIBERTAS_THINFIRM---help---Debugging support.config LIBERTAS_THINFIRM_USBtristate "Marvell Libertas 8388 USB 802.11b/g cards with thin firmware"depends on LIBERTAS_THINFIRM && USB---help---A driver for Marvell Libertas 8388 USB devices using thinfirm.config AIROtristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"depends on ISA_DMA_API && (PCI || BROKEN)select WIRELESS_EXTselect CRYPTOselect WEXT_SPYselect WEXT_PRIV---help---This is the standard Linux driver to support Cisco/Aironet ISA andPCI 802.11 wireless cards.It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X- with or without encryption) as well as card before the Ciscoacquisition (Aironet 4500, Aironet 4800, Aironet 4800B).This driver support both the standard Linux Wireless Extensionsand Cisco proprietary API, so both the Linux Wireless Tools and theCisco Linux utilities can be used to configure the card.The driver can be compiled as a module and will be named "airo".config ATMELtristate "Atmel at76c50x chipset  802.11b support"depends on (PCI || PCMCIA)select WIRELESS_EXTselect WEXT_PRIVselect FW_LOADERselect CRC32---help---A driver 802.11b wireless cards based on the Atmel fast-vnetchips. This driver supports standard Linux wireless extensions.Many  cards based on this chipset do not have flash memoryand need their firmware loaded at start-up. If yours isone of these, you will need to provide a firmware imageto be loaded into the card by the driver. The Atmelfirmware package can be downloaded from<http://www.thekelleys.org.uk/atmel>config PCI_ATMELtristate "Atmel at76c506 PCI cards"depends on ATMEL && PCI---help---Enable support for PCI and mini-PCI cards containing theAtmel at76c506 chip.config PCMCIA_ATMELtristate "Atmel at76c502/at76c504 PCMCIA cards"depends on ATMEL && PCMCIAselect WIRELESS_EXTselect FW_LOADERselect CRC32---help---Enable support for PCMCIA cards containing theAtmel at76c502 and at76c504 chips.config AT76C50X_USBtristate "Atmel at76c503/at76c505/at76c505a USB cards"depends on MAC80211 && USBselect FW_LOADER---help---Enable support for USB Wireless devices using Atmel at76c503,at76c505 or at76c505a chips.config AIRO_CStristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"depends on PCMCIA && (BROKEN || !M32R)select WIRELESS_EXTselect WEXT_SPYselect WEXT_PRIVselect CRYPTOselect CRYPTO_AES---help---This is the standard Linux driver to support Cisco/Aironet PCMCIA802.11 wireless cards.  This driver is the same as the Aironetdriver part of the Linux Pcmcia package.It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X- with or without encryption) as well as card before the Ciscoacquisition (Aironet 4500, Aironet 4800, Aironet 4800B). It alsosupports OEM of Cisco such as the DELL TrueMobile 4800 and Xircom802.11b cards.This driver support both the standard Linux Wireless Extensionsand Cisco proprietary API, so both the Linux Wireless Tools and theCisco Linux utilities can be used to configure the card.config PCMCIA_WL3501tristate "Planet WL3501 PCMCIA cards"depends on EXPERIMENTAL && PCMCIAselect WIRELESS_EXTselect WEXT_SPYhelpA driver for WL3501 PCMCIA 802.11 wireless cards made by Planet.It has basic support for Linux wireless extensions and initialmicro support for ethtool.config PRISM54tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)'depends on PCI && EXPERIMENTALselect WIRELESS_EXTselect WEXT_SPYselect WEXT_PRIVselect FW_LOADER---help---This enables support for FullMAC PCI/Cardbus prism54 devices. Thisdriver is now deprecated in favor for the SoftMAC driver, p54pci.p54pci supports FullMAC PCI/Cardbus devices as well. For details onthe scheduled removal of this driver on the kernel see the featureremoval schedule:Documentation/feature-removal-schedule.txtFor more information refer to the p54 wiki:http://wireless.kernel.org/en/users/Drivers/p54Note: You need a motherboard with DMA support to use any of these cardsWhen built as module you get the module prism54config USB_ZD1201tristate "USB ZD1201 based Wireless device support"depends on USBselect WIRELESS_EXTselect WEXT_PRIVselect FW_LOADER---help---Say Y if you want to use wireless LAN adapters based on the ZyDASZD1201 chip.This driver makes the adapter appear as a normal Ethernet interface,typically on wlan0.The zd1201 device requires external firmware to be loaded.This can be found at http://linux-lc100020.sourceforge.net/To compile this driver as a module, choose M here: themodule will be called zd1201.config USB_NET_RNDIS_WLANtristate "Wireless RNDIS USB support"depends on USB && EXPERIMENTALdepends on CFG80211select USB_USBNETselect USB_NET_CDCETHERselect USB_NET_RNDIS_HOST---help---This is a driver for wireless RNDIS devices.These are USB based adapters found in devices such as:Buffalo WLI-U2-KG125SU.S. Robotics USR5421Belkin F5D7051Linksys WUSB54GSv2Linksys WUSB54GSCAsus WL169gEEminent EM4045BT Voyager 1055Linksys WUSB54GSv1U.S. Robotics USR5420BUFFALO WLI-USB-G54All of these devices are based on Broadcom 4320 chip which is theonly wireless RNDIS chip known to date.If you choose to build a module, it'll be called rndis_wlan.source "drivers/net/wireless/rtl818x/Kconfig"config ADM8211tristate "ADMtek ADM8211 support"depends on MAC80211 && PCI && EXPERIMENTALselect CRC32select EEPROM_93CX6---help---This driver is for ADM8211A, ADM8211B, and ADM8211C based cards.These are PCI/mini-PCI/Cardbus 802.11b chips found in cards such as:Xterasys Cardbus XN-2411bBlitz NetWave Point PCTrendNet 221pcBelkin F5D6001SMC 2635WLinksys WPC11 v1Fiberline FL-WL-200X3com Office Connect (3CRSHPW796)Corega WLPCIB-11SMC 2602W V2 EUD-Link DWL-520 Revision CHowever, some of these cards have been replaced with other chipslike the RTL8180L (Xterasys Cardbus XN-2411b, Belkin F5D6001) orthe Ralink RT2400 (SMC2635W) without a model number change.Thanks to Infineon-ADMtek for their support of this driver.config MAC80211_HWSIMtristate "Simulated radio testing tool for mac80211"depends on MAC80211---help---This driver is a developer testing tool that can be used to testIEEE 802.11 networking stack (mac80211) functionality. This is notneeded for normal wireless LAN usage and is only for testing. SeeDocumentation/networking/mac80211_hwsim for more information on howto use this tool.To compile this driver as a module, choose M here: the module will becalled mac80211_hwsim.  If unsure, say N.config MWL8Ktristate "Marvell 88W8xxx PCI/PCIe Wireless support"depends on MAC80211 && PCI && EXPERIMENTAL---help---This driver supports Marvell TOPDOG 802.11 wireless cards.To compile this driver as a module, choose M here: the modulewill be called mwl8k.  If unsure, say N.source "drivers/net/wireless/ath/Kconfig"
source "drivers/net/wireless/b43/Kconfig"
source "drivers/net/wireless/b43legacy/Kconfig"
source "drivers/net/wireless/bcm4329/Kconfig"
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/ipw2x00/Kconfig"
source "drivers/net/wireless/iwlwifi/Kconfig"
source "drivers/net/wireless/iwmc3200wifi/Kconfig"
source "drivers/net/wireless/libertas/Kconfig"
source "drivers/net/wireless/orinoco/Kconfig"
source "drivers/net/wireless/p54/Kconfig"
source "drivers/net/wireless/rt2x00/Kconfig"
source "drivers/net/wireless/wl12xx/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig"endif # WLAN

(1)#开头的行是注释行
(2)menuconfig表示菜单,config表示菜单中的一个配置项。
(3)menuconfig或者config后面空格隔开的大写字母表示的就是这个配置项的配置项名字,这个字符串前面添加CONFIG_后就构成了.config中的配置项名字。
(4)一个menuconfig后面跟着的所有config项就是这个menuconfig的子菜单。这就是Kconfig中表示的目录关系。
(5)内核源码目录树中每一个Kconfig都会source引入其所有子目录下的Kconfig,从而保证了所有的Kconfig项目都被包含进menuconfig中。这个也告诉我们:如果你自己在linux内核中添加了一个文件夹,一定要在这个文件夹下创建一个Kconfig文件,然后在这个文件夹的上一层目录的Kconfig中source引入这个文件夹下的Kconfig文件。
(6)tristate和bool的含义:
tristate意思是三态(3种状态,对应Y、N、M三种选择方式),bool是要么真要么假(对应Y和N)。所以tristate的意思就是这个配置项可以被三种选择,bool的意思是这个配置项只能被2种选择。
(7)depends的含义:
本配置项依赖于另一个配置项。如果那个依赖的配置项为Y或者M,则本配置项才有意义;如果依赖的哪个配置项本身被设置为N,则本配置项根本没有意义。
depends项目会导致make menuconfig的时候找不到一些配置项。所以你在menuconfig中如果找不到一个选项,但是这个选项在Kconfig中却是有的,则可能的原因就是这个配置项依赖的一个配置项是不成立的。
depends并不要求依赖的配置项一定是一个,可以是多个,而且还可以有逻辑运算。这种时候只要依赖项目运算式子的裸机结果为真则依赖就成立。
(8)select:自动选择
(9)default:默认配置值,是n、y或者m

linux kernel 配置与编译相关推荐

  1. 最新历史版本 :LINUX KERNEL 配置编译中文指南

    LINUX KERNEL 配置编译中文指南 序言 近几年,linux大行其道,令不满windows蓝屏的使用者跃跃欲试,结果发现linux安装不及windows方便,界面不及windows友好,配置不 ...

  2. linux内核配置与编译,LINUX内核的配置与编译、安装

    LINUX内核的配置与编译.安装 平台为VM RHEL 5.1 SERVER,所用的内核为linux-2.6.25. 可以到上下载相应的内核版本. 解压压缩包,并进入内核目录.下面是具体的步骤: 1. ...

  3. linux kernel 配置(部分) 部分内容翻译自内核帮助文档

    linux kernel 2.6.13 在配置内核前,你应当对详细的了解运行内核的系统,根据自己的需要配置内核. 下面,我将解释内核的各个选项,并根据本人的机器作相应的配置. 在此之前,我把机器硬件参 ...

  4. 树莓派Linux内核配置、编译以及烧录详细步骤

    目录 一.内核配置 第一种方式:(cp 厂家.config .config) 第二种方式(make menuconfig 一项项配置,通常是基于厂家的config来配置) 二.内核编译 三.烧录 1. ...

  5. Linux内核配置和编译

    一.引言:  本文档的内容大部份内容都是从网上收集而来,然后配合一些新的截 图(内核版本:V2.4.19).在每一配置项后会有一个选择指南的部份,用来指导大家怎么样 根据自己的情况来做相应的选择:还有 ...

  6. linux内核配置与编译

    配置内核:配置硬件和软件需的部分. make config:基于文本模式的交互式配置.(一问一答) make menuconfig:基于文本模式菜单性配置.(直观简单高效) <*>会产生b ...

  7. 11 编译2022年最新的Linux kernel 6.1源码,并用QEMU模拟器运行

    编译2022年最新的Linux kernel源码,并用QEMU模拟器运行 作者 将狼才鲸 创建日期 2022-11-26 Gitee源码和工程地址:才鲸嵌入式 / 嵌入式QEMU教程 CSDN文章地址 ...

  8. 09 编译2022年最新的Linux kernel、U-Boot和BusyBox rootfs源码,并用QEMU模拟器运行

    编译2022年最新的Linux kernel.U-Boot和BusyBox rootfs源码,并用QEMU模拟器运行 作者 将狼才鲸 创建日期 2022-11-26 Gitee源码和工程地址:才鲸嵌入 ...

  9. linux kernel浮点处理

    目前大多数CPU都支持浮点运算单元FPU,FPU作为一个单独的协处理器放置在处理器核外,但是对于嵌入式处理器,浮点运算本来就少用,有些嵌入式处理器就会去掉浮点协处理器.X86处理器一般都是有FPU的. ...

最新文章

  1. TensorFlow2简单入门-加载及预处理文本
  2. 自己开发的在线视频下载工具,基于Java多线程
  3. Fedora 17 Beta 版发布
  4. 设定pic单片机端口为输入_PIC单片机IO端口的软件/硬件可靠性使用方法讨论
  5. pktgen:DPDK流量生成器
  6. 关于layui中lay-verify=required无效的解决办法
  7. 内存泄漏的原因及解决办法_浅谈 JS 内存泄漏问题
  8. 三省2:hadoop是什么鬼1
  9. php 做圆形头像,php制作圆形用户头像方法
  10. 高德地图 html5,高德地图API发布HTML5矢量地图渲染引擎[图]
  11. Flutter Dio 报错is not a subtype of type ‘DioError‘
  12. 《影响力》- 作者 Robert B. Cialdini 罗伯特·西奥迪尼 读后感
  13. 智鼎在线测评是测什么_为什么求职者会反感企业招聘用的人才测评?
  14. FFMPEG AvFilter使用实例(实现视频缩放,裁剪,水印等)
  15. 一条SQL语句查询所有任务分数都在60以上的用户名字
  16. 从零开始学习 wireshark过滤规则 8月19日
  17. Nett源码剖析注册通道2021SC@SDUSC
  18. 海鲜吃得好,喝酒少不了,盒马痛风套餐来了
  19. H5播放器内置播放视频(兼容绝大多数安卓和ios)
  20. 我们常用的图片格式到底有什么区别?

热门文章

  1. Unity Shader 透视效果/XRay
  2. VUE 图片放大特效
  3. 高精度厚度测量的四种常用方案
  4. 牛客网 编程初学者入门训练 BC3 有容乃大 Java
  5. python cookbook3笔记三
  6. 软件测试缺陷等级划分_软件的缺陷等级应如何划分?
  7. excel 折线图和面积图拼接
  8. windows系统环境变量和用户环境变量的区别
  9. LoadLibrary() 错误码问题 14001, 126
  10. 大数据分析人工智能中机器学习算法有哪些