Method of linux Compiling Kernel

  • 2021-07-24 12:08:16
  • OfStack

1. Download the required kernel version

2. Upload to the operating system

3. Extract to the/usr/src directory

For example: 3.19 kernel

tar -xvf linux-3.19.tar.xz -C /usr/src

4. Create a connection

cd /usr/src

ln -sv /usr/src/linux-3.19 Linux

5. Set up the kernel

cd /usr/src/linux

make menuconfig

In this step, it is best to copy a previously run. config file and modify it, otherwise, it may not restart.

For example, this is the following:

cp /boot/config-3.10.0-123.el7.x86_64 /usr/src/linux/.config

6. Compile the kernel

make-maybe 1 hour to 3 hours.

make modules_install

make install

7. Restart.

Content extension

Deploy kernel source code

Open the terminal and change the user rights to root. The specific method is to enter sudo su at the terminal, and then press the prompt to enter the password. Judge whether it is root. The user uses whoami command, and if the output is root, he has switched to root account.

Enter mv linux-2. 6.36. tar. gz/usr/src to move the downloaded kernel source code file to the/usr/src directory.

Enter cd/usr/src to switch to this directory.

Enter tar zxvf linux-2. 6.36. tar. gz to extract the kernel package, and the generated source code is placed in the linux-2. 6.36 directory.

Enter cd linux-2. 6.36 to switch to this directory.

Enter cp/boot/config-, then press Tab, and the system will automatically fill in the qualified file name in this directory, and then continue to enter. config to use the original configuration file in the boot directory.


Related articles: