Table of Contents
Clean up the files generated by kernel compilation
The kernel compilation operation process is as follows
Compile the ntfs.ko module file separately

Kernel compilation steps

Jul 21, 2017 am 09:18 AM
Kernel compile

In the first step, we should first download the kernel software package. You can click to download.

The second step is to unzip the software package corresponding to the linux* version to the current directory. The current directory where I am located is the user's home directory.

1

tar xvf linux-4.12.tar.xz

Copy after login

The third step cd to switch to the decompressed directory, such as cd linux-4.12, and subsequent compilation and installation operations can only be performed in this directory
The fourth step is to copy the system itself Kernel module function text configuration file and rename it to .config

1

cp /boot/config-$(uname -r) .config

Copy after login

The fifth step is to install the development package group

1

yum -y groupinstall "Development Tools"

Copy after login

The sixth step is to perform compilation and use the menu to configure the kernel options. If an error is reported during compilation, follow the The error message prompts you to install the corresponding software package

1

 make menuconfig

Copy after login

The seventh step is to compile the kernel. The compilation process is a bit long. Please wait patiently and do not terminate the operation.

1

make -j 2   使用2个CPU多线程同时编译

Copy after login

The eighth step is to install the software package according to the error prompt. As shown below

Kernel compilation steps
prompts to install openssl-devel software package

1

yum -y install openssl-devel  根据错误提示安装相应的软件开发包

Copy after login

Step 9 and then continue to compile make -j 2
Step 10 After the compilation is completed, update the database, and then you can check whether the module we compiled into the kernel was successful

1

2

updatedb   更新数据库

locate ntfs.ko  查看我们编译进内核的ntfs模块是否存在于内核中

Copy after login

The eleventh step is to install and copy the module file. The installation process is a bit long, please wait patiently

1

make modules_install

Copy after login

Step 12 Copy the kernel to the /boot directory and modify the grub file. Make will report an error when executing. If an error is reported, install the corresponding software package according to the prompts

1

2

3

make install 将内核拷贝到/boot目录下并修改grub文件

 

报错信息如下

Copy after login

Kernel compilation steps

1

2

yum -y install elfutils-libelf-devel  安装elfutils-libelf-devel包

make install  继续执行

Copy after login

Step 13 Check whether the vmlinuz-4.12.0-danran kernel file and grub.cfg or grub.conf files have been changed in the /boot directory

1

2

/boot/vmlinuz-4.12.0-danran  

cat /boot/grub2/grub.cfg 查看grub配置文件,里面多了一个新内核菜单

Copy after login

Kernel compilation steps

Step 14 Reboot the system and select the new kernel to start

Clean up the files generated by kernel compilation

1

2

3

4

cd linux-4.12

make clean:清理大多数编译生成的文件,但会保留config文件等;

make mrproper:清理所有编译生成的文件、config及某些备份文件

make distclen:mrproper、patches以及编辑器备份文件

Copy after login

The kernel compilation operation process is as follows

  1. Download the corresponding software package for linux*

  2. tar xvf linux-4.12.tar.xz Unzip the kernel to the current directory

  3. cd linux-4.12

  4. cp /boot/config-3.10.0-514.el7.x86_6 .config Copy the system's own functional configuration file to the kernel decompression directory and name it .config

  5. ls .config

  6. yum -y groupinstall "Development Tools" Install Development Tools development package group

  7. make menuconfig Open the graphical function configuration interface
    Kernel compilation steps

  8. #If an error is reported in the previous step, follow the error prompts to install the corresponding software package, eg ncurses-devel software package

  9. Modify the kernel version number to danran
    Kernel compilation steps
    Kernel compilation steps
    Kernel compilation steps
    Kernel compilation steps

  10. ##Add kernel support for ntfs function


    Kernel compilation steps
    Kernel compilation steps
    Kernel compilation steps

  11. ##vim .config Check the configuration file to confirm whether the ntfs function is enabled and whether the kernel version number has changed
  12. lscpu Check the cpu information and the number of cpu cores
  13. make - j 2 Edit the kernel

  14. Install the corresponding software package according to the compilation error prompt

  15. As shown in the picture above, it prompts to install the openssl-devel software packageKernel compilation steps

  16. yum -y install openssl-devel Install the corresponding software development package according to the error prompt
  17. yum -y install elfutils-libelf-devel

  18. make -j 2 Continue to compile, the compilation time is a bit long, please wait patiently, do not terminate
  19. updatedb Update database
  20. locate ntfs.ko Check whether the ntfs module we compiled into the kernel exists in the kernel

  21. Kernel compilation steps

  22. make modules_install installation Copy module files, please wait patiently for the copying process

  23. Kernel compilation steps

  24. cd /lib/modules
  25. find 4.12.
  26. .danran/ -name "

    .ko" View all ko module files in the newly compiled kernel

  27. cd /root/linux-4.12
  28. make install Copy the kernel to the /boot directory and modify the grub file. Make will report an error when executing. Install the corresponding software package according to the prompts
    Kernel compilation steps

  29. yum -y install elfutils-libelf-devel Install elfutils-libelf-devel package

  30. ll /boot/vmlinuz-4.12.0-danran View the files in the /boot directory Generate vmlinuz-4.12.0-danran kernel file

  31. cat /boot/grub2/grub.cfg Check the grub configuration file, there is a new kernel menu
    Kernel compilation steps

  32. #reboot Reboot the system and select the new kernel to start

  33. ls linux-4.12/fs/ntfs/ntfs.ko Check whether the ntfs module is installed

Compile the ntfs.ko module file separately

  1. cd linux-4.12 Enter the kernel directory

  2. make fs/ntfs/ntfs.ko Recompile the ntfs.ko module file

  3. ll fs/ntfs/ntfs.ko Check whether the ntfs.ko module file is compiled and generated

  4. cp fs/ntfs/ntfs.ko /lib/modules Copy module files individually to /lib/modules
    Kernel compilation steps

Kernel related knowledge Please click the link

The above is the detailed content of Kernel compilation steps. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

C++ compilation error: undeclared identifier, how to solve it? C++ compilation error: undeclared identifier, how to solve it? Aug 22, 2023 pm 03:34 PM

When programming in C++, we often encounter the problem of undeclared identifiers. This usually occurs when undefined variables, functions, or classes are used, causing the compiler to fail to recognize these identifiers, resulting in compilation errors. This article describes common causes of undeclared identifier problems and how to resolve them. Common Causes Undeclared identifier problems usually arise from the following reasons: Variables, functions, or classes are not declared correctly: You should declare variables, functions, or classes before using them. If the variable is not declared or function

Why does Linux need to compile source code? Why does Linux need to compile source code? Mar 17, 2023 am 10:21 AM

Reasons: 1. There are many versions of Linux, but each version uses different software or kernel versions, and the environment that the binary package depends on may not be able to run normally, so most software directly provides source code for compilation and installation. 2. Easy to customize to meet different needs. 3. Convenient for operation and maintenance and developer maintenance; source code can be packaged as binary, but packaging this software will require costly extra work, including maintenance, so if it is source code, the software manufacturer will maintain it directly.

How to install the Linux kernel on Ubuntu 22.04 Detailed tutorial! How to install the Linux kernel on Ubuntu 22.04 Detailed tutorial! Mar 01, 2024 pm 10:34 PM

To install the Linux kernel on Ubuntu22.04, you can follow the following steps: Update the system: First, make sure your Ubuntu system is the latest, execute the following command to update the system package: sudoaptupdatesudoaptupgrade Download the kernel file: Visit the official Linux kernel website () to download Required kernel version. Select a stable version and download the source code file (with .tar.gz or .tar.xz extension), for example: wget Unzip the file: Use the following command to unzip the downloaded kernel source code file: tar-xflinux-5.14.tar. xz install build dependencies: Install the tools and dependencies required to build the kernel. Execute

Compilation and decompilation techniques in Java Compilation and decompilation techniques in Java Jun 09, 2023 am 09:43 AM

Java is a very popular programming language that is widely used to develop various types of software. In Java development, compilation and decompilation technology are very important links. Compilation technology is used to convert Java code into executable files, while decompilation technology allows one to convert executable files back into Java code. This article will introduce compilation and decompilation techniques in Java. 1. Compilation technology Compilation is the process of converting high-level language (such as Java) code into machine language. in Java

Why does my Go program take longer to compile? Why does my Go program take longer to compile? Jun 09, 2023 pm 06:00 PM

In recent years, Go language has become the choice of more and more developers. However, compared to other programming languages, the compilation speed of Go language is not fast enough. Many developers will encounter this problem when compiling Go programs: Why does my Go program take longer to compile? This article will explore this issue from several aspects. The compiler architecture of Go language The compiler architecture of Go language adopts a three-stage design, which are front-end, middle layer and back-end. The front-end is responsible for translating the source code into intermediate code in Go language, and the middle layer will

C++ compilation error: The function parameter list is too long, how to solve it? C++ compilation error: The function parameter list is too long, how to solve it? Aug 21, 2023 pm 11:19 PM

C++ compilation error: The function parameter list is too long, how to solve it? When writing programs in C++, you sometimes encounter such a compilation error: the function parameter list is too long. For C++ beginners, this may be a headache. Next, we’ll cover the causes and solutions to this problem. First, let's take a look at the basic rules of C++ function parameters. In C++, function parameters must be declared between the function name and the opening parenthesis. When you pass a function parameter, you tell the function what to do. These parameters can be any

Modify Linux kernel startup sequence Modify Linux kernel startup sequence Feb 23, 2024 pm 10:22 PM

Modify the kernel startup sequence of Linux 1. Modify the kernel startup sequence of RHEL6/CentOS6. Check the /etc/grub.conf file to determine the system kernel situation. According to the document, there are two kernel versions in the system, namely 2.6.32-573.18.1.el6.x86_64 and 2.6.32-431.23.3.el6.x86_64. Kernel versions are listed from top to bottom. In the grub.conf file, you can decide which kernel version to use when the system starts by adjusting the default parameters. The default value is 0, which means the system will boot the latest kernel version. A value of 0 corresponds to the first content listed in the grub.conf file.

Can go language be compiled? Can go language be compiled? Dec 09, 2022 pm 06:20 PM

The go language can be compiled. Go language is a compiled static language, a programming language that requires compilation to run. There are two commands for compiling Go language programs: 1. "go build" command, which can compile Go language program code into a binary executable file, but the binary file needs to be run manually; 2. "go run" command, The Go language program will be run directly after compilation. A temporary file will be generated during the compilation process, but an executable file will not be generated.

See all articles