Linux Kernel Compilation

Source: Internet
Author: User
Article title: Linux kernel compilation. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. how to configure the core?
1.1. obtain the original code
You can obtain the original program code from ftp. funet. fi or mirror in/pub/OS/Linux/PEOPLE/Linus through ftp. You can also get it from mirror or another node on this node. The file name is typically marked as a linux-x.x.x.tar.gz, where x. x. x is the version number. Newer (better ?) Versions and patch files are generally stored in subdirectories such as "v1.1" and "v1.2.
We strongly recommend that you go to the mirror ftp node instead of directly accessing ftp. funet. fi! Below is a brief list of some mirrors and other nodes
(Mirror node of ftp. funet. fi :)
Germany: ftp.Germany.EU.net
UK: doc. ic. ac. uk
Australia: kirk. bu. oz. au
(Other nodes with core files :)
USA: tsx-11.mit.edu
USA: sunsite.unc.edu
Germany: ftp.dfv.rwth-aachen.de
If you have no way to use ftp, a list of BBS systems storing linux will be published on comp. OS. linux. announce on a regular basis and try to find help over there.
1.2. unwrap the original program code
Check that you are logged in as "root" and then cd to/usr/src. If your linux is obtained from any other possible location, a subdirectory named "linux" should already exist under this directory. This is the original linux program code. If you still have disk space and want to play safely, you will want to keep this subdirectory. A good idea is to modify the name of this subdirectory based on your current core version. The "uname-r" command will tell you the new version.
So, if "uname-r" shows "1.1.47," you can change "linux" to "Linux-1.1.47. "If you are a reckless person, clear this subdirectory directly. In either case, you only need to determine that the/usr/src directory does not have the "linux" subdirectory before you unlock all the original program codes.
In the/usr/src Directory, use "zcat linux.x.tar.gz | tar xvf-" to unwrap the original program code (you can also use the simpler "tar zxvf linux.x.x.x.tar.gz?if you get the file .tar (gz is not added in the end ), use "tar xvf linux.x.x.tar "). You will see that the content of the original program has passed away. After it is completed, a new "linux" subdirectory will appear.
"Cd" to the linux directory and then check the README file. There should be a text titled "INSTALLING the kernel" or similar. If appropriate, execute the instructions in the instructions to establish the symbolic link, remove outdated. o files, and so on.
1.3. configure the core
Note: Some of the content here is to repeat or revise the corresponding sections in the README file of Linus. Executing the "make config" command in/usr/src/linux will start a command draft, which will ask you various questions. It requires bash, so make sure bash is/bin/bash,/bin/sh or $ BASH.
You should be prepared to answer these questions now. Generally, you can use "y" or "n. Some obvious or unimportant options will not be described here.
1.3.1. Kernel math emulation (core floating point operation simulation)
If you do not have a mathematical assistant computing processor (ie, you only have one simple 386 or 486SX), you should answer "y" here ″. If you have a mathematical-assisted computing processor but still answer "y", you don't have to worry too much-linux will still use it to ignore the core simulation program. The only difference is that the compiled core is getting bigger.
1.3.2. Normal harddisk support (standard hard drive support)
You almost have to answer "y" here ″. It means that the core will support standard PC disks, such as the IDE interface hard drive used by most people. This does not include support for SCSI devices.
1.3.3. Networking support (network support)
If you have a network connection, for example, you are connected to the internet, or you are going to use SLIP, PPP, term, or other methods to dial to the internet, the answer is "y. ″
1.3.4. Limit memory to low 16 MB (limited memory at 16 MB)
If your memory is less than 16 MB, you almost have to answer "y"; then when you use this core, it will save a little memory. However, of course, if you have more than 16 MB of memory and do not answer "n", this new core will only use 16 MB of memory, even if you have 34 billion megs. There may also be some bad 386 DMA controllers (or something related to hardware) that cannot be correctly located to a memory address larger than 16 megs; if this happens to your machine (rare), then you have to answer "y.
1.3.5. Use-m1_flag for 486-specific optimizations (Use the-m1_flag to specify optimization for 486)
This will optimize the core by 486. The new core will be slightly larger. if you are worried, it can still be executed on 386. It will be slow, but you cannot feel it.
1.3.6. SCSI support (SCSI support)
If you have a SCSI device, answer "y ." There will be a prompt asking for further information, such as whether you want to support optical drive, drive, and the SCSI adapter you are using. For more information about this part, see SCSI-HOWTO.
1.3.7. Network device support (Network device support)
If you have an Ethernet card, or you want to use SLIP, PPP, or side-by-side ports, then answer "y ″, then you will be prompted to ask whether you are using the network card or the serial communication protocol.
1.3.8. Filesystems (file system)
This will prompt you to answer the types of file systems to be supported, including:
Standard (minix)-The new suite no longer creates a minix file system, and many people do not use it, but it is still a good idea to configure it in the core. Some of the "rescue-disk" programs will use it, and there are still many CIDs that may use the minix file system, because the minix file system is the best for processing the disk.
Extended fs-this is the first version of the Extended file system and is no longer used. The time to use is, if you need it, you will know.
Second extented-this is a widely used file system of the new suite, and you may have one.
Xiafs filesystem-This file system was once quite popular, but when I was writing this file, I did not know anyone was using it.
Msdos-well, you guessed it; if you want to use the MS-DOS partition on your hard drive in linux, or you want to mount the disk formatted with a MS-DOS, answer "y ″.
Ums-dos-this is a pretty slick file system that gives MS-DOS file systems more features
Such as long name. This is not useful to people who don't use MS-DOS (like me.
/Proc-this is one of the most slick file systems (I guess this concept was shamelessly stolen from Bell Labs ). It is not anything in your hard drive partition, but a file system interface between the core and the program. Many program tools (such as "ps") will use it.
If you have installed it, try "cat/proc/meminfo" or "cat/proc/devices" if you have time ″. Some shells, such as rc, use/proc/self/fd (/dev/fd on other systems) to process the output. It is almost certain that you have to answer "y" here, and many important Linux standard tools rely on it for operation.
NFS-if you want to share files in a network environment, answer "y. ″
ISO9660-most CDs use this file system.
OS/2 HPFS-when writing this file, the file system only supports reading OS/2 HPFS.
System V and Coherent-this is set for the partitions of System V and Coherent.
1.3.8.1. but I don't know what file systems I need!
Okay, type "mount. It looks like this:
Blah % mount
/Dev/hda1 on/type ext2 (defaults)
/Dev/hda3 on/usr type ext2 (defaults)
None on/proc type proc (defaults)
/Dev/fd0 on/mnt type msdos (defaults)
Take a closer look at each line. The word after "type" is the format of the file system. In this example, my/and/usr partitions are in the second extended format, I have used/proc, and there is a disk in the format of msdos (bleah) as the file system.
If you use/proc, try "cat/proc/filesystems ″. It will give you a list of file systems currently supported by the core.
1.3.9. Character devices (Character device)
Here, you will find many device names used to set your printer, bus mouse, PS/2 Mouse (most laptop computers use built-in PS/2 Mouse ), and some drive programs, selection.
Answer "y" when appropriate options are available ".
Note: "Selection" allows you to execute a program. This program allows you to use a mouse outside X-windows to cut and paste between various virtual consoles. If you have a mouse string, this is really great because it communicates well with X-windows. However, when writing this file, it cannot match the PS/2 Mouse (it will lock the port used by the mouse, making it impossible to execute X-windows before killing the selection program .).
1.3.10. Sound card)
If you are interested in keeping people next door awake, answer "y, then wait for a configuration program to compile and ask you in detail about your sound card.
1.3.11. kernel hacking
> Here is an excerpt from Linus README:
The configuration details of "kernel hacking" usually generate a larger or slower core (or large or slow ), in addition, it may be because some regular configurations are very active to try to interrupt some bad program codes to find out the problems in the core (kmalloc (), which makes the core unstable. Therefore, if you want to generate a core "product", you should answer "n" here ″.
1.4. what about now? (The Makefile)
Now there should be a message telling you that the core has been configured and you want to check the top-level Makefile for additional configuration, "and so on.
Check Makefile. You don't have to change it, but look at it. Once the new core

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.