Linux Kernel Learning (4) old practices-

Source: Internet
Author: User
Tags builtin

I came back again ~ In documentation/kbuild/kconfig.txt, check the configuration file. Don't worry. I found that there is also a 00-index file under this kbuild directory. Obviously, it must be the file under this directory. You should check this file first.
00-Index
-This file: info on the kernel Build Process
Kbuild.txt
-Developer information on kbuild
Kconfig.txt
-Usage help for make * config
Kconfig-language.txt
-Specification of config language, the language in kconfig files
Makefiles.txt
-Developer information for Linux kernel makefiles
Modules.txt
-How to Build modules and to install them
Why didn't I translate it? Oh, it's so short. Let's just look at it. Let's take a look at kbuild.txt. Here we have to talk about what kind of kbuild is now available. There are a bunch of online searches! Find the classic.

About kbuild

Kbuild is a makefile framework used to compile simple makefiles to complete complex tasks.

Current kbuild Design

Objectives of the kbuild framework

1. Similar behavior on all supported platforms

2. Flexible, no unnecessary restrictions on blocking Special Solutions

3. makefile can be easily written and maintained

There are four concepts in the current kbuild concept.

1. a configuration file can automatically contain the subdirectory tree

2. There are target configuration file templates as the main mechanism for simplifying makefile

3. Tools and sdks (software development kit)
) To make the template flexible

4. implement non-recursive makefile method by using sub-makefiles

What does it feel like after reading it? When can we understand it like this? kbuild is an alternative makefile, A makefile nested with the kbuild framework syntax, this makefile makes the kernel compilation easier, so this solution is used.
Let's take a look at what kbuild.txt says:
Output files

Modules. Order
--------------------------------------------------
This file records the order in which modules appear in makefiles. This
Is used by modprobe to deterministically resolve aliases that match
Multiple modules.

This file records the order in makefiles. Solved the problem of duplicate module names.

Modules. builtin
--------------------------------------------------
This file lists all modules that are built into the kernel. This is used
By modprobe to not fail when trying to load something builtin.

This file lists the modules compiled into the built-in.o. Solve the loading problem.

Environment variables (environment variable)

Kcppflags
--------------------------------------------------
Additional options to pass when preprocessing. The Preprocessing options
Will be used in all cases where kbuild does preprocessing including
Building C files and runner er files.

Some additional options before kbuild processes C and assembly files.

Kaflags
--------------------------------------------------
Additional options to the aggreger (for built-in and modules ).

Additional options for assembly files (for build-in and module ).

Aflags_module
--------------------------------------------------
Addtional module specific options to use for $ ().

Use the additional module option of $ (.

Aflags_kernel
--------------------------------------------------
Addtional options for $ (AS) when used for processing er
Code for code that is compiled as built-in.

Use the additional options of $ (AS) when compiling assembly code to a build-in.o.

Kcflags
--------------------------------------------------
Additional options to the C compiler (for built-in and modules ).

Additional options for compiling C (for build-in and module ).

Cflags_kernel
--------------------------------------------------
Addtional options for $ (CC) when used to compile
Code that is compiled as built-in.

Additional options when $ (CC) is used for compilation into the build-in.o.

Cflags_module
--------------------------------------------------
Addtional module specific options to use for $ (CC ).

Additional module options when $ (CC) is used.

Ldflags_module
--------------------------------------------------
Additional options used for $ (LD) when linking modules.

Use $ (LD) additional options when linking modules.

Kbuild_verbose
--------------------------------------------------
Set the kbuild verbosity. can be assigned same values as "V = ...".
See make help for the full list.
Setting "V =..." takes precedence over kbuild_verbose.

Kbuild_extmod
--------------------------------------------------
Set the directory to look for the kernel source when building external
Modules.
The directory can be specified in several ways:
1) Use "m =..." on the command line
2) environment variable kbuild_extmod
3) environment variable subdirs
The possibilities are listed in the order they take precedence.
Using "m =..." will always override the others.

The directories set when the source code is searched are prioritized:
1) Use "m..." in the command line
2) use the kbuild_extmod environment variable
3) use the subdirs environment variable

Kbuild_output
--------------------------------------------------
Specify the output directory when building the kernel.
The output directory can also be specified using "O = ...".
Setting "O =..." takes precedence over kbuild_output.

Create an output directory, run the "O =..." command, or use the kbuild_output environment variable,
But the priority is not higher than the former.

Arch
--------------------------------------------------
Set arch to the architecture to be built.
In most cases the name of the architecture is the same as
Directory name found in the arch/directory.
But some ubuntures such as x86 and iSCSI have aliases.
X86: i386 for 32 bit, x86_64 for 64 bit
Type:

Set the machine directory.

Cross_compile
--------------------------------------------------
Specify an optional fixed part of the binutils filename.
Cross_compile can be a part of the filename or the full path.

Cross_compile is also used for ccache in some setups.

Cf
--------------------------------------------------
Additional options for sparse.
Cf is often used on the command-line like this:

Make cf =-wbitwise c = 2

Install_path
--------------------------------------------------
Install_path specifies where to place the updated kernel and system map
Images. Default is/boot, but you can set it to other values.

Set the installation directory.

Installkernel
--------------------------------------------------
Install script called when using "make install ".
The default name is "installkernel ".

The script will be called with the following arguments:
$1-kernel version
$2-kernel Image File
$3-kernel Map File
$4-default install path (use root directory if blank)

The implementation of "make install" is architecture specific
And it may differ from the above.

Installkernel is provided to enable the possibility
Specify a custom installer when cross compiling a kernel.

Set the script file for Kernel installation:
$1-kernel version
$2-kernel Image
$3-kernel symbol table File
$4-default installation directory

Modlib
--------------------------------------------------
Specify where to install modules.
The default value is:

$ (Install_mod_path)/lib/modules/$ (kernelrelease)

The value can be overridden in which case the default value is ignored.

Set the module installation directory.

Install_mod_path
--------------------------------------------------
Install_mod_path specifies a prefix to modlib for Module Directory
Relocations required by build roots. This is not defined in
Makefile but the argument can be passed to make if needed.

The prefix of modlib, which is used for the module installation directory. makefile is not defined. You can use make to define the prefix.

Install_mod_strip
--------------------------------------------------
Install_mod_strip, if defined, will cause modules to be
Stripped after they are installed. If install_mod_strip is '1', then
The default option -- strip-Debug will be used. Otherwise,
Install_mod_strip will used as the options to the Strip command.

If the variable is defined as 1, the default option "-- strip-Debug" will be used.

Install_fw_path
--------------------------------------------------
Install_fw_path specifies where to install the firmware blobs.
The default value is:

$ (Install_mod_path)/lib/firmware

The value can be overridden in which case the default value is ignored.

The path used to install the firmware module.

Install_hdr_path
--------------------------------------------------
Install_hdr_path specifies where to install user space headers when
Executing "make headers _*".
The default value is:

$ (Objtree)/usr

$ (Objtree) is the directory where output files are saved.
The output directory is often set using "O =..." on the CommandLine.

The value can be overridden in which case the default value is ignored.

This path is used to specify the output directory when the user space is installed by running the "O =..." command.

Kbuild_modpost_warn
--------------------------------------------------
Kbuild_modpost_warn can be set to avoid errors in case of undefined
Symbols in the final module linking stage. It changes such errors
Into warnings.

This variable will avoid errors with unspecified symbols in the Link phase. It can change the error to warning.

Kbuild_modpost_nofinal
--------------------------------------------------
Kbuild_modpost_nofinal can be set to skip the final link of modules.
This is solely useful to speed up test compiles.

This variable is used to skip the link module and accelerate compilation.

Kbuild_extra_symbols
--------------------------------------------------
For modules that use symbols from other modules.
See more details in modules.txt.

Use external symbols to view “les.txt files for more information.

Allsource_archs
--------------------------------------------------
For tags/cs1_targets, you can specify more than one arch
To be encoded in the databases, separated by blank space. E. g .:

$ Make allsource_archs = "x86 MIPS arm" tags

To get all available archs you can also specify all. E. g .:

$ Make allsource_archs = All tags

It seems that some output file information of kbuild is complete. When will it appear? After the kernel is configured, it is still generated in the compilation phase, or... I don't know. In fact, if you try "make menuconfig" in the top-level directory, you can configure the kernel in the menu mode, that is, in readme:
"Make menuconfig" text based color menus, radiolists & dialogs.
Color text menus, button lists, and dialog boxes
Ah
Remember, edit and save it, and use "ls" in the directory
-A ", you will find several strangers, with a file". config ", which is generated after configuration. Let's see" cat. config |
More”, no, the variable name is prefixed with config_, the idea of configuring the variable is compared with the variable in the javaskbuild.txt file, indicating that these output files are not Kernel configuration
After the configuration is completed, one rule is excluded! It's hard to start with everything!
So how did these come about? What's the use? I guess I can't know it now! Continue to analyze...

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.