The. config

Source: Internet
Author: User

the dot-config file is the configuration blueprint for building a Linux kernel image. you will likely spend significant effort at the start of the your Linux project building a configuration that is appropriate for your embedded platform. several editors, both text based and graphical, are designed to edit your Kernel configuration. the output of this configuration exercise is written to a configuration file named . config , located in the top-level Linux source directory that drives the kernel build.

You have likely invested significant time perfecting your Kernel configuration, so you will want to protect it. SeveralMakeCommands Delete this configuration file without warning. The most common isMake mrproper. ThisMakeTarget is designed to return the kernel source tree to its pristine, unconfigured state. This includes des removing all configuration data from the source tree-and, yes, it deletes your. Config.

As you might know, any filename in Linux preceded by a dot is a hiddden file in Linux. it is unfortunate that such an important file is marked hidden; this has brought considerable grief to more than one developer. if you executeMake mrproperWithout having a backup copy of your. ConfigFile, you, too, will share our grief. (You have been warned -- back up your. ConfigFile !)

The. ConfigFile is a collection of definitions with a simple format. List 4.5 shows a snippet of. ConfigFrom a recent Linux kernel release.

Listing 4-5

Snippet from Linux 2.6. config

,,,

# USB support

Config_usb = m

# Config_usb_debug is not set

# Miscellaneous USB options

#

Config_usb_devicefs = y

# Config_usb_bandwidth is not set

# Config_usb_dynamic_minors is not set

# USB Host Controller drivers

#

Config_usb_ehci_hcd = m

,,,

to understand the . config file, you need to understand a fundameental aspect of the Linux kernel. linux has a monolithic structure. that is, the entire kernel is compiled and linked as a single statically linked executable. however, it is possible to compile and incrementally link A set of sources into a single object module suitable for dynamic insertion into a running kernel. this is the usual method for supporting most common device drivers. in Linux, these are called loadable modules. they are also genericaly called device drivers. after the kernel is booted, a special application program is invoked to insert the loadable module into a running kernel.

armed with that knowledge, let's look again at Listing 4-5. this snippet of the configuration file (. config) shows a portion of the USB subsystem configuration. this first configuration option, config_usb = m, declares that the USB subsystem is to be written in this Kernel configuration and that it will be compiled as a dynamically loadable module (= m ), to be loaded sometime after the kernel has booted. the other choice wowould have been = Y, in which case the USB Module wocould be compiled nadstatically linked as part of the kernel image itself. it wocould end up in .. /Drivers/built-in.o composite binary. ther astute reader will realize that if a driver is configured as a loadable module, its code is not supported in the kernel proper, but rather exists as a stand-alone object module, A loadable module, to be inserted into the running kernel after boot.

Notice the Listing 4-5Config_usb_devicefs = y declaration.This configuration option behaves in a slightly defferent manner. In this case,Usb_devicefs (As configuration options are commonly abbreviated) is not a stand-alone module, but rather a feature to be enabled or disabled in the USB driver. it does not necessarily result in a module that is compiled into the kernel proper (= y); instead, it enables one or more features, often represented as additional object modules to be encoded in the overall USB device driver module. usually, the help text in the configuration editor or the hierarchy presented by the configuration Editor, makes this distinction clear.

 

Most kernel software modules also read the configuration indirectly via. ConfigFile as follows. During the build process,. ConfigFile is processed into a C header file found in... /include/Linux directory, called Autoconf. h. this is an automatically generated file and shoshould never be edited directly because edits are lost each time a configuration editor is run. kernel kernel source files include this file directly using the # include Preprocessor directive. list 4-6 reproduces a section of this header file that corresponds to the earlier USB example above. note that, for each entry in. ConfigFile snippet in Listing 4-5, a corresponding entry is created inAutoconf. h. This is how the source files in the kernel source tree reference the Kernel configuration.

Listing 4-6

Linux Autoconf. h

/*

* USB support

*/

# Define config_usb_module 1

# UNDEF config_usb_debug

 

/* Mkscellaneous UBS options */

# Define config_usb_devicefs 1

# UNDEF config_usb_bandwidth

# UNDEF config_usb_dynamic_minors

/* USB Host Controller drivers */

# Define config_usb_ehci_hcd_module 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.