When compiling the Android, the makefile and Kconfig compiled system under Linux is used to compile the whole system. Of course, there are a lot of configuration commands, such as make defconfig, makes Oldconfig and various compiled scripts, together form the entire Android system!
Files related to make Menuconfig This command include class three, including. Config,kconfig,makefile. Why not say three, but say three categories? Because Kconfig and makefile are used in conjunction, many subdirectories exist, whereas. config exists only in the root directory. The roles of these three files are:
Kconfig: Defines a configuration item
**defconfig: Assigning values to a configuration item
Makefile: Establishing a rule for generating configuration items
See here, someone may have a headache, in the end what is a configuration item, what is the rule of generation. Here requires the ability to understand makefile, if you do not understand, you can find the relevant information makefile.
If you use an example, it is easier to understand. For example, I have written a new device driver file sprd_sim.c, which does not care about SPRD_SIM.C content. If you want to compile the SPRD_SIM.C into an Android system, you need to follow the steps below.
1) put SPRD_SIM.C into a related directory of Android system driver, this directory only requires existing kconfig and makefile, such as source code kernel directory/kernel/driver/directory.
2) Add in the kconfig of this directory
Menu ' sprd_sim support ' config Sprd_simbool ' support for Sprd_sim ' help Say Y here to add support for Leadexd SPRD_SIMIF Sprd_simconfig sprd_sim_leadexceedtristate "Leadexd SPRD sim Driver" depends on Has_iomemhelp leadexceed SPRD SIM Driver I Mplemented by Jobs-hu.endifendmenu
3) Add in Makefile
# # Makefile for the SIM detect device drivers.##, hu<[email protected]>## Object files in SubDir ectoriesobj-$ (config_sprd_sim_leadexd) + = Sprd_sim.oobj-y
4) in. config, you can add
Config_sprd_sim=yconfig_sprd_sim_leadexd=y
Or, when you execute make menuconfig, find the option to display the name My_driver, using a space to select it. But this generally does not require us to execute, usually after the relevant compilation script, these configuration information will be
automatically resolves to the relevant config file.
5) Add the device to the BOARD.C
static struct Platform_device *devices[] __initdata = {#ifdef Config_ion&sprd_ion_dev, #endif &sprd_emmc_device , &sprd_sdio0_device, &sprd_sim_device, ... .
All in all, if you need to add a feature to the system kernel, first define a configuration item that corresponds to this feature and add it to a specific kconfig file. Then in makefile, define which files the configuration item needs to compile. Finally, you can use make menuconfig or directly modify. config to enable this configuration item.
In fact,. config is the change to the configuration item that is saved to a file after make Menuconfig is executed. Of course, each company will add some compile scripts, execute new compilation instructions, and generate a. config file, if there is no. config, and make Menuconfig will be displayed as default values.
Reference Document: Http://blog.chinaunix.net/uid-24227137-id-3277449.html
http://shunfengwei.blog.163.com/blog/static/17522511720123494332301/
http://blog.csdn.net/estate66/article/details/5886816
http://blog.csdn.net/dianhuiren/article/details/6917132