Study Notes on Kernel compilation and Installation

Source: Internet
Author: User

Prerequisites: common tools for viewing local hardware information

View CPU information:

# Cat/proc/cpuinfo

# X86info

# Lscpu

View pci:

# Lspci

View USB:

# Lsusb

View Block devices:

# Lsblk

View the comprehensive device details:

# Hal-Device


Compilation: Cross-Compilation

Cross-Compiling is used for compiling on the host machine and is applied to kernels with different architectures on other machines.


Kernel compilation steps: (install the development environment: development tools, server platform development, ncurses-devel)


Prerequisite 1: Install the development environment

# Yum grouplist

Yum groupinstall development tools

# Yum install ncurses-devel

Premise 2: Download the kernel

# Lftp 172.16.0.1

CD pub/sourcess/sources/kernel

Get linux-3.10.10.tar.xz

Premise 3: Expand the kernel

# Tar xf linux-3.10.10.tar.xz-C/usr/src

Premise 4: view the kernel size

# Du-SH/usr/src/linux-3.10.10/

Prerequisite 5: create a link

# Ln-SV linux-3.10.10 Linux


Note: The following steps are performed in the expanded kernel directory:

Step 1: Configure kernel compilation options

# Make menuconfig

Step 1_1: Copy compilation configuration options

# Cp/boot/config-2.6.32-431.el6.x86_64./. config

Step 2: Use multiple windows to run the compilation

# Screen

Step 3: enable simultaneous compilation of two processes

# Make-J 2

Step 4: Install the kernel module

# Make modules_install

Step 5: Install the kernel

# Make install

Step 6: Check whether any new title appears in grub. conf.

# Cat/boot/GRUB/grub. conf


Before secondary compilation, You need to perform the following cleanup operations:

# Make clean clear the compiled files, but keep the configuration files

# Make mrproper remove all compiled files, configuration files, and backup files

# Make distclean


1. Save the compiled files elsewhere:

# Mkdir/path/to/somewhere

# Cd/path/to/somewhere

#./Config -- ksource =/usr/src/Linux

2. How to compile only part of the kernel code:

(1) Compile only the relevant code in a subdirectory

# Cd/usr/src/Linux

# Make path/to/DIR/


For example:

# Make subdir = ARCH/

# Make Drivers/NET/


(2) Compile only some modules

# Make M = path/to/Dir


# Make M = drivers/NET/

(3) Compile only one module

# Make path/to/DIR/mod_name.ko


For example:

# Make Drivers/NET/Ethernet/Intel/e1000/e1000.ko

(4) Save the compiled files elsewhere

# Make o =/path/to/somewhere


3. Cross-Compilation

# Make arch = Arch

For example:

# Make arch = arm acs5k_defconfig


Obtains available default configurations of an arch.

# Make arch = arch help

For example:

# Make arch = i386 help


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.