1 |
rane 05/09/19 14:52:04 |
2 |
|
3 |
Added: xml/htdocs/doc/en/articles linux-kernel-compiling.xml |
4 |
Log: |
5 |
new article from #104226 |
6 |
|
7 |
Revision Changes Path |
8 |
1.1 xml/htdocs/doc/en/articles/linux-kernel-compiling.xml |
9 |
|
10 |
file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/articles/linux-kernel-compiling.xml?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=gentoo |
11 |
plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/articles/linux-kernel-compiling.xml?rev=1.1&content-type=text/plain&cvsroot=gentoo |
12 |
|
13 |
Index: linux-kernel-compiling.xml |
14 |
=================================================================== |
15 |
<?xml version="1.0" encoding="UTF-8"?> |
16 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
17 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/articles/linux-kernel-compiling.xml,v 1.1 2005/09/19 14:52:04 rane Exp $ --> |
18 |
|
19 |
<guide link="/doc/en/articles/linux-kernel-compiling.xml"> |
20 |
<title>Compiling the Linux kernel</title> |
21 |
|
22 |
<author title="Author"> |
23 |
<mail link="drobbins@g.o">Daniel Robbins</mail> |
24 |
</author> |
25 |
<!-- xmlified by: Joshua Saddler (jackdark@×××××.com) --> |
26 |
|
27 |
<abstract> |
28 |
Daniel Robbins introduces the Linux kernel, and then walks you through locating |
29 |
and downloading sources, configuring the kernel, compiling and installing the |
30 |
kernel, and boot configuration. |
31 |
</abstract> |
32 |
|
33 |
<!-- The original version of this article was first published on IBM |
34 |
developerWorks, and is property of Westtech Information Services. This |
35 |
document is an updated version of the original article, and contains |
36 |
various improvements made by the Gentoo Linux Documentation team --> |
37 |
|
38 |
<version>1.0</version> |
39 |
<date>2005-08-31</date> |
40 |
|
41 |
<chapter> |
42 |
<title>Introducing the kernel</title> |
43 |
<section> |
44 |
<title>The kernel is... Linux!</title> |
45 |
<body> |
46 |
|
47 |
<note> |
48 |
The original version of this article was first published on IBM developerWorks, |
49 |
and is property of Westtech Information Services. This document is an updated |
50 |
version of the original article, and contains various improvements made by the |
51 |
Gentoo Linux Documentation team. |
52 |
</note> |
53 |
|
54 |
<p> |
55 |
What do you think of when you hear the word "Linux"? When I hear it, I |
56 |
typically think of an entire Linux distribution and all the cooperating |
57 |
programs that make the distribution work. |
58 |
</p> |
59 |
|
60 |
<p> |
61 |
However, you may be surprised to find out that, technically, Linux is a kernel, |
62 |
and a kernel only. While the other parts of what we commonly call "Linux" (such |
63 |
as a shell and compiler) are essential parts of a distribution, they are |
64 |
technically separate from Linux (the kernel). While many people use the word |
65 |
"Linux" to mean "Linux-based distribution," everyone can at least agree that |
66 |
the Linux kernel is the <e>heart</e> of every distribution. |
67 |
</p> |
68 |
|
69 |
</body> |
70 |
</section> |
71 |
<section> |
72 |
<title>Interfacing with hardware</title> |
73 |
<body> |
74 |
|
75 |
<p> |
76 |
The primary role of the Linux kernel is to interface directly with the hardware |
77 |
in your system. The kernel provides a <e>layer of abstraction</e> between the |
78 |
raw hardware and application programs. This way, the programs themselves do |
79 |
not need to know the details of your specific motherboard chipset or disk |
80 |
controller -- they can instead operate at the higher level of reading and |
81 |
writing files to disk, for example. |
82 |
</p> |
83 |
|
84 |
</body> |
85 |
</section> |
86 |
<section> |
87 |
<title>CPU abstraction</title> |
88 |
<body> |
89 |
|
90 |
<p> |
91 |
The Linux kernel also provides a level of abstraction on top of the |
92 |
processor(s) in your system -- allowing for multiple programs to appear to run |
93 |
simultaneously. Linux does this by allowing several UNIX <e>processes</e> to |
94 |
run at once -- and the kernel takes care of giving each one a fair share of the |
95 |
processor(s). |
96 |
</p> |
97 |
|
98 |
<p> |
99 |
A Linux kernel can support either a single or multiple CPUs -- and the kernel |
100 |
that you are using now is either uniprocessor-aware (UP-aware) or symmetric |
101 |
multiprocessor-aware (SMP-aware). If you happen to have an SMP motherboard, but |
102 |
you're using a UP kernel, Linux won't "see" your extra processors! To fix this, |
103 |
you'll want to compile a special SMP kernel for your hardware. Currently, SMP |
104 |
kernels will also work on uniprocessor systems, but at a slight performance |
105 |
hit. |
106 |
</p> |
107 |
|
108 |
</body> |
109 |
</section> |
110 |
<section> |
111 |
<title>Abstracting I/O</title> |
112 |
<body> |
113 |
|
114 |
<p> |
115 |
The kernel also handles the much-needed task of abstracting all forms of file |
116 |
I/O. Imagine what would happen if every program had to interface with your |
117 |
particular hardware directly -- if you changed disk controllers, all your |
118 |
programs would stop working! Fortunately, the Linux kernel follows the UNIX |
119 |
model of providing a simple abstraction of disk I/O that all programs can use. |
120 |
That way, your favorite database doesn't need to be concerned whether it is |
121 |
storing data on an IDE disk, a SCSI RAID array, or a network-mounted file |
122 |
system. |
123 |
</p> |
124 |
|
125 |
</body> |
126 |
</section> |
127 |
<section> |
128 |
<title>Networking Central</title> |
129 |
<body> |
130 |
|
131 |
<p> |
132 |
One of Linux's main claims to fame is its robust networking, especially TCP/IP |
133 |
support. And, if you guessed that the TCP/IP stack is in the Linux kernel, |
134 |
you're right! The kernel provides a nice, high-level interface for programs |
135 |
that want to send data over the network. Behind the scenes, the Linux kernel |
136 |
interfaces directly with your particular ethernet card or modem, and handles |
137 |
the low-level Internet communication details. |
138 |
</p> |
139 |
|
140 |
</body> |
141 |
</section> |
142 |
<section> |
143 |
<title>Networking goodies</title> |
144 |
<body> |
145 |
|
146 |
<p> |
147 |
One of the greatest things about Linux is all of the useful features that are |
148 |
available in the kernel, especially those related to networking. For example, |
149 |
you can configure a kernel that will allow your entire home network to access |
150 |
the Internet via your Linux modem -- this is called IP Masquerading, or IP NAT |
151 |
(network address translating). |
152 |
</p> |
153 |
|
154 |
<p> |
155 |
Additionally, the Linux kernel can be configured to export or mount |
156 |
network-based NFS file systems, allowing for other UNIX machines on your LAN to |
157 |
easily share data with your Linux system. |
158 |
</p> |
159 |
|
160 |
</body> |
161 |
</section> |
162 |
<section> |
163 |
<title>Booting, part 1</title> |
164 |
<body> |
165 |
|
166 |
<p> |
167 |
When you turn on your Linux-based system, the kernel is loaded from disk to |
168 |
memory by a boot loader, such as LILO. At this point, the kernel takes control |
169 |
of your system. The first thing it does is detect and initialize all the |
170 |
hardware that it finds -- and it has been compiled to support. Once the |
171 |
hardware has been initialized properly, it is then ready to run processes. The |
172 |
first process it runs is called <c>init</c>, which is located in |
173 |
<path>/sbin</path>. Then, <c>init</c> starts additional processes, as |
174 |
specified in <path>/etc/inittab</path>. |
175 |
</p> |
176 |
|
177 |
</body> |
178 |
</section> |
179 |
<section> |
180 |
<title>Booting, part 2</title> |
181 |
<body> |
182 |
|
183 |
<p> |
184 |
<c>init</c> typically starts several copies of a program called <c>getty</c>, |
185 |
which waits for logins from the console. After <c>getty</c> successfully |
186 |
processes a login request, your default shell is loaded (which is typically |
187 |
<c>bash</c>). Once you're in bash, you have the power to launch any program |
188 |
you'd like. |
189 |
</p> |
190 |
|
191 |
<p> |
192 |
While all these new processes are started, the kernel is still in control, |
193 |
carefully time-slicing the CPU so that each process has a fair share. In |
194 |
addition, the kernel continues to provide hardware abstraction and networking |
195 |
services for the various running processes. |
196 |
</p> |
197 |
|
198 |
</body> |
199 |
</section> |
200 |
<section> |
201 |
<title>Introducing... modules!</title> |
202 |
<body> |
203 |
|
204 |
<p> |
205 |
All recent Linux kernels support kernel modules. Kernel modules are really neat |
206 |
things -- they're pieces of the kernel that reside on disk, until needed. As |
207 |
soon as the kernel needs the functionality of a particular module, it's loaded |
208 |
from disk, automatically integrated with the kernel, and available for use. In |
209 |
addition, if a kernel module hasn't been used for several minutes, the kernel |
210 |
can voluntarily unload it from memory -- something that's called |
211 |
"autocleaning." |
212 |
</p> |
213 |
|
214 |
|
215 |
|
216 |
|
217 |
-- |
218 |
gentoo-doc-cvs@g.o mailing list |