For the preface: Who is the reader of this article?
Not used to reading English materials non-Linux masters
The sound card is not connected to the optical drive, and it is not connected to the Internet. As long as there is a problem.
Develop embedded operating system
Now the built-in ODL (Only Disk Linux) is a kernel section, and those articles do not introduce this content. I'm doing
After completing the finishing information.
By The Way, want to be a Linux master? You need to master Keernel Compile, XConfigrater
, LinuxConfig, Samba four warefur, you can always find a large number of related materials in the last three, but kernel compilation
I have to smash all in English.
The author takes time, collects and organizes a lot of information, after 18 hours before children's holiday, give the little penguin this
Gift.
The author believes that the most complete Chinese information in Kernel compilation (will constantly translate supplement), this is
Where is the industry?
Why do you want to put online? First of all, the information is too difficult to find this, and the article will help the Linux enthusiasts. its
Take it, take it on the network.
Welcome to this article, please quote casually, this is in line with Linux free software, but don't forget to mention me.
The name, even if I pay for my hard work.
There is less information between kernels, please add and modify content in this article, but don't delete too much, the author column
Table should join your name, let us work hard to turn it into hundreds of pages. OK, make a friend, I am jade
Yu An, Email: Ziboyuyuan@263.net
table of Contents
Preface
Chapter 1 Basis of Nuclear Compilation
Introduction to the first quarter
Second section core version
Section III Compilation Cause
Section 4 Preparation Work
Chapter II Process
The first section is compiled
The second section configuration kernel {core content}
1. Code maturity level
2 .. Processor Types and Features
3. Support for modules
4. Basic choice
5. Plug and play support
6. Block equipment support
7. Network Options
8. Telephone support
9. Support for SCSI equipment
10.I2O interface adapter
11. Network equipment support
12. Configure amateur radio broadcasts
13. Infrared support
14.ISDN's file system
15. Old CD-ROM Type (optical drive of non-IDE interface)
16. Character device
17.USB support
18. File system
19. Console driver
20. Sound card driver
21. Keernel Hacking
Section 3 compile the kernel
Section 4 to enable the kernel
Appendix: LILO analysis
Chapter 3 Application of Nuclear Compilation
First section embedded Linux technology
Section 2 Your linux has more (and practical results)
Conclude
references
Preface
In recent years, Linux has a big way, so that the user who is dissatisfied with the Windows blue screen is eager to try, and the result is found that Linux installation is not
And Windows is convenient, the interface is not as friendly, the configuration is not easy, the software is not easy, and the software is rich in Windows.
So that you will try it.
In fact, Linux has two advantages of Windows unparalleled: network applications and embedded technologies, which is the most future
Have the direction of the future. At the same time, this topic is an important component of the in-embedded Linux operating system device to theoretically design.
Minute.
If you need to get involved in these two aspects, you must have a deep understanding of the kernel. Of course, you can start from the source code, but premise
It is a professional knowledge such as program design and operating system. Otherwise, you will use the ready-made Linux kernel from
Compile the kernel. Unfortunately, the information on kernel compilation is lacking. The above two reasons have written this paper
Be necessary. I can be confident that this is the most detailed Chinese information in the most detailed kernel compilation. It is worth mentioning that in the process of collecting translation materials, I get the operating system, program design, hardware equipment,
The knowledge of all parties such as network communications, greatly broadening the field of view, and truly learned.
Thanks to all people who contribute to Linux, thank all Linux Chinese websites to promote Linux in China.
Make unremitting efforts, they are the source of me to collect information.
Special thanks to my instructors - Professor Guan Bang and Dr. Gao Bin, are their hard work to make me successfully completed
Graduation Project.
Western Electric University: Li Yuyuan 2001/6/1
Remarks: # ---------- After the heel
## ---------- There is more details
Note ------ Practice results
Chapter 1 Basis of Nuclear Compilation
Introduction to the first quarter
The kernel is the core of an operating system, which is responsible for managing the process, memory, equipment driver, files, and
The network system determines the performance and stability of the system. It is like IO under DOS. Sys and msdos. Integration of sys, I
They can call these two files in the core of DOS. Linux also has its core, usually in the root directory, one called VM
Linuz file. We use this file to control our entire PC, including peripheral equipment and hard disk, CD-
ROM, sound card, etc. Simply put, the core is the operating system itself. No, it is like an unattended home, no
Some people will maintain this movement. A stable home requires a very useful owner that can be interrupted:
The brain also needs a very efficient core, which is the operating system. Therefore, the core is maintained throughout the system.
The essential.
An important feature of Linux is the disclosure of its source code, all kernel source programs can be in / usr / src /
Looking down under Linux, most of the applications are also designed with GPL, you can get the corresponding source process
code. Any software engineer can join the code you think of excellent, thereby triggeting a clear
The advantage is the rapid rise of Linux repair vulnerabilities and the utilization of the latest software technology. The kernel of Linux is this
The most direct representative of some characteristics.
Imagine, what does the source of the kernel do? First, we can understand how the system is
work. Through the password source code, we can understand the system's working principle, which is simply in Windows.
Night. Second, we can make the system, the measurement, and customize the system that is suitable for you.
Rebate the kernel. What is the situation under Windows? I believe that many people are more and more huge windows.
Inexplicably. Again, we can modify the kernel to meet your needs. what does this mean? No
Wrong, 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 core technician of Microsoft, otherwise it will not
I am thinking about it.
First introduce the option to compile the core, I hope to eliminate the mysterious feelings of the kernel.
1. Code maturity level
2 .. Processor Types and Features
3. Support for modules
4. Basic choice
5. Plug and play support
6. Block equipment support
7. Network Options
8. Telephone support
9. Support for SCSI equipment
10.I2O interface adapter
11. Network equipment support
12. Configure amateur radio broadcasts
13. Infrared support
14.ISDN's file system
15. Old-type CD-ROM type (optical drive of non-IDE interface)
16. Character device
17.USB support
18. File system
19. Console driver
20. Sound card driver
21. Keernel Hacking
Second section core version
Since Linux's source program is completely disclosed, anyone can modify and release it for the kernel as long as the GPL is followed. The development of Linux is a market model (Bazaar, with cathedral - church model - corresponding
To ensure that these disorderly development processes can be performed in an orderly manner, Linux uses a double tree system. A tree is stable
Stable Tree, another tree is a nonstal stable tree or developing a tree (developm
ENT Tree). Some new features, experimental improvements, etc. will be carried out in the development tree. If in the development tree
The improvement of doing can also be applied to stabilization trees, then after the test is tested in the development tree, the same will be performed in the stable tree.
improvement of. 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 form of the source program version is x.y.z: For stable trees, Y is an even number;
When the tree, Y is better than the corresponding stable tree (so, odd). OK is to check in as "root",
Then CD to / USR / SRC. Uname -r This instruction will display the version. Update of the kernel version can be accessed TTP: //www.kernel.org/>. Section III Compilation Cause As a free software, Linux has been continually updated with the support of the majority of enthusiasts. New core revision The old kernel's bug has increased many new features. If the user wants to use these new features, or want to The system is systematically customizes a more efficient, more stable kernel, requiring the kernel. Typically, the updated core will support more hardware, with better process management capabilities, run faster, more stable. Type, and generally fix many vulnerabilities found in the old release, and often select the system kernel for the upgrade update. The need for Linux users. In order to properly set the kernel compilation configuration option, only the code required by the system is compiled, the general master There are four considerations below: --- ourselves to customize the built kernel run faster (with less code) --- System will have more memory (the kernel section will not be swapped into virtual memory) --- Unexpected function compiling into the kernel may increase the vulnerability utilized by the system attacker --- Compile some function to module mode to be slower than compiled into the kernel The above is for mature Linux kits, such as Redhat Linux, my purpose is to build an embedded Linux operating system. Preparation is also the way. Section 4 Preparation Work The first part of the new version kernel gets and updates The official website published by the Linux kernel version is < Http://www.kernel.org/>, the major FTPs in China can generally To find some version of the kernel. There are two forms of the release of the new version of the kernel, one is a complete kernel version, The other is a patch file, ie patch. The complete kernel version is relatively large, such as Linux-2.4.0-Test8.tar.b Z2 is 18m more. The complete kernel version is generally .tar.gz (.tgz) file or .bz2 file, both It is a file using Gzip or BZIP2 to compress and need to be unzipped when used. Patch file is relatively small, general Only dozens of k to hundreds k, very little will exceed 1m. But the Patch file is for a specific version, you need to find it. The corresponding version can be used. Compile the kernel requires root privileges. Copy the inner copy to / usr / src / under the upgrade (Take the Linux-2.2.16Tar.gz of 2.2.16), command is #CP Linux-2.2.16Tar.gz / USR / SRC First look at the content of the current / usr / src, note that there is a Linux symbolic link, it points to a similar to Linux -2.2.14 (corresponding to the current list of kernel version numbers used). First delete this link: #CD / USR / SRC #RM -F Linux Now extract the downloaded source program file. If the downloaded .tar.gz (.tgz) file, use the command: #tar -xzvf linux-2.2.16tar.gz If downloaded is .bz2 file, such as Linux-2.2.16Tar.bz2, use command # bzip2 -d Linux-2.2.16tar.bz2 #tar -xvf linux-2.2.16tar Now let's take a look at the content under / usr / src, I found that now has a directory called Linux, it is needed. The source program of the upgrade to the version of the kernel. Remember the link named Linux? The reason why the link is used It is to prevent the original version kernel source process to cover the source program of the original version of the core when the kernel is upgraded. Now also need deal with: #mv Linux Linux-2.2.16 #LN -s Linux-2.2.16 Linux If you also downloaded a Patch file, such as PATCH-2.2.16, you can perform Patch operation (below, Patch- 2.2.16 is already in the / usr / src directory, otherwise you need to copy the file to / usr / src first): #PATCH -P0 The second part prepares the master board and related hardware instruction manual In fact, it is not too detailed. Just know which type of hardware belongs to your hardware. For example: there is a SCSI card, Then you have to know the name of this card, there is a CD-ROM, you know which brand of this CD-ROM drive is standard. The quasi-Ide / ATAPI interface, or another exclusive interface card? Or, whether the host version supports Triton chip (through There are often more than 586 computers that can help us, making it clear and easy. Therefore, no matter what manual you have, ready. Even now, it will still be used in the future (X-W The manual of the card is displayed when Indow System is displayed). The third part checks the IRQ setting of the sound card and its species If you are equipped with a sound card, in addition to knowing the type of the card (for example, Sound Blaster), you need to know this card. IRQ address. In general, the IRQ address of the Luga is 5 or 7 and the IO address is 220. DMA is L, but sometimes The same sound card may have different settings. Because in the later option, you will be filled in these numbers. Part IV Compilation Core Hardware Demand When compiling the core, make sure your RAM is preferably 8MB above, otherwise it may be very slow and there are many problems, remember to check See if swap is open (with free instructions). In addition, it is best not to overclock, otherwise it is likely to happen. 11 The error makes the core stopped, and the compilation core is like the compiler, it is only because There are too many programs that make up the core, so we can be careful as possible. Chapter II Process Overview of compiled processes: Compilation start ----- make mrproperty; check the required connection Configure core Compilation core Edit /etc/lilo.conf Restart the new core Restart the machine Discover and repair the fault (see my article carefully, there should be not much problem) The first section is compiled The first command that usually run is: #CD / USR / SRC / Linux #make mrproperty This command ensures that there is no incorrect target in the source code directory .o file and the mutual dependence of the file. If you use just downloaded The complete source program package is compiled, and this step can be omitted. And if these source programs have been used multiple times, they use these source programs. So, you should first run this command. Make sure the ASM, Linux, and SCSIs such as / usr / include / directory are the kernel source code to which you want to upgrade. it They have chained the real, the computer architecture (for the PC, using the system knot for the PC The real include subdirectory required for I386). Such as: ASM pointing / usr / src / linux / include / asm -i386 and so on. If there is no such link, you need to manually create, follow the steps below: # cd / usr / include # rm -r ASM Linux SCSI # ln -s / usr / src / linux / include / ASM-i386 ASM # ln -s / usr / src / linux / include / linux linux # ln -s / usr / src / linux / include / SCSI SCSI This is a very important part of the configuration. Remove the ASM, Linux and SCSI links under / usr / include links The new link points to the directory of the same name in the new kernel source code directory. These header files contain a guarantee core The important header files needed correctly on the system. Also, I also created a name in the "more" place under / usr / src. One of the reasons for linking for Linux. Once all things, go to / usr / src / linux. Now you may want to stop reading the document file, actually If you have some special hardware, or several optical drive drives need you to do it yourself, they usually do this, when When booting, these drivers will give a warning, which does not work less as usual, reading the extension is .txt .h. C file. Usually I found them with common and easy configuration. If you don't want to take risks, you don't have to do it. Remember you Moiler can unwave the TAR file (or install the .rpm file again) to restore the file before recovering. The second quarter configuration kernel core content The next core configuration process is more cumbersome, but the appropriate configuration is directly related to the running Linux running, It is necessary to understand the settings of the option. Configuring the kernel can use one of the following commands as needed: #make config (Based on the most traditional configuration interface of the text, not recommended) #make menuConfig (Based on the configuration interface of the text menu, the character terminal is recommended, you must have NCURSE S-DEV and TK4-DEV libraries) #make Xconfig (Recommended User Based on Graphics 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 trouble. ) If you can't use XWindow, you will use make menuconfig. Although the interface is better than the above Point, there is much better than make config. When you select the appropriate configuration, there are three options, which represent the meaning of each other as follows: Y - compile this function into the kernel N-- Do not compile this function into the kernel M - compile this function into modules that can be dynamically inserted into the kernel during need. There is a bracket before every option, but some of the brackets are angry brackets, and there is a cracker. Space When the key is selected, it can be found that in the middle brackets, or "*", and the anglene brackets can be empty, "*" and "m". This means that the items corresponding to the former are either, either compile into the kernel; the latter will choose the same, can be compiled Piece. The content of parentheses is to select an item in several options. During compiling the kernel, the most annoying thing is that this step is working, it is unclear how to choose these Options. In fact, most of the options can use their default values, only small parts need to be different depending on the user. Need to choose. The principle of choosing is partial function code that will be far from other parts of the kernel and not often used. Translation becomes the loadable module, which facilitates the reduction of the length of the kernel, reducing the memory of kernel consumption, simplifies the corresponding The impact of the kernel during the environment; there is no need to choose the function; close and often used by the kernel The component code is compiled directly into the kernel. The following is an introduction to the options.