A little bit of kernel compilation experience

Source: Internet
Author: User
Article Title: A little experience in compiling the kernel. 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.
I was shocked when I first heard of the core compilation. I thought LINUX was so terrible. First, I had to compile the core myself...
I tried it myself later, but it is not complicated. I just need to find some documents.
  
1. Core source program:
I am now using TLC, REDHAT, and SLACKWARE. in either case, the core source program is put under/usr/src/linux, because some other applications may reference header files from this path during compilation. in general, this linux directory is just a symbolic connection, there is a little bit like WIN under the cut, but in fact it corresponds to the directory may be/usr/src/linux-2.0.35 and so on. the default RedHat installation does not seem to contain the source program, but only some header files.
Taking the current 2.2.5 core as an example, this is what I installed (in fact, all versions are the same :)
Cd/usr/src
Rm linux
# This linux is just a symbolic connection, and it's okay to delete it. You can check it with ls-l. If you see this:
# Linux-> linux-XXXXX indicates that it is a connection. The original source program is located in the directory after the arrow.
Tar zxvf XXXXXXX/linux-2.2.5.tar.gz
# After this package is unwrapped, the new core source program will be placed under the newly established linux Directory, which is a real price
# Real directory.
Music linux linux-2.2.5
Ln-s linux-2.2.5 linux
# By convention, another directory name should be created and a linux Symbolic connection should be made again.
Now the source program is ready.
  
2. Prepare for compilation:
Now we have to make some preparations. We have nothing to do with the newly released core source code, so let's create one:
Cd/usr/src/linux
Make menuconfig
  
Then you will see a very friendly interface (in LINUX... it is already very friendly). In general, it is a bit like selecting the installation project during Windows 9X installation. this is in the configuration core, select what content is required, what is not.
Slowly:
  
Code maturity ......
After you press enter, there is only one item, asking whether to list development/or unfinished Code in the following options/
The driver. No matter what it is, do not select it.
  
Processor type ......
Select the CPU type. There are four items after the entry:
Processor family: Press enter to select the CPU type (I don't know why to put PPro and 6x86MX in
Together );
Math emulation: Co-processor simulation, of course not selected (you will not still use the 386 without FPU );
MTRR: do not understand: PP, regardless of it, is not selected by default;
Symmetric ......: if you have two or more CPUs and are installed on the same motherboard, select;
  
Loadable module support:
Support for the module. The module is a good thing. Many friends are asking about the driver of the NIC sound card. There are modules.
In fact, it is easy to handle. There are three items:
Enable loadable...: Of course;
Set version...: it seems that it is used to enable the core to mount modules of different versions;
Kernel module...: enables the core to load required modules at startup. Choose from it;
  
General setup:
There are a lot of things in it, and my method is not changed, with the default;
  
Plug and Play ........:
Famous Plug and "Pray", hey. choose it;
  
Block devices:
If you choose a device driver, you can change it by default.
Ideka), But I removed the "Listen 640" and "RZ1000" items, because I don't recognize them, it
We do not recognize me either. We also want to add "Loopback device" into the core content
Or modules.
  
On-site explanation:
There is a bracket before each option, but some are brackets and some are angle brackets. when using the space key, you can find that the brackets are either empty or "*", while the angle brackets can be empty, "*" and "M ". this table
It indicates that the items corresponding to the former are either not or in the core. The latter selects the same item and can be used as a module.
  
Module: In My intuitive understanding, the module is like *. drivers like SYS can be loaded after the core is started, effectively reducing the core size and providing more flexibility. I will talk about flexibility later.
  
Networking options:
This mainly applies to TCP/IP Settings. Generally, you can use the default settings on the machine. If you want to use a firewall
You can choose a route or something. I have never selected it. I dare not talk about it like PP;
  
SCSI support:
I don't have a SCSI device, so I don't select either of them. Do you have one? Make all you want into modules,
In this way, the kernel will be relatively small. For example, 16.8 selects "AIC7xxx" in "low-level drivers", because
There is a scsi cdr optical drive, and sometimes it may be connected for use;
  
Netword device support:
Here is the NIC settings.
First entry after entry, Netword device support is selected first (no Nic? Also select !)
  
ARCnet support:
I don't know why, but I don't select it;
  
Dummy net driver support:
Support for dumb (or empty) network drivers. Default Value: M.
  
EQL ........:
N/A. No.
  
Ethernet (10 or 100 Mbit ):
If you use a network card to access the Internet, choose it.
  
3COM cards:
If you use the 3COM card, you can choose one of the following options.
  
Amd lance .....:
Western Digital ......:
Racal-Interlan ......:
It looks like a card, no matter him.
  
Other ISA cards:
Other players who use the isa nic (especially the XX card such as UMC 9008.
I have never used other cards. For NE2000 compatible cards, choose NE2000/NE1000 support, preferably
M. Making the NIC driver into a module will help you install the NIC Driver.
  
If you have selected your card, you can skip all of the following items. If not,
Select according to the listed items. For example, select PPP for dial-up Internet access.
Not nonsense: PP
  
And then Amateur Radio Support. No;
  
Then there is ISDN... are you rich enough to use ISDN to access the Internet?
  
Below is the Old CD-ROM drivers, if you are still using an Old non-IDE or SCSI interface drive, go in
Select it by yourself.
  
Character devices:
It can basically remain unchanged. If you are using a serial Mouse, "mouse Support (not serial Mouse )"
You can skip this option. If you have game controllers, you can select them in Joystick support. General simulated controllers (not good)
The exact definition below. In short, the 4-key, 6-key, and 8-key that you can buy for less than 60 yuan are both analog-type .)
Item "Classic PC..."... I used Creative Cobra, but I used the handle in LINUX.
It doesn't seem to make any sense to drive...
  
Filesystems:
File System Support.
Quota support:
No, if your machine is not a personal homepage server like 16.8, what if you want to experiment?
Choose to restrict the hard disk space used by users.
  
Kernel automounter support can be selected, although I did not find any difference.
Dos fat fs support is recommended. If you want to read and write DOS partitions in LINUX, there are three options:
You can select "MSDOS fs support" and "VFAT (Windows-95) fs support". VFAT means
FAT32.
  
ISO 9660...: ISO 9660 format (the current software CD.. X version CD. Are all in this format)
Yes, of course.
  
Microsoft Joliet.
  
All of the following can be kept by default. If NT or OS/2 is installed, you can choose NTFS... and OS/2 ....
Is read-only access.
  
NFS is selected by default in the Network File Systems subitem, but not in SMB.
WINDOWS shared directory in the local network. If you want to access the Netware volume, select "NCP .....".
  
It will be Console drivers after it comes out. You can ignore it.
Then there is Sound... there are a lot of things, and I really don't have the strength to write them down one by one. But there are several suggestions:
1. It is convenient to use the OSS driver or the OSS driver, and many cards are supported;
2. If the OSS driver is used, do not select anything in SOUND;
3. The cards (such as ALS007) not supported by OSS can be found in the core. For details, refer to the "ALS007 voice pass" in my POST above ".
4. OSS refers to the Open Sound System, which is a commercial product of 4 Front Tech. It can be found on 16.8, but there is a time limit. an expert registered the job and downloaded it for research. the "OSS sound modules (NEW)" in the core is only part of the OSS. I also used this to drive the YAMAHA 719 card.
  
Kernel hacking: No matter it ......
  
Okay. After all settings are complete, select EXIT to EXIT. If you want to save the changes, answer YES.
Then there will be some prompts. If you see "make dep", you must make "make dep" first.
Make bzImage. If the prompt does not contain "make dep ",
"Make zImage", "make zdisk" or "make zlilo", you just need to make bzImage.
  
One note: make dep is used for some preparation, while make bzImage is used to compile and generate the core.
The difference between make bzImage and make zImage is that the core compression rate of making bzImage is higher than that of zImage, and the core is smaller. make zdisk and make zlilo are the core of other functions.
  
Then wait ). it generally ranges from 5 minutes to half an hour. the first compilation will be slow. after the configuration is changed, make will be much faster.
  
Make modules and make modules_install.
  
After making bzImage is complete, it will show where the core is located, usually/usr/src/linux/arch/i386/boot/
Copy bzImage to the root. Then modify/etc/lilo. conf and add it according to the original image = XXXXX.
Image =/bzImage
Root =/dev/hda1 (this depends on your LINUX installation, depending on your original changes)
Label = linux
Read-only
Change the original label = linux, such as label = oldlinux.
Add the image =/bzImage section to the front of the original section.

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.