Slackware official kernel source code to build your own Kernel

Source: Internet
Author: User

 

Abstract:

Use the kernel source code and scripts officially provided by Slackware to create a kernel suitable for your own machine, learn to compile the kernel and improve our learning and work efficiency;

Preface:

The current machine configuration is getting higher and higher. a small notebook may also have 2 GB of memory. In addition, server applications often use large memory. From the perspective of practice, slackware uses the default kernel, which does not support large memory. It supports a maximum of 800 mb and may not reach 1 GB. In addition, Slackware does not support multiple CPUs by default. If you have multiple CPU machines, you must compile the kernel;

The solution is extremely simple to allow Slackware to support machines with 1 GB or more memory. We need to re-compile the kernel so that it supports 4G. Of course, if there is more than 4 GB, you can select the 64 GB one.

To enable Slackware to support multi-CPU machines, it is nothing more than to enable it to support SMP When configuring the kernel, which is the [*] Symmetric multi-processing support option;

It is not enough to explain how to solve the problem. If an article does not operate on an instance, it is really difficult for novice students to read it. I write all my articles to new users. I am afraid that new users will not understand the articles I have written. They are not worth reading for old birds, I think what I write is worthless. Therefore, when I write something in detail, it is best to write it to the first Linux brother to read the document I wrote, it can also be completed in one step.

This article is suitable for beginners

The best way to compile the kernel in the Slackware system is to use the existing official resources of Slackware for compilation. If other software encounters problems, if Slackware has official resources, we can also use this solution;

After all, it is still a little hard to configure the kernel by downloading it directly. It may take a long time to configure Linux for beginners, but it cannot be guaranteed. Therefore, our followers of slack should make full use of Slackware resources.

Anyone with kernel compilation experience knows that if the compilation is successful after preparation. save the config file so that you can re-compile the kernel of the same version next time to solve some minor problems;

Believe in Slackware and trust Slacware's official resources. This will give us half the effort, especially for Slackware beginners. In fact, Slackware Kernel updates are not very positive, which is related to Slackware's traditional (Security. In fact, in general, we have a stable enough kernel. If it is not to solve specific problems, we do not need to upgrade it all day long. When I write this article, the kernel version of Slackware 10.1 is 2.4.29, while the test kernel of current (that is, the development version) is 2.6.12.3. In this case, Slackware is not a new owner, but mainly based on security and stability;

In this article, we will use the test kernel of Slackware's current to briefly describe the benefits of slackware's official resources, and solve the problems of large memory support by the way;

1. Download the source code of the official current testing kernel;

Address:

Ftp://slackware.mirrors.tds.net/pub/slackware/slackware-current/testing/source/linux-2.6.12.3/

Find the image from the address above. Generally, the US and Japan are faster;

For example, we get the source code directory of testing kernel linux-2.6.12.3 through the address below;

We need to download everything in it. The installation packages provided by Slackware are compiled and generated through these files. All people have written the configuration files and scripts, so we do not need to use them;

For example, all the linux-2.6.12.3 files in our FTP image are stored in/usr/src/kernel26 according to the directory structure provided by FTP;

The download is complete. Let's proceed to the next step;

2. Use the config file officially provided by Slackware to configure your own Kernel configuration file. config;

1. decompress the kernel and perform some basic work;

Bash-3.00 # pwd

/Usr/src/kernel26

Bash-3.00 # ls

Config-2.6.12.3 kernel-generic linux-2.6.12.3.tar.bz2.sign

Kernel-modules linux-2.6.12.3.tar.bz2

Bash-3.00 # tar jxvf linux-2.6.12.3.tar.bz2

Bash-3.00 # mv linux-2.6.12.3 .. move the unzipping hand kernel directory to the upper-level directory, that is,/usr/src

Bash-3.00 # cd ..

Bash-3.00 # ls

Kernel26 linux-2.4.29 linux-2.6.12.3.tar.bz2 speakup-2.4.29

Linux linux-2.6.12. 3 rpm

Bash-3.00 # cd linux-2.6.12.3

Bash-3.00 # pwd

/Usr/src/linux-2.6.12.3

Bash-3.00 # cp ../kernel26/config-2.6.12.3. Copy the Kernel configuration file to the current working directory linux-2.6.12.3

Bash-3.00 # cp config-2.6.12.3. config replicate config-2.6.12.3 to. config

2. Briefly configure the kernel;

Bash-3.00 # make menuconfig enters the Kernel configuration mode;

There are two Kernel configuration methods: one is directly placed into the kernel; the other is compiled into modules; the two methods have their own advantages; directly compiled into the kernel, such as the startup of the device, the process of Loading modules is no longer required. Compiling modules requires Loading modules supported by the kernel of the device. However, it is not feasible to directly compile everything into the kernel, the kernel size will increase, and the system load will also be too heavy. When compiling the kernel, it is best to include the most important data into the kernel. If you do not understand anything else, you 'd better use the default value. Slackware Kernel configuration file is the best tutorial;

1] Move the keyboard, select the Load an Alternate Configuration File item, and call. config to facilitate our Configuration. Because this Configuration File is configured by Slackware, we just need to modify it a little.

2] modify the existing problems of your machine. For example, we mentioned the large memory support problem in the previous article;

Select the CPU of your machine;

Move the keyboard to Processor type and features ---> and press ENTER;

Find Processor family (486) ---> press ENTER to ENTER;

After entering, we found that there are a lot of CPU models available; in general, according

Bash-3.00 # select the output information of cat/proc/cpuinfo. For example, if we are from the celon (P4) generation, we should select the following, of course, the default 486 version can also run normally. Since we re-compile the kernel, We have to select the corresponding model, which may improve the performance;

Processor family (Pentium-4/celon (P4-based)/Pentium-4 M/Xeon)

Supports large memory. If the memory is 1 GB or above, but less than 4 GB, 4 GB is required. If the memory exceeds 4 GB, 64 GB is required;

High Memory Support (4 GB) --->

(X) 4 GB

() 64 GB

There are also hardware such as sound cards that need to be viewed step by step. If there is something unknown, we need to press [shift] +? To view the description. In general, the config file of slackware has been configured. You just need to check it.

Another example: for example, if I use intel ac97 sound card, how should I configure it?

First, you need to know the chipset of your sound card. We need to check it through lspci-v;

Bash-3.00 # lspci-v

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.