In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to compile the Linux kernel", the content is easy to understand, clear, hope to help you solve your doubts, let the editor lead you to study and learn "how to compile the Linux kernel" this article.
Download the kernel
The only thing we need to do is download the kernel source code. Find the URL of the kernel you want to download at Kernel.org. After you find URL, use the following command (I use the 4.17 RC2 kernel as an example) to download the source file:
Wget https://git.kernel.org/torvalds/t/linux-4.17-rc2.tar.gz
There are some things to consider during the download.
The environment required for installation
In order to compile the kernel, we first have to install some of the required environments. This can be done with one command:
Sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
It is important to note that you will need at least the local available disk space of 128GB to complete the kernel compilation process. So you have to make sure there's enough space.
Decompress the source code
In the same folder as the newly downloaded kernel, use this command to extract the kernel:
Tar xvzf linux-4.17-rc2.tar.gz
Use the command cd linux-4.17-rc2 to enter the newly generated folder.
Configure the kernel
Before we can formally compile the kernel, we must first configure which modules need to be included. In fact, there are some very simple ways to configure. With one command, you can copy the current kernel configuration file and then use the reliable menuconfig command to make any necessary changes. Use the following command to do this:
Cp / boot/config-$ (uname-r) .config
Now that you have a configuration file, enter the command make menuconfig. This command opens a configuration tool (figure 1) that allows you to iterate through each available module and then enable or disable modules you need or do not need.
Figure 1: running make menuconfig
There's a good chance you'll disable an important part of the kernel, so take it one step at a time during menuconfig. If you're not sure about an option, leave it alone. Or better yet, use the configuration file of the currently running kernel we copied (because we know it works). Once you've traversed the entire configuration list (it's very long), you're ready to start compiling.
Compile and install
Now it's time to actually compile the kernel. The * step is to use the make command to compile. Invoke the make command and answer the necessary questions (figure 2). These problems depend on the existing kernel you will upgrade and the upgraded kernel. Trust me, there will be a lot of questions to answer, so you have to set aside a lot of time.
Figure 2: answering questions from the make command
After answering the lengthy questions, you can install the previously enabled modules with the following command:
Make modules_install
Here we go again, this command will take some time, so either sit down and watch the compiled output, or do something else (because your input is not needed during compilation). It's possible that you want to do something else (unless you really like watching the output flying over the terminal interface).
Now let's use this command to install the kernel:
Sudo make install
Once again, another order that will take a lot of time. In fact, the make install command takes more time than the make modules_install command. Go to lunch, configure a router, install Linux on some servers, or take a nap.
Enable the kernel as a boot
Once the make install command is complete, it's time to enable the kernel as a boot. Use this command to achieve:
Sudo update-initramfs-c-k 4.17-rc2
Of course, you need to replace the above kernel version number with the one you compiled. When the command finishes, update grub with the following command:
Sudo update-grub
Now you can restart the system and choose the newly installed kernel.
The above is all the contents of the article "how to compile the Linux Kernel". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.