Exynos4412 kernel porting (i)--Kernel configuration process Analysis

Source: Internet
Author: User
Tags documentation split

First, preface

1, the Linux kernel five major functions:

Process Management (CPU)
Memory Management (memory)
Device Management (Driver)
Network Management (Network protocol TCP/IP)
File System (VFS)


2. Linux version number:

Linux 2.6 2---> Major version number 6----> Minor version number: Odd for test version even for stable version

This article uses the kernel version of linux3.14


3. Linux directory structure:

Arch: architecture-related code
IPC: Process scheduling related code
MM: Memory Management
Documentation: Help documentation
NET: Network protocol
LIB: library
Scripts: Compiling related scripting tools
Tools: Compiling related tool
Drivers: Device driver
FS: File System implementation


4. Compile related files:

Top-level makefile and sub-directory Makefile
All levels Directory Kconfig


5, the use of the core process

A, clear the command

Typically used at the first compile time

Make Mrproper


B. Import default configuration information (in the kernel root directory) Method 1: Make exynos_deconfig

Method 2:cp arch/arm/configs/exynos_deconfig. config


C, detailed configuration make Menuconfig


D, compile

Make uimage---generate kernel image/arch/arm/boot/uimag

Make Dtbs ---Generate the device tree file/arch/arm/boot/dtb/exynos4412-fs4412.dtb

Make modules---The code that selected the configuration value to M is compiled to generate the module file. (. Ko) is placed in the corresponding source directory.


As you can see, kernel compilation mainly consists of two parts: kernel configuration, and kernel compilation; Let's start with the kernel configuration :

Second, the kernel of kconfig analysis

A-- after we unzip the kernel, we need to modify the makefile in the top-level directory of the kerneland configure the cross- compiling tool .



B--then import the default configuration (using make exynis_defconfig or cp arch/arm/configs/exynos_deconfig. config)


You can see that the command writes configuration information to. config, whichis a hidden file under the root of the kernel, and makefile will compile according to the contents of it.



C--Configure the kernel

Use the Make menuconfig command for kernel configuration (Windows are too small to open, Windows to 19 rows and 80 columns), you may receive the following error:



Use the sudo apt-get installation libncurses5-dev command to install the next, install and then use make menuconfig, you can see the following interface.



As shown in the figure above, this is the kernel configuration interface. Through the configuration interface, you can select the chip type and select the file system you want to support. removing unwanted options, etc., is called "Configuring the Kernel." Note that there are other forms of configuration interface, such as the "make config" command to start the character configuration interface, for each option will appear a line of prompt information, the group answer; "Make Xconfig" command to start the X-windows graphical configuration interface


All configuration tools are read arch/$ (ARCH)/kconnfig file to generate the configuration interface , this file is the total entry of all configuration files, it will contain other directories of kconfig files. The configuration interface is shown in the figure above.


In each subdirectory of the kernel source, there is a makefile file and a kconfig file. The role of Makefile in the next article will be described , kconfig for the configuration of the kernel, it is a variety of configuration interface source files . The kernel Configuration tool reads individual kconfig files, generates a configuration interface for the developer to configure the kernel, and finally builds the configuration file. config.


The kernel configuration interface is organized in a tree-like menu, with several submenus under the main menu, and submenus or configuration options under the submenu. Each submenu or option has dependencies that are used to determine whether they are displayed. The child is displayed only if the dependent parent has been selected.



Here's a simple syntax for learning kconfig files:

1. Basic elements of the Kconfig file: Config entry (entry)


Config entries are often included in other entries to generate menus, make multiple selections , and so on.


The config entry is used to configure an option, or so it is used to generate a variable that, along with its value, is written to the configuration file. config . For example, there is a config entry for configuring config_leds_fs4412, and depending on the user's choice, one of the following 3 configuration results may appear in the. config file.


Config_leds_fs4412=y # corresponding files are compiled into the kernel

Config_leds_fs4412=m # corresponding files are compiled into modules

#CONFIG_LEDS_FS4412 # The corresponding file is not being used


To illustrate the config entry format as an example, the following code is selected from the Drviers/char/kconfig file, which is used to configure the CONFIG_TTY_PRINTK option

The code contains most of the elements, as described in one by one below.

Line 42nd, CONFIG is the keyword, is the beginning of a configuration option ; The TTY_PRINTK that follows is the name of the configuration option, omitting the prefix "Config_".

line 43rd ,boot represents the variable type , which is the type of CONFIG_TTY_PRINTK, with five types:

BOOL Boolean type, the result is y[*], n[]
Tristate three options, result y[*], n[], m[m]

string string, result (arm-linux-)
Hex 16 Binary, (16)
Int Decimal, (10)

string prompt after "bool", when you move the cursor up or down in the configuration interface to select it, you can set the value of the CONFIG_TTY_PRINTK by pressing a space or enter.

Line 44th, which represents a dependency , is in the following format. Only the expert && TTY configuration options are selected, the current configuration options are prompted to set current configuration options. Note that if the dependency condition is not met, it takes the default value.

the 45th line indicates that the default value is n;

Line 46th indicates that the following lines are helpful information;


2. Menu item

The menu entry is used to generate the menus, which appear as------> in the Menuconfig format as follows:

"Menu" <prompt>

<menu options>

<menu block>

"Endmenu"


Its actual use is not as complex as its standard format, here is an example


After menu, the string is the menu name, and there are many config entries between "menu" and "Endmunu". On the configuration screen, the following menu appears, moving the cursor after selecting it and pressing ENTER, you will see the configuration options defined by these config entries.


3. Source Entry

Xx/kconfig: The current kconfig can contain kconfig in other directoriesfor reading another kconfig file in the following format:

"Source" <prompt>

Here is an example, taken from the Arch/arm/kconfig file, which reads into the Arch/arm/mach-mvebu/kconfig file


4, Choice

The choice entry combines several similar configuration options for a single or multiple selection of users, in the following format:

"Choice"

<choice options>

<choice block>

"End Choice"

In practice, it is also necessary to define multiple config entries between "choice" and "Endchoice", such as the following code in Arcg/arm/kconfig:


Prompt "Memory split" gives the message "Memory Split", the cursor selects it and press ENTER to enter, you can see the configuration options defined by multiple config entries.



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.