Linux core compilation

Source: Internet
Author: User
Purpose 1. the original core is too bloated. to make the system more stable, remove unnecessary functions. requirements for new functions 3. to adapt to the updated hardware, you need to compile the core 4. what are the core versions required for embedded systems? Composition of the version --: "[main]. [times]. [release]-[Modify]"...

 

Core update objective

1. the original core is too bloated. to make the system more stable, remove unnecessary functions.

2. requirements for new functions

3. Compile the core to adapt to the updated hardware.

4. Embedded System requirements

Core version

? Composition of versions --:[Master]. [times]. [release]-[Modify]"

? If the number of versions is odd, this version is the standard version (2.5.x). if it is an even number, it indicates a stable version (2.6.x ).

? When upgrading different versions, pay attention to the changes to the core function library. if the changes are high, we do not recommend that you upgrade the core to avoid unavailability of the dependent software.

? Official website for core release: www.kernel.org

? The upgrade of the core patch must be a continuous version. check the patch description before deciding.

Download and install the core source code

1. source code extraction location

A) usually at/usr/src/kernels/

B) command for tar-jxvf linux-2.6.30.3.tar.bz2-C/usr/src/kernels/

Arch: hardware platform-related projects, most of which refer to the CPU category, such as x86, x86_64, and Xen virtual support;

Block: information related to block devices. block data usually refers to a large number of storage media! It also includes whether ext3 and other file systems support ext3.

Crypto: the encryption technology supported by the core, such as md5 or des;

Documentation: a bunch of instruction files related to the core. if you are very interested in the core, check it out!

Drivers: some hardware drivers, such as display cards, network cards, and PCI-related hardware;

Firmware: the micro-instruction code (firmware) of some legacy hardware;

Fs: The filesystems supported by the core, such as vfat, reiserfs, and nfs;

Include: some header definitions that allow calls by other programs;

Init: some core initialization definition functions, including mounting and calling of init programs;

Ipc: defines the communication between various programs in the Linux operating system;

Kernel: defines the core program, core status, execution thread, program schedule (schedule), program signal (signle), etc.

Lib: some function libraries;

Mm: information related to memory units, including swap and virtual memory;

Net: Network-related protocols, as well as firewall modules (net/ipv4/netfilter;

Security: security settings including selinux;

Sound: various modules related to sound effects;

Virt: information related to Virtual machines. At present, the core support is KVM (Kernel base Virtual Machine)

2. the directory under the source code and its usefulness

3. core pre-compilation processing and core function selection

A) detection hardware

B) core functional requirements

4. Pre-compilation practices

A) keep the source code clean.

· Make dep to ensure that all required files are in the relevant location

· Make mrproper will delete all configuration files, including the configurations left by the core after Compilation

· Make clean only deletes the intermediate code generated during compilation and retains the core configuration of the previous configuration.

B) start to select core functions

· Make menuconfig selects core functions in text directory mode

· Make oldconfig uses an existing configuration file to modify core functions

· Make xconfig is displayed on the Qt-based graphic interface. the X Window designed by Qt is used. KDE can be used.

· Make gconfig is displayed on the ftk-based graphic interface. GNOME can use

· Make config is always a method. The text Q & A mode is irreversible and is not recommended.

C) detailed explanation of core functions

 

 

·Setting method:

 

1. "left and right direction keys": move the bottom,,Project;2. "up and down arrow keys": you can move the anti-white column in the upper frame. if this row has an arrow (--->), it indicates that there are other items in the row to be set;3. select a project: Select the project you want to set with the "up and down keys", and selectThen, press Enter to go to the project for further detailed settings ??? /P>

4. feature to be selected: In the detailed project settings, if there is a [] or <> symbol in front of the project, the project can be selected, and the selection can be selected using the "blank key;

5. if it is [*] <*>, it indicates that it is compiled into the core. if it is It indicates compiling to a module! If you do not know when the project is selected and a module is available, you can directly select it as a module ??? /P>

6. · when selecting a project in detail And press Enter, then you can leave the detailed project ??? /P>

·Explanation

1. General setup

The most relevant program interaction with Linux, core version descriptions, and whether to use the developing code are all set here. The project here is mainly designed for the relevance between the core and the program. basically, keep the default value! Do not cancel any project under it, because it may cause some programs to be unable to be executed at the same time! However, there are many new features. if you have any questions, you can press Go to the page and check out some suggestions! You can choose whether to start a new function based on Help suggestions!

D) compile the command:

· Make vmlinux compilation of uncompressed core

· Make modules: compile the kernel module

· Make bzImage: the core of compiled files after compression

· Make all:

E) install the core and core modules

· Copy the generated core file to the boot directory

· Make modules_install install the core module

1. mkinitrd-v/boot/initrd-2.6.30.3vbird.img 2.6.30.3vbird

· The core version of the Mkinitrd-v target file generates the initrd file

· Modify the grub. conf file to boot the new core.

F) compilation of an additional single module

·Preparations for module compilation

1. Make GCC and other compilation tools

2. Kernel-devel software

· Compilation of a single module

1. some functions in the core are not compiled and need to be compiled by the core source code.

A) the "make menuconfig" command is issued in the directory where the source code is located. no module is set.

B) then make fs/ntfs to compile the required modules.

C) copy the module to the relevant directory.

D) Depmod-a generates dependency

2. functions not in the core need to be compiled by third-party source code

A) decompress the source code

B) compile the source code into the target file.

C) installation module

I. make install

Ii. install-m 744-c r8168.ko/lib/modules/2.6.30.3vbird/kernel/drivers/net/

D) update module dependency informationDepmod-

Related Article

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.