zoukankan      html  css  js  c++  java
  • 《kernel源码分析(一)配置和编译过程》

    1.内核的配置和编译

    cp arch/arm/configs/xx_defconfig   .config
    make menuconfig
    make uImage

    2.了解内核的配置过程和编译过程

      在内核的配置过程中,会生成文件.config。

      以网卡DM9000为例:

      在.config中可以找到”CONFIG_DM9000=y“,这表示这个模块会被编译进内核。“CONFIG_DM9000=m”,这表示模块会被编译成.ko文件,可以动态的加载到内核。

      在内核顶层目录对CONFIG_DM9000进行查找:

    grep "CONFIG_DM9000"  -rn  .   咨询一下为什么不能查找出include下的

      可以看出在ARM架构中有4个文件中包含它

    • arch/arm/plat-s3c24xx/commod-smdk.c(源C)
    • drivers/net/Makefile(子目录的makefile)
    • include/config/auto.confg
    • include/linux/autoconf.h

      打开/drivers/net/Makefie。可以查找到“obj-$(CONFIG_DM9000) += dm9000.o”。$(CONFIG_DM9000)意思是根据CONFIG_DM9000的定义来决定是否编译dm9000.o。而auto.conf中就是对该宏进行定义,在auto.conf中可以查看到“CONFIG_DM9000=y”,所以makefile中的就可以扩展成obj-y += dm9000.o。就表示将模块编译进内核。如果"CONFIG_DM9000=m",就是将模块编译成.ko文件。auto.conf最终会被顶层的Makefile所包含。

      所以include/config/auto.conf里面定义的宏是用于Makefile中的。

      autoconf.h是个头文件,因此很明显是用于源C中的。里面有各种宏定义的定义。

      而autoconf.h和auto.conf是当make menuconfig的时候生成的。

      总结:make menuconfig----->生成auto.conf和autoconf.h

         auto.conf----->用于Makefile来决定是否编译该模块(y的时候是编译进内核,m的时候是编译成模块)

         autoconf.h----->用于源C的时候,定义了源码中相关的宏定义

  • 相关阅读:
    AngularJS Insert Update Delete Using PHP MySQL
    Simple task manager application using AngularJS PHP MySQL
    AngularJS MySQL and Bootstrap Shopping List Tutorial
    Starting out with Node.js and AngularJS
    AngularJS CRUD Example with PHP, MySQL and Material Design
    How to install KVM on Fedora 22
    Fake_AP模式下的Easy-Creds浅析
    河南公务员写古文辞职信
    AI
    政协委员:最大愿望是让小学生步行上学
  • 原文地址:https://www.cnblogs.com/zhuangquan/p/11461249.html
Copyright © 2011-2022 走看看