"Kernel source code analysis (a) configuration and compilation process."

1. kernel configuration and compilation

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

 

2. Understand the kernel configuration and compilation process

  During the configuration of the kernel, it will generate the file .config.

  DM9000 to the card as an example:

  Can be found in "CONFIG_DM9000 = y" in .config, this means that this module will be compiled into the kernel. "CONFIG_DM9000 = m", which will be compiled into a block .ko files can be dynamically loaded into the kernel.

  CONFIG_DM9000 to find the kernel of the top-level directory:

grep " CONFIG_DM9000 "   -rn. Why not find out what advice under include the

  As can be seen there are four documents include it in the ARM architecture

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

  Open / drivers / net / Makefie. You can find "obj - $ (CONFIG_DM9000) + = dm9000.o". $ (CONFIG_DM9000) means that the definition CONFIG_DM9000 to decide whether to compile dm9000.o. Auto.conf while in the macro is defined, in auto.conf can view the "CONFIG_DM9000 = y", the makefile so it can be extended to the obj-y + = dm9000.o. It means that the module compiled into the kernel. If "CONFIG_DM9000 = m", the module is compiled into .ko file. auto.conf will eventually be included in the top-level Makefile.

  Therefore, include / config / auto.conf macro is defined inside the Makefile.

  autoconf.h a header file, so it is clear that the C source is used. There are definitions of the various macro definition.

  And when autoconf.h and auto.conf make menuconfig when generated.

  Summary: make menuconfig -----> generate auto.conf and autoconf.h

     auto.conf -----> Makefile for deciding whether to compile the module (when y is compiled into the kernel, m is when the compiled module)

     autoconf.h -----> C the time for the source, the source macro definition defines the relevant

 

Guess you like

Origin www.cnblogs.com/zhuangquan/p/11461249.html