Linux kernel configuration and compilation

Source: Internet
Author: User
Tags ftp site
Article title: Linux kernel configuration and compilation overview. 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. why compile the Linux kernel?
As we all know, Linux is an open-source operating system, and open-source software brings us the greatest benefit to people with relatively low computer levels, that is, you can quickly learn the world's high-level programs (architecture and programming methods), so as to quickly improve your own level. However, this also makes most open-source software products inferior to those of professional software companies such as Microsoft in terms of ease of use and pertinence of coding. The use of open source software may feel uncomfortable. This must have been shared by friends who have used earlier Linux versions. Sometimes it is not just uncomfortable. due to different software developers or versions, we cannot guarantee that all software can be simply transplanted between different machines. for some large software (such: this is especially true for ORACLE 8.0.5. In many cases, the system status, especially the kernel status, has a crucial impact on the installation and use of programs and the performance. From another perspective, we can also customize the kernel for our computer, so that there will be no big garbage bins like Windows 98.
  
2. understand Linux
To compile the Linux kernel, you must first have a rough impression on it. Linux is a Unix imitation product that supports features such as multitasking, virtual memory, multiple terminals, and virtual file systems. It can run on at least 386/486 of personal computers, and some other architecture machines, such as SUN iSCSI, M68000, DEC Alpha, and PowerPC, also gradually have the appropriate Linux.
  
3. Prepare for Kernel Compilation
1) understand the version number of the existing kernel.
This is mainly to determine the basic information of some machines. it is not necessarily necessary to do so. You can use the following command line:
$ Uname-
Linux lark 2.2.15 #2 tue dec 26 10:55:20 CST 2000 i686
2) Download the latest version of Linux kernel. Currently, the ftp site of CERNet in China has a wide range of contents (including compressed kernels, patches, compilers, and so on), with fast updates, such as kernel.
3) unpack the packaged kernel
The compressed kernel, patch, and undo source code account for about 70 MB of hard disk space in total. log on with root and unlock the source code under/usr/src/linux2.2.15:
# Tar zxvf linux-2.2.15.tar.gz
Or
# Gzip t linux-2.2.15.tar.gz
# Tar x linux-2.2.15.tar
If the command line is too troublesome, you can use software such as winzip on a windows machine, and use ftp or mount to make linux accessible.
4) install gcc-2.7.2 or updated c build package in system
5) If you are unsure, back up the original kernel (under/boot) elsewhere. Don't forget to back up the module at the same time (/lib/modules/2. x. x)
  
4. kernel editing
In order to make the kernel meet the actual needs of your system and applications, you generally need to edit the kernel to modify several parameters in some header files. For example, when Oracle 8.0.5 is installed, in order to make the memory space that Oracle can use consistent with the actual physical memory capacity to improve performance, modify shmparam under/usr/src/linux/include/asm. some memory parameters in the H file.
  
5. kernel configuration
There are many kernel configuration methods, such as make config, make xconfig, make menuconfig, and make oldconfig. Their functions are the same. the differences can be seen by name, only make oldconfig refers to the current settings of the system (. /. config) as the default value. Here, make menuconfig is used.
It should be noted that the larger the number of unnecessary drivers, the larger the kernel, not only the slow running speed and high memory usage, but also other problems in a few cases. The procedure is as follows:
First, make sure that the shell is bash.
Then
$ Make menuconfig
Some default symbols have the following meanings:
Y: load
N: do not load
M: loaded as a module
  
You can configure the following options:
1) code maturity level option code maturity
Prompt for development and/or incomplete code/drivers [N/y/?]
If you are interested in testing some modules that have not yet been finalized in the kernel, select y. otherwise, select N. Do you want to know more details? The online help (below? ), N indicates the default value in uppercase.
  
2) processor type and features
Processor family (386,486/cx133, 586/K5/5x86/6x86, Pentium/K6/TSC, PPro/6x86MX) [PPro/6x86MX]
[] Is the default value. we can select the value based on the uname command execution result described above. If this parameter is greater than 386, the generated kernel cannot be started on the 386 host.
Math emulation (CONFIG_MATH_EMULATION) [N/y/?]
Need to perform coprocessor simulation? Normal machines return n. If the machine already has a hardware co-processor, the kernel will still use the hardware, while ignoring the math-emulation of the software, which will make the kernel become slower.
MTRR (Memory Type Range Register) support (CONFIG_MTRR) [N/y/?]
Image writing speed can be improved in Pentium, Pro/Pentium II systems.
Using Ric multi-processing support (CONFIG_SMP) [Y/n/?]
If your machine has multiple processors, select y. Select the following Enhanced Real Time Clock Support
  
3) loadable model support: supported modules
Enable loadable module support (CONFIG_MODULES) [Y/n/?]
It is best to select y. otherwise, many modules that are only for dynamic loading will not be available.
Set version information on all symbols for modules (CONFIG_MODVERSIONS) [N/y/?]
Select N
Kernel module loader (CONFIG_KMOD) [N/y/?]
  
4) general setup general settings
Networking support (CONFIG_NET) [Y/n/?]
Select y. how many other computers do not need to access the Internet?
PCI support (CONFIG_PCI) [Y/n/?]
There are always PCI bus and devices.
PCI access mode (BIOS, Direct, Any) [Any]
The default value is relatively safe, but if you have confidence in your motherboard, choose BIOS.
PCI quirks (CONFIG_PCI_QUIRKS) [Y/n/?]
It is used to fix bugs that affect PCI in BIOS. Similarly, if you are confident about the motherboard, select n.
Backward-compatible/proc/pci> (CONFIG_PCI_OLD_PROC) [Y/n/?]
The previous kernel uses/proc/pci, and the new kernel uses/proc/bus/pci. to maintain compatibility, select y.
MCA support (CONFIG_MCA) [N/y/?]
View help.
SGI Visual Workstation support (CONFIG_VISWS) [N/y/?]
Is your machine SGI? Select y if yes.
System v ipc (CONFIG_SYSVIPC) [Y/n/?]
Inter-process communication functions and system calls. One of the five main components of the Linux kernel must be selected.
BSD Process Accounting (CONFIG_BSD_PROCESS_ACCT) [N/y/?]
It is used to start user-level system calls that write process information into files by the kernel. You don't want to use it anymore.
Sysctl support (CONFIG_SYSCTL) [Y/n/?]
Modify the kernel when the kernel is running. Exchange 8 KB space for convenience. Do not select it unless you really want to try it.
Kernel support for a. out binaries (CONFIG_BINFMT_AOUT) [Y/m/n/?]
In order to use the previously compiled program, select y.
Kernel support for ELF binaries (CONFIG_BINFMT_ELF) [Y/m/n/?]
To use the compiled program, select y.
Kernel support for MISC binaries (CONFIG_BINFMT_MISC) [Y/m/n/?]
Select y to support automatic execution of java and other code.
Parallel port support (CONFIG_PARPORT) [N/y/m/?]
Parallel port devices, such as printers.
  
5) plug and play support plug-and-play devices
Plug and Play support (CONFIG_PNP) [N/y/?]
Select y.
  
6) block devices
Normal PC floppy disk support (CONFIG_BLK_DEV_FD) [Y/m/n/?]
General soft Drive. Select y.
Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support (CONFIG_BLK_DEV_IDE) [Y/m/n/?]
Hard Drive, optical drive, tape, and soft drive with these interfaces. Select y.
Include IDE/atapi cdrom support (CONFIG_BLK_DEV_IDECD) [Y/m/n/?]
CDROM. Select y.
  
7) networking options network options
Packet socket (CONFIG_PACHET) [Y/m/n/?]
According to the current network development status, selecting y is better. Of course, you can also select another one.
Kernel/User netlink socke (CONFIG_NETLINK) [N/y/?]
Two-way communication between the kernel and user processes. Select y.
Network firewils (CONFIG_FIREWALL) [N/Y/?]
If you really need to use the firewall, select y.
UNIX domain sockets (confgi_unix) [Y/m/n/?]
Socket is too useful. Select y.
TCP/IP networking (CONFIG_INET) [Y/n/?]
Select y. The reason is shown in the previous one.
The IPX protocol (CONFIG_IPX) [N/y/m/?]
In fact, not so many people really need to use or learn IPX, so N is generally used.
Appletalk DDP (CONFIG_ATALK) [N/y/m/?]
Select N for the same reason.
  
8) SCSI support, SCSI low-level drives SCSI low-level driver
Select based on the actual situation of the SCSI device in the system.
  
9) Networking device support network device support
If you use a LAN to access the Internet, select the NIC;
If you use a MODEM to dial up the internet, it depends on the service provided by the ISP, which is generally PPP.
  
10) Amateur Radio support
I don't know what this is, so I chose N.
  
11) ISDN subsystem
It seems that there is already a MODEM that supports ISDN, so it is best to check whether your MODEM is like this before selecting.
  
Old CD-ROM dfivers (not SCSI, not IDE) drive
N is generally selected, because such devices are rare.
  
13) Character devices Character device
Virtual terminal (CONFIG_VT) [Y/n/?]
In Linux, you can use Alt + F1/F2/F3/F4 to switch between different task terminals. even on a computer, you can fully use the Linux multi-task capability, some installation methods that require command line
Related Article

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.