1 |
<?xml version='1.0' encoding='UTF-8'?> |
2 |
<!DOCTYPE sections SYSTEM "/dtd/book.dtd"> |
3 |
|
4 |
<!-- The content of this document is licensed under the CC-BY-SA license --> |
5 |
<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> |
6 |
|
7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-ppc-kernel.xml,v 1.30 2005/07/04 15:57:32 swift Exp $ --> |
8 |
|
9 |
<sections> |
10 |
|
11 |
<version>2.9</version> |
12 |
<date>2005-07-04</date> |
13 |
|
14 |
<section> |
15 |
<title>Timezone</title> |
16 |
<body> |
17 |
|
18 |
<p> |
19 |
You first need to select your timezone so that your system knows where it is |
20 |
located. Look for your timezone in <path>/usr/share/zoneinfo</path>, then make a |
21 |
symlink to <path>/etc/localtime</path> using <c>ln</c>: |
22 |
</p> |
23 |
|
24 |
<pre caption="Setting the timezone information"> |
25 |
# <i>ls /usr/share/zoneinfo</i> |
26 |
<comment>(Suppose you want to use GMT)</comment> |
27 |
# <i>ln -sf /usr/share/zoneinfo/GMT /etc/localtime</i> |
28 |
</pre> |
29 |
|
30 |
</body> |
31 |
</section> |
32 |
<section> |
33 |
<title>Installing the Sources</title> |
34 |
<subsection> |
35 |
<title>Choosing a Kernel</title> |
36 |
<body> |
37 |
|
38 |
<p> |
39 |
The core around which all distributions are built is the Linux kernel. It is the |
40 |
layer between the user programs and your system hardware. Gentoo provides its |
41 |
users several possible kernel sources. A full listing with description is |
42 |
available at the <uri link="/doc/en/gentoo-kernel.xml">Gentoo Kernel |
43 |
Guide</uri>. |
44 |
</p> |
45 |
|
46 |
<p> |
47 |
For PPC you can choose between <c>vanilla-sources</c> and |
48 |
<c>gentoo-sources</c> (both 2.6 kernels). The latter is available when you |
49 |
perform a networkless installation. Beside those there is a special |
50 |
kernel-2.6-patchset for the Pegasos: <c>pegasos-sources</c>. So let's |
51 |
continue with <c>emerge</c>'ing the kernel sources: |
52 |
</p> |
53 |
|
54 |
<pre caption="Installing a kernel source"> |
55 |
# <i>emerge gentoo-sources</i> |
56 |
</pre> |
57 |
|
58 |
<note> |
59 |
The PowerPC sources are based on a 2.6.10-kernel with security patches from |
60 |
2.6.11 backported. As the time of the release the 2.6.11 kernel produced |
61 |
several problems on different PowerPC machines. |
62 |
</note> |
63 |
|
64 |
<p> |
65 |
When you take a look in <path>/usr/src</path> you should see a symlink called |
66 |
<path>linux</path> pointing to your kernel source. We will assume the kernel |
67 |
source installed is <c>gentoo-sources-2.6.10-r8</c>: |
68 |
</p> |
69 |
|
70 |
<pre caption="Viewing the kernel source symlink"> |
71 |
# <i>ls -l /usr/src/linux</i> |
72 |
lrwxrwxrwx 1 root root 22 Mar 18 16:23 /usr/src/linux -> linux-2.6.10-gentoo-r8 |
73 |
</pre> |
74 |
|
75 |
<p> |
76 |
If the symlink doesn't point to the kernel source of your choice (note that |
77 |
<c>linux-2.6.10-gentoo-r8</c> is merely an example) you should change it to the |
78 |
right kernel: |
79 |
</p> |
80 |
|
81 |
<pre caption="Changing the kernel source symlink"> |
82 |
# <i>rm /usr/src/linux</i> |
83 |
# <i>cd /usr/src</i> |
84 |
# <i>ln -s linux-2.6.10-gentoo-r8 linux</i> |
85 |
</pre> |
86 |
|
87 |
<p> |
88 |
Now it is time to configure and compile your kernel source. You |
89 |
can use <c>genkernel</c> for this, which will build a generic kernel as used |
90 |
by the Installation CD. We explain the "manual" configuration first though, as |
91 |
it is the best way to optimize your environment. |
92 |
</p> |
93 |
|
94 |
<p> |
95 |
If you want to manually configure your kernel, continue now with <uri |
96 |
link="#manual">Default: Manual Configuration</uri>. If you want to use |
97 |
<c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using |
98 |
genkernel</uri> instead. |
99 |
</p> |
100 |
|
101 |
</body> |
102 |
</subsection> |
103 |
</section> |
104 |
<section id="manual"> |
105 |
<title>Default: Manual Configuration</title> |
106 |
<subsection> |
107 |
<title>Introduction</title> |
108 |
<body> |
109 |
|
110 |
<p> |
111 |
Manually configuring a kernel is often seen as the most difficult procedure a |
112 |
Linux user ever has to perform. Nothing is less true -- after configuring a |
113 |
couple of kernels you don't even remember that it was difficult ;) |
114 |
</p> |
115 |
|
116 |
<p> |
117 |
However, one thing <e>is</e> true: you must know your system when you start |
118 |
configuring a kernel manually. Most information can be gathered by emerging |
119 |
pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now |
120 |
be able to use <c>lspci</c> within the chrooted environment. You may safely |
121 |
ignore any <e>pcilib</e> warnings (like pcilib: cannot open |
122 |
/sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run |
123 |
<c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same. |
124 |
You can also run <c>lsmod</c> to see what kernel modules the Installation CD |
125 |
uses (it might provide you with a nice hint on what to enable). |
126 |
</p> |
127 |
|
128 |
<p> |
129 |
Now go to your kernel source directory and execute <c>make menuconfig</c>. This |
130 |
will fire up an ncurses-based configuration menu. |
131 |
</p> |
132 |
|
133 |
<pre caption="Invoking menuconfig"> |
134 |
# <i>cd /usr/src/linux</i> |
135 |
# <i>make menuconfig</i> |
136 |
</pre> |
137 |
|
138 |
<p> |
139 |
You will be greeted with several configuration sections. We'll first list some |
140 |
options you must activate (otherwise Gentoo will not function, or not function |
141 |
properly without additional tweaks). |
142 |
</p> |
143 |
|
144 |
</body> |
145 |
</subsection> |
146 |
<subsection> |
147 |
<title>Activating Required Options</title> |
148 |
<body> |
149 |
|
150 |
<p> |
151 |
First of all, activate the use of development and experimental code/drivers. |
152 |
You need this, otherwise some very important code/drivers won't show up: |
153 |
</p> |
154 |
|
155 |
<pre caption="Selecting experimental code/drivers, General setup"> |
156 |
Code maturity level options ---> |
157 |
[*] Prompt for development and/or incomplete code/drivers |
158 |
General setup ---> |
159 |
[*] Support for hot-pluggable devices |
160 |
</pre> |
161 |
|
162 |
<p> |
163 |
Now go to <c>File Systems</c> and select support for the filesystems you use. |
164 |
<e>Don't</e> compile them as modules, otherwise your Gentoo system will not be |
165 |
able to mount your partitions. Also select <c>/proc file system</c> and |
166 |
<c>Virtual memory</c>. Do <e>not</e> select the <c>/dev file system</c>. |
167 |
</p> |
168 |
|
169 |
<pre caption="Selecting necessary file systems"> |
170 |
File systems ---> |
171 |
Pseudo Filesystems ---> |
172 |
[*] /proc file system support |
173 |
[ ] /dev file system support (OBSOLETE) |
174 |
[*] Virtual memory file system support (former shm fs) |
175 |
|
176 |
<comment>(Select one or more of the following options as needed by your system)</comment> |
177 |
<*> Reiserfs support |
178 |
<*> Ext3 journalling file system support |
179 |
<*> Second extended fs support |
180 |
<*> XFS filesystem support |
181 |
</pre> |
182 |
|
183 |
<p> |
184 |
If you are using PPPoE to connect to the Internet or you are using a dial-up |
185 |
modem, you will need the following options in the kernel: |
186 |
</p> |
187 |
|
188 |
<pre caption="Selecting PPPoE necessary drivers"> |
189 |
Device Drivers ---> |
190 |
Networking support ---> |
191 |
<*> PPP (point-to-point protocol) support |
192 |
<*> PPP support for async serial ports |
193 |
<*> PPP support for sync tty ports |
194 |
</pre> |
195 |
|
196 |
<p> |
197 |
The two compression options won't harm but are not definitely needed, neither |
198 |
does the <c>PPP over Ethernet</c> option, that might only be used by |
199 |
<c>rp-pppoe</c> when configured to do kernel mode PPPoE. |
200 |
</p> |
201 |
|
202 |
<p> |
203 |
If you require it, don't forget to include support in the kernel for your |
204 |
ethernet card. |
205 |
</p> |
206 |
|
207 |
<p> |
208 |
Users of OldWorld machines will want HFS support so they can copy compiled |
209 |
kernels to the MacOS partition. This applies also to NewWorld machines as it is |
210 |
needed for the special Apple_Bootstrap partition: |
211 |
</p> |
212 |
|
213 |
<pre caption="Activating HFS support"> |
214 |
File Systems ---> |
215 |
[*] HFS Support |
216 |
</pre> |
217 |
|
218 |
<p> |
219 |
At this time, kernel preemption is still unstable on PPC and may cause |
220 |
compilation failures and random segfaults. It is <e>strongly</e> suggested |
221 |
that you do not use this feature. |
222 |
</p> |
223 |
|
224 |
<pre caption="Ensure the Preemptible Kernel Option is Off"> |
225 |
Platform options ---> |
226 |
[ ] Preemptible Kernel |
227 |
</pre> |
228 |
|
229 |
<p> |
230 |
When you're done configuring your kernel, continue with <uri |
231 |
link="#compiling">Compiling and Installing</uri>. |
232 |
</p> |
233 |
|
234 |
</body> |
235 |
</subsection> |
236 |
<subsection id="compiling"> |
237 |
<title>Compiling and Installing</title> |
238 |
<body> |
239 |
|
240 |
<p> |
241 |
Now that your kernel is configured, it is time to compile and install it. Exit |
242 |
the configuration and run the commands which will compile the kernel: |
243 |
</p> |
244 |
|
245 |
<pre caption="Compiling the kernel"> |
246 |
# <i>make all && make modules_install</i> |
247 |
</pre> |
248 |
|
249 |
<p> |
250 |
When the kernel has finished compiling, copy the kernel image to |
251 |
<path>/boot</path> (be sure that it is mounted properly on the Pegasos). |
252 |
</p> |
253 |
|
254 |
<pre caption="Installing the kernel"> |
255 |
<comment>replace 2.6.10 with your kernel-version</comment> |
256 |
(Apple/IBM) # <i>cp vmlinux /boot/kernel-2.6.10</i> |
257 |
(Pegasos) # <i>cp arch/ppc/boot/images/zImage.chrp /boot/kernel-2.6.10</i> |
258 |
</pre> |
259 |
|
260 |
<p> |
261 |
It is also wise to copy over your kernel configuration file to |
262 |
<path>/boot</path>, just in case :) |
263 |
</p> |
264 |
|
265 |
<pre caption="Backing up your kernel configuration"> |
266 |
# <i>cp .config /boot/config-2.6.10-gentoo-r8</i> |
267 |
</pre> |
268 |
|
269 |
<p> |
270 |
Now continue with <uri link="#kernel_modules">Installing Separate Kernel |
271 |
Modules</uri>. |
272 |
</p> |
273 |
|
274 |
</body> |
275 |
</subsection> |
276 |
</section> |
277 |
<section id="kernel_modules"> |
278 |
<title>Installing Separate Kernel Modules</title> |
279 |
<subsection> |
280 |
<title>Configuring the Modules</title> |
281 |
<body> |
282 |
|
283 |
<p> |
284 |
You should list the modules you want automatically loaded in |
285 |
<path>/etc/modules.autoload.d/kernel-2.6</path>. |
286 |
You can add extra options to the modules too if you want. |
287 |
</p> |
288 |
|
289 |
<p> |
290 |
To view all available modules, run the following <c>find</c> command. Don't |
291 |
forget to substitute "<kernel version>" with the version of the kernel you |
292 |
just compiled: |
293 |
</p> |
294 |
|
295 |
<pre caption="Viewing all available modules"> |
296 |
# <i>find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko'</i> |
297 |
</pre> |
298 |
|
299 |
<p> |
300 |
For instance, to automatically load the <c>3c59x.o</c> module, edit the |
301 |
<path>kernel-2.6</path> file and enter the module |
302 |
name in it. |
303 |
</p> |
304 |
|
305 |
<pre caption="Editing /etc/modules.autoload.d/kernel-2.6"> |
306 |
# <i>nano -w /etc/modules.autoload.d/kernel-2.6</i> |
307 |
</pre> |
308 |
|
309 |
<pre caption="/etc/modules.autoload.d/kernel-2.6"> |
310 |
3c59x |
311 |
</pre> |
312 |
|
313 |
<p> |
314 |
Continue the installation with <uri link="?part=1&chap=8">Configuring |
315 |
your System</uri>. |
316 |
</p> |
317 |
|
318 |
</body> |
319 |
</subsection> |
320 |
</section> |
321 |
<section id="genkernel"> |
322 |
<title>Alternative: Using genkernel</title> |
323 |
<body> |
324 |
|
325 |
<p> |
326 |
If you are reading this section, you have chosen to use our <c>genkernel</c> |
327 |
script to configure your kernel for you. |
328 |
</p> |
329 |
|
330 |
<p> |
331 |
Now that your kernel source tree is installed, it's now time to compile your |
332 |
kernel by using our <c>genkernel</c> script to automatically build a kernel for |
333 |
you. <c>genkernel</c> works by configuring a kernel nearly identically to the |
334 |
way our Installation CD kernel is configured. This means that when you use |
335 |
<c>genkernel</c> to build your kernel, your system will generally detect all |
336 |
your hardware at boot-time, just like our Installation CD does. Because genkernel |
337 |
doesn't require any manual kernel configuration, it is an ideal solution for |
338 |
those users who may not be comfortable compiling their own kernels. |
339 |
</p> |
340 |
|
341 |
<p> |
342 |
Now, let's see how to use genkernel. First, emerge the genkernel ebuild: |
343 |
</p> |
344 |
|
345 |
<pre caption="Emerging genkernel"> |
346 |
# <i>emerge genkernel</i> |
347 |
</pre> |
348 |
|
349 |
<p> |
350 |
Next, copy over the kernel configuration used by the Installation CD to the |
351 |
location where genkernel looks for the default kernel configuration: |
352 |
</p> |
353 |
|
354 |
<pre caption="Copying over the Installation CD kernel config"> |
355 |
# <i>zcat /proc/config.gz > /usr/share/genkernel/ppc/kernel-config-2.6</i> |
356 |
</pre> |
357 |
|
358 |
<p> |
359 |
Now, compile your kernel sources by running <c>genkernel --udev all</c>. |
360 |
Be aware though, as <c>genkernel</c> compiles a kernel that supports almost all |
361 |
hardware, this compilation will take quite a while to finish! |
362 |
</p> |
363 |
|
364 |
<p> |
365 |
Note that, if your partition where the kernel should be located doesn't use ext2 |
366 |
or ext3 as filesystem you might need to manually configure your kernel using |
367 |
<c>genkernel --menuconfig all</c> and add support for your filesystem <e>in</e> |
368 |
the kernel (i.e. <e>not</e> as a module). Users of EVMS2 or LVM2 will probably |
369 |
want to add <c>--evms2</c> or <c>--lvm2</c> as argument as well. |
370 |
</p> |
371 |
|
372 |
<pre caption="Running genkernel"> |
373 |
# <i>genkernel --udev all</i> |
374 |
</pre> |
375 |
|
376 |
<p> |
377 |
Once <c>genkernel</c> completes, a kernel, full set of modules and |
378 |
<e>initial root disk</e> (initrd) will be created. We will use the kernel |
379 |
and initrd when configuring a boot loader later in this document. Write |
380 |
down the names of the kernel and initrd as you will need it when writing |
381 |
the bootloader configuration file. The initrd will be started immediately after |
382 |
booting to perform hardware autodetection (just like on the Installation CD) |
383 |
before your "real" system starts up. Be sure to also copy down the required |
384 |
boot arguments, these are required for a sucessful boot with genkernel. |
385 |
</p> |
386 |
|
387 |
<pre caption="Checking the created kernel image name and initrd"> |
388 |
# <i>ls /boot/kernel* /boot/initrd*</i> |
389 |
</pre> |
390 |
|
391 |
<p> |
392 |
Now, let's perform one more step to get our system to be more like the |
393 |
Installation CD -- let's emerge <c>coldplug</c>. While the initrd autodetects |
394 |
hardware that is needed to boot your system, <c>coldplug</c> autodetects |
395 |
everything else. To emerge and enable <c>coldplug</c>, type the following: |
396 |
</p> |
397 |
|
398 |
<pre caption="Emerging and enabling coldplug"> |
399 |
# <i>emerge coldplug</i> |
400 |
# <i>rc-update add coldplug boot</i> |
401 |
</pre> |
402 |
|
403 |
<p> |
404 |
Now continue with <uri link="?part=1&chap=8">Configuring your System</uri>. |
405 |
</p> |
406 |
|
407 |
</body> |
408 |
</section> |
409 |
|
410 |
</sections> |
411 |
|