Linux compile core detailed explanation

xiaoxiao2021-03-06  58

Introduction to the kernel   core is the core of an operating system. It is responsible for managing system processes, memory, equipment drivers, files, and network systems, which determines the performance and stability of the system. An important feature of LINUX is the disclosure of its source code, all kernel source programs can be found under / usr / src / linux, most of the applications are also designed with GPL, you can get The corresponding source code code. Any software engineer in the world can add ourselves to the code, and an obvious advantage that is triggered is the rapidness of Linux repair vulnerabilities and the utilization of the latest software technology. The LINUX kernel is the most direct representative of these features. Imagine, what does the source of the kernel do? First, we can understand how the system works. Through the password source code, we can understand the working principle of the system, which is simply in Windows. Second, we can make our own system, and customize the system that is suitable for your own, so you need to recompile the kernel. What is the situation under Windows? I believe that many people have been more and more huge windows. Again, we can modify the kernel to meet your needs. what does this mean? Yes, it is equivalent to developing an operating system, but most of the work is already done, what you have to do is to increase and implement the features you need. Under Windows, unless you are a Microsoft's core technician, you don't want to think. The kernel version number is completely disclosed due to Linux's source program, and anyone can modify and release it to others as long as the GPL is fully disclosed. The development of Linux is a market model (Bazaar, corresponding to CATHEDRAL - church model - corresponding), in order to ensure that these disruptible development processes can be done in an orderly manner, Linux uses a double tree system. A tree is a stable tree, and the other tree is a unsteable tree or a development tree. Some new features, experimental improvements, etc. will be carried out in the development tree. If the improvements made in the development tree can also be applied to stabilizing trees, then the same improvements will be performed in the stabilizing tree after the test is tested in the development tree. Once the development tree has been sufficiently developing, the development tree will become a new stable tree. The number of developments is reflected in the version number of the source program; the source version number is XYZ: For stabilization tree, Y is an even number; for the development tree, Y is more stable than the corresponding stable tree (therefore, odd) ). So far, the highest version of the stable tree is 2.2.16, the latest release of RedHat7.0 is the 2.2.16 core; the latest version of the development tree is 2.3.99. Maybe you have found that there are 2.4.0-Test9-Pre7 kernels on the multi-site, but this is not a formal version. Nuclear version updates can be accessed http://www.kernel.org/. Why is it reconstructing the kernel to LINUX as a free software, with the support of the vast enthusiasts, the kernel version is constantly updated. The new core revised the BUG of the old kernel and added many new features. If the user wants to use these new features, or want to customize a more efficient and more stable kernel according to your own system, you need to recompile the kernel. Usually, the updated kernel will support more hardware, with better process management capabilities, faster running, more stable, and generally repair many vulnerabilities found in the old release, etc., often choose upgrade updates The system kernel is the necessary operational content of the Linux user.

In order to properly set the kernel compilation configuration option, only the code required by the system needs, generally have the following four considerations: the Lord of the Customized kernel is faster (with less code) The                                              For module mode, it is slower than compiled into the kernel. The kernel compilation mode is to increase support for a part of the function, such as the network, can compile the corresponding part into the kernel (build-in), or Compile this part into a module (Module), dynamically called. If you compile into the kernel, you can automatically support the function of the corresponding part when the kernel is started, this advantage is convenient, fast, the machine is started, you can use this part of the function; the shortcomings will make the kernel huge No matter if you need this part of the function, it will exist, this is the tricks used to Windows. It is recommended to use the part to use directly to the kernel, such as the network card. If you compile into a module, you will generate a corresponding .o file, you can dynamically load it when you are using, the advantage is that you won't make the kernel, the disadvantage is that you have to call these modules. Nuclear Compilation Detailed New Version Core Getting and Update   Linux Nuclear Version released official website is http://www.kernel.org/, and some of the domestic FTPs can generally find some versions of the kernel. There are two forms of the release of the new version of the kernel, one is a complete kernel version, and the other is the Patch file, that is, a patch. The complete kernel version is relatively large, such as Linux-2.4.0-test8.tar.bz2 has more than 18m, and users fast online can be downloaded. The complete core version is generally .tar.gz (.tgz) file or .bz2 file, both are files using Gzip or Bzip2, and need to decompress when using. The PATCH file is smaller, usually only tens of k to a few hundred k, very little more than 1m, and the speed of the network speed can use the patch file to upgrade the kernel. But the Patch file is for a specific version, you need to find your own version to use. Compile the kernel requires root permissions, the following operations assume that you are root users. Please copy you need to upgrade to / usr / src / down (hereinafter, the Linux-2.4.0 Test8.tar.gz of 2.4.0 Test8 kernel is the case), command to #cp Linux-2.4.0test8.tar. GZ / USR / SRC let us first check the content of the current / usr / src, note that there is a Linux symbolic link, which pointing to a similar to Linux-2.2.14 (corresponding to the kernel version number you are using )the catalog. First delete this link: #CD / usr / src #RM -F Linux now decompresses the source program file we downloaded.

If the downloaded .tar.gz (.tgz) file, please use the following command: #tar -xzvf Linux-2.4.0test8.tar.gz   If you download it is .bz2 file, such as Linux-2.4 .0Test8.tar.bz2, please use the following command # bzip2 -d Linux-2.4.0test8.tar.bz2 #tar -xvf Linux.2.4.0.test8.tar   now let us look again / usr / src The next content, you will find that there is a directory named Linux, which is the source program we need to upgrade the version of the kernel. Remember the link named Linux? The reason for using that link is to prevent the source process of the original version of the original version of the kernel inadvertently. We also need the same processing: #mv Linux Linux-2.4.0test8 #ln -s Linux-2.4.0test8 Linux, so we also have a symbolic link called Linux, you don't have to worry about overwrite it later (maybe You will feel that the Symbolic link to re-establish Linux is not necessary, but it is actually essential, which will be introduced below). If you have also downloaded the Patch file, such as Patch-2.4.0Test8, you can perform Patch action (below, Patch-2.4.0Test8 is already in / usr / src directory, otherwise you need to copy this file to / usr / src under: #patch -p0

Configuring the kernel can use one of the following commands as needed: #make config (the most traditional configuration interface based on text, not recommended) #make menuconfig (Based on the configuration interface of the text menu, recommended by the character terminal) #make xconfig (Recommended by the configuration interface based on graphic window mode) #make oldconfig (If you only want to modify some small places on the basis of the original kernel configuration, you will save a lot of troubles)   these three orders Make XConfig's interface is the most friendly. If you can use XWindow, then you will recommend that you use this command, the interface is as follows: Figure XCONFIG_MAIN.JPG   If you can't use XWindow, then use make Makefig. Although the interface is better than the above, it is much better than Make Config. The picture is Make MenuConfig interface: MenuConfig_main.jpg   Select the corresponding configuration, there are three options, the meaning representative of them: Y --- Compiling this feature into the kernel N- Do not compile the function into the kernel M - Module compiles this function into the kernel to be dynamically inserted into the kernel, if you use Make Xconfig, you can select the corresponding Options. If you use Make MenuConfig, you need to use the space bar to choose. You will find that there is a bracket before every option, but some are a bracket, and there is a parenthery. When you use the space bar to choose, you can find that in the middle brackets, either "*", and the angle of "*" and "m" indicate that the former corresponds to the kernel, either compile into the kernel The latter is more choice, and can be compiled into a module. The content of parentheses is to select an item in several options provided. In the process of compiling the kernel, the most annoying thing is that this step is working, and many newers don't know how to choose these options. In fact, most of the options can use their default values, only small parts need to be selected according to different needs. The principle of choice is to compile the partial function code that is far from other partial relationships of the kernel, and is used to use the portion of the function code to be loaded to reduce the length of the kernel, reduce the memory consumption of kernel, simplify the corresponding environment changes. The impact of the kernel; do not choose the function; close to the kernel, and often use the partial function code that is used directly into the kernel. Let us introduce the commonly used options. 1. Code Maturity Level Options Code maturity level. There is only one item: prompt for development and / or ibplete code, if you want to test the functionality that is still in the experimental phase, such as khttpd, IPv6, etc., you must choose the item as y; otherwise you can choose it N. 2. Loadable Module Support Support for modules. There are three items in this:                                                                                                                                      . Set Version Information On All Module Symbols: You can don't choose it. Keernel Module Loader: Let the kernel have its own ability to load the required module when starting, and suggest it.

3. Processor type and features   CPU type. There are quite a lot, and it is not one of them. Several as follows:   processor family: Select the CPU type according to your own situation. HuiGh Memory Support: Support for large capacity memory. You can support 4G, 64G, usually not available. Math Emulation: Coprocessor Simulation. The coordinator is the pet in the 386 era, and now it is no longer available. MTTR Support: MTTR support. Optional. Symmetric Multi-Processing Support: Symmetric multi-processing support. Unless you are rich in multiple CPUs, you don't have to choose. 4. General setup   here is the most common attribute settings. This part of the content is very large, usually using the default settings. Here are some options that are frequently used:                    Must, no NIC also suggest you choose. PCI Support: PCI support. If the card of the PCI is used, it is certain. PCI Access Mode: PCI Access Mode. Alternative to BIOS, Direct and Any, choose ANY. SUPPORT for Hot-Pluggabel Devices: Hot-swap equipment support. Support is not too good, you can not choose. PCMCIA / Cardbus Support: PCMCIA / Cardbus support. There is a PCMCIA.   Tem V IPC     programctl support: The above three is the process processing / IPC call, mainly in both SYSTEM V and BSD. If you are not using BSD, follow the default. ProPower Management Support: Power Management Support. ADVANCED POWER Management BIOS Support: Advanced Power Management BIOD Support. 5. MEMORY TECHNOLOGY Device (MTD) MTD device support. Optional. 6. Parallel Port Support   Serial Port Support. If you don't plan to use the serial port, don't choose. 7. Plug and play configuration   Plug and Play support. Although Linux is not as good as Windows for plug and play, but still select it, so you can unplug the mouse to experience the feeling of playback under Linux. 8. Block Devices Support. This will be selected for your own situation, briefly explain it:   Normal PC Floppy Disk Support: Ordinary PC Floppy Pan. This should be necessary.                                                                                 ?         network block device support. If you want to access something on the online neighbors, you choose. Logical Volume Manager (LVM) Support: Logical Volume Management Support. Multiple Devices Driver Support: Multi-device Drive Support. ARM Disk Support: RAM disk support.

9. Networking options   network option. The network protocol is configured here. There are too many content, introduce it, look at it, if you know what to understand the network protocol, you should be able to understand. If you are too lazy, use the default option (you must select TCP / IP Networking oh). Let's see, TCP / IP, ATM, IPX, Decnet, AppleTalk ... supported protocols, IPv6 also supports, QoS and / or fair queueing also supports, and khttpd, but These are still in the experimental phase. 10. Telephony Support   telephone support. What is this stuff? Let me check the help, it is for Linux to support the phone card so you can provide voice service using a normal phone on IP. Remember, phone cards can have no relationship with MODEM. 11. ATA / IDE / MFM / RLL Support   This is a hard disk / optical drive / tape / floppy disk support for various interfaces. It is too much to use the default option. If you use a relatively special device, For example, PCMCIA, etc., come to find the appropriate options yourself. 12. SCSI Support   SCSI device support. I don't have SCSI's equipment, so I don't have to choose at all. If you use SCSI hard drive / optical drive / tape, you can find it. 13. IEEE 1394 (FireWire) What is this? I haven't seen the low version, see help and say. It turned out to be a FireWare hardware to improve the performance of the serial bus, I didn't, I didn't choose. 14. I2O Device Support   This is not clear, the help say is this requires the I2O interface adapter to support, in the intelligent input / output (i2o) system interface, but also hardware, not selected. 15. Network Device Support Support. The above is selected, and now the device is now, it is impossible to know that the content is certain. Fortunately, it is probably classified, with Arcnet equipment, Ethernet (10 or 100 mbit), Ethernet (1000Mbit), Wireless Lan (Non-Hamradio), Token Ring Device, Wan Interface, PCMCIA Network Device Support, Best Class. I use 10 / 100m Ethernet, it seems that I only need to choose this. Still 10 / 100m Ethernet device is familiar, the content is much, you can see the realteck RTL-8139 PCI Fast Ethernet Adapter Support I used, in order to avoid trouble, compiled into the kernel, do not choose M, choose Y . Patience, usually you can find your own network card. If not, you have to go to the manufacturer to drive. 16. Amateur Radio Support is another unknown, it should be to configure the amateur wireless broadcast, no, don't. 17. Irda (Infrared) Support   this infrared support, free. 18. Isdn Subsystem   If you use ISDN to access the Internet, this will not be less. I have a good job.

19. Old CD-ROM Drivers (Not SCSI, Not IDE)   Done, the original, those who are non-SCSI / IDE mouth, who are still use, choose it, anyway, I use the IDE CD- ROM, don't choose this. 20. Character Devices Character equipment. This content is too much, first use the default settings, you need to modify it. Let's introduce a big category:                                                                                                                        If you want to choose the following Video for Linux, this must be selected. Mice: mouse. You can now support bus, serial port, PS / 2, C & T 82C710 MOUSE PORT, PC110 Digitizer Pad, you can choose as needed. Joysticks: Handle. Even if you drive the handle under Linux, it is not too big, and the game is too small. Watchdog Cards: Although it is called Cards, this can be implemented with pure software, of course, has hardware. If you choose this, you will create a file called WatchDog under your / dev, which can record your system's operation, until the system restarts for about 1 minute. With this file, you can recover the status before the system is restarted. Video for Linux: Supports the relevant audio / video card. FTAPE, The Floppy Tape Device Driver: Pcmcia Character Device Support: 21. File Systems   File System. There are too many content, the old man, modified on the basis of the default option. Describe the following: QUOTA Support: Quota can limit the upper limit of the hard disk space you can use for each user, which is very valid in the case of multi-user uses a host. DOS FAT FS Support: Support for DOS FAT file format, FAT16, FAT32 can be supported.         @ Tem Support: The disc use is the file format of ISO 9660. NTFS File System Support: NTFS is the file format used by NT. / Proc File System Support: / proc file system is a channel that Linux is provided to users and systems, and suggests, otherwise some features cannot be executed correctly. There are also three major categories to regulate it here: Network file systems, Partition Types, Native Language Support (local language support). It is worth mentioning that both of the NETWORK File Systems: NFS and SMBs are Linux and Windows to access the file system used by each other in the form of network neighbors, and select as needed. 22. Console Drivers   The console driver. Generally, VGA Text Console is usable, standard 80 * 25 text console. 23. Sound   sound card driver. If you can find the sound card driver in the list, you will try the OSS. 24. USB Supprot                   Many USB devices, such as mice, modems, printers, scanners, etc., can be supported in Linux, and choose it as needed.

转载请注明原文地址:https://www.9cbs.com/read-117961.html

New Post(0)