| 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/2.5 -->
|
| 6 |
|
| 7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-ppc-kernel.xml,v 1.39 2006/02/27 00:55:34 fox2mike Exp $ -->
|
| 8 |
|
| 9 |
<sections>
|
| 10 |
|
| 11 |
<version>2.17</version>
|
| 12 |
<date>2006-04-30</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 copy
|
| 21 |
it to <path>/etc/localtime</path>. Please avoid the
|
| 22 |
<path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not
|
| 23 |
indicate the expected zones. For instance, <path>GMT-8</path> is in fact GMT+8.
|
| 24 |
</p>
|
| 25 |
|
| 26 |
<pre caption="Setting the timezone information">
|
| 27 |
# <i>ls /usr/share/zoneinfo</i>
|
| 28 |
<comment>(Suppose you want to use GMT)</comment>
|
| 29 |
# <i>cp /usr/share/zoneinfo/GMT /etc/localtime</i>
|
| 30 |
</pre>
|
| 31 |
|
| 32 |
</body>
|
| 33 |
</section>
|
| 34 |
<section>
|
| 35 |
<title>Installing the Sources</title>
|
| 36 |
<subsection>
|
| 37 |
<title>Choosing a Kernel</title>
|
| 38 |
<body>
|
| 39 |
|
| 40 |
<p>
|
| 41 |
The base that all distributions are built upon is the Linux kernel. It is the
|
| 42 |
layer between the your programs and your system hardware. Gentoo provides its
|
| 43 |
users several possible kernel sources. A full listing with description is
|
| 44 |
available at the <uri link="/doc/en/gentoo-kernel.xml">Gentoo Kernel
|
| 45 |
Guide</uri>.
|
| 46 |
</p>
|
| 47 |
|
| 48 |
<p>
|
| 49 |
We suggest using either <c>vanilla-sources</c> or <c>gentoo-sources</c> on PPC,
|
| 50 |
which are both 2.6 kernels. The latter is available when you perform a
|
| 51 |
networkless installation. So let's continue with <c>emerge</c>'ing the kernel
|
| 52 |
sources. The <c>USE="-doc"</c> is necessary to avoid installing xorg-x11 or
|
| 53 |
other dependencies at this point. <c>USE="symlink"</c> is not necessary for a
|
| 54 |
new install, but ensures proper creation of the <path>/usr/src/linux</path>
|
| 55 |
symlink.
|
| 56 |
</p>
|
| 57 |
|
| 58 |
<pre caption="Installing the kernel source">
|
| 59 |
# <i>USE="-doc symlink" emerge gentoo-sources</i>
|
| 60 |
</pre>
|
| 61 |
|
| 62 |
<p>
|
| 63 |
If you take a look in <path>/usr/src</path> you should see a symlink named
|
| 64 |
<path>linux</path> pointing to your current kernel source. In this case, the
|
| 65 |
installed kernel source points to <c>gentoo-sources-2.6.15</c>. Your version
|
| 66 |
may be different, so keep this in mind.
|
| 67 |
</p>
|
| 68 |
|
| 69 |
<pre caption="Viewing the kernel source symlink">
|
| 70 |
# <i>ls -l /usr/src/linux</i>
|
| 71 |
lrwxrwxrwx 1 root root 22 Mar 18 16:23 /usr/src/linux -> linux-2.6.15-gentoo
|
| 72 |
</pre>
|
| 73 |
|
| 74 |
<p>
|
| 75 |
It is now time to configure and compile your kernel source. You can use
|
| 76 |
<c>genkernel</c> to build a generic kernel similar to the one used by the
|
| 77 |
Installation CD, or you can perform a manual configuration to best suit your
|
| 78 |
system.
|
| 79 |
</p>
|
| 80 |
|
| 81 |
<p>
|
| 82 |
If you want to manually configure your kernel, continue now with <uri
|
| 83 |
link="#manual">Default: Manual Configuration</uri>. If you want to use
|
| 84 |
<c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using
|
| 85 |
genkernel</uri> instead.
|
| 86 |
</p>
|
| 87 |
|
| 88 |
</body>
|
| 89 |
</subsection>
|
| 90 |
</section>
|
| 91 |
<section id="manual">
|
| 92 |
<title>Default: Manual Configuration</title>
|
| 93 |
<subsection>
|
| 94 |
<title>Introduction</title>
|
| 95 |
<body>
|
| 96 |
|
| 97 |
<p>
|
| 98 |
Manually configuring a kernel is often seen as the most difficult procedure a
|
| 99 |
Linux user ever has to perform. Nothing is less true, after configuring a
|
| 100 |
couple of kernels you won't even remember it being that difficult ;)
|
| 101 |
</p>
|
| 102 |
|
| 103 |
<p>
|
| 104 |
However, one thing <e>is</e> true: you must know your system when you start
|
| 105 |
configuring a kernel manually. Most information can be gathered by emerging
|
| 106 |
pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now
|
| 107 |
be able to use <c>lspci</c> within the chrooted environment. You may safely
|
| 108 |
ignore any <e>pcilib</e> warnings (like pcilib: cannot open
|
| 109 |
/sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run
|
| 110 |
<c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same.
|
| 111 |
You can also run <c>lsmod</c> to see what kernel modules the Installation CD
|
| 112 |
uses (it might provide you with a nice hint on what to enable). Another place
|
| 113 |
to look for clues as to what components to enable is to check the kernel
|
| 114 |
message logs from the successful boot that got you this far. Type <c>dmesg</c>
|
| 115 |
to see the kernel messages.
|
| 116 |
</p>
|
| 117 |
|
| 118 |
<p>
|
| 119 |
Now go to your kernel source directory, it's time to configure your kernel. It
|
| 120 |
is recommended that you add the default settings to your configuration by first
|
| 121 |
running <c>make defconfig</c> (for 2.6.15 and earlier kernels) or
|
| 122 |
<c>make pmac32_defconfig</c> (for 2.6.16 and later kernels). After the default
|
| 123 |
configuration has been generated, run <c>make menuconfig</c> which will fire
|
| 124 |
up an ncurses-based configuration menu.
|
| 125 |
</p>
|
| 126 |
|
| 127 |
<pre caption="Invoking menuconfig">
|
| 128 |
# <i>cd /usr/src/linux</i>
|
| 129 |
<comment>Substitute defconfig for pmac32_defconfig below if using a 2.6.15 or earlier kernel</comment>
|
| 130 |
# <i>make pmac32_defconfig</i>
|
| 131 |
# <i>make menuconfig</i>
|
| 132 |
</pre>
|
| 133 |
|
| 134 |
<p>
|
| 135 |
You will be greeted with several configuration sections. We'll first list some
|
| 136 |
options you must activate (otherwise Gentoo will not function, or not function
|
| 137 |
properly without additional tweaks).
|
| 138 |
</p>
|
| 139 |
|
| 140 |
</body>
|
| 141 |
</subsection>
|
| 142 |
<subsection>
|
| 143 |
<title>Activating Required Options</title>
|
| 144 |
<body>
|
| 145 |
|
| 146 |
<p>
|
| 147 |
First of all, activate the use of development and experimental code/drivers.
|
| 148 |
You need this, otherwise some very important code/drivers won't show up:
|
| 149 |
</p>
|
| 150 |
|
| 151 |
<pre caption="Selecting experimental code/drivers, General setup">
|
| 152 |
Code maturity level options --->
|
| 153 |
[*] Prompt for development and/or incomplete code/drivers
|
| 154 |
General setup --->
|
| 155 |
[*] Support for hot-pluggable devices
|
| 156 |
</pre>
|
| 157 |
|
| 158 |
<p>
|
| 159 |
Now go to <c>File Systems</c> and select support for the filesystems you use.
|
| 160 |
<e>Don't</e> compile them as modules, otherwise your Gentoo system will not be
|
| 161 |
able to mount your partitions. Also select <c>/proc file system</c> and
|
| 162 |
<c>Virtual memory</c>.
|
| 163 |
</p>
|
| 164 |
|
| 165 |
<pre caption="Selecting necessary file systems">
|
| 166 |
File systems --->
|
| 167 |
Pseudo Filesystems --->
|
| 168 |
[*] /proc file system support
|
| 169 |
[*] Virtual memory file system support (former shm fs)
|
| 170 |
|
| 171 |
<comment>(Select one or more of the following options as needed by your system)</comment>
|
| 172 |
<*> Second extended fs support
|
| 173 |
<*> Ext3 journalling file system support
|
| 174 |
<*> Reiserfs support
|
| 175 |
<*> XFS filesystem support
|
| 176 |
</pre>
|
| 177 |
|
| 178 |
<p>
|
| 179 |
If you are using PPPoE to connect to the Internet or you are using a dial-up
|
| 180 |
modem, you will need the following options in the kernel:
|
| 181 |
</p>
|
| 182 |
|
| 183 |
<pre caption="Selecting PPPoE necessary drivers">
|
| 184 |
Device Drivers --->
|
| 185 |
Networking support --->
|
| 186 |
<*> PPP (point-to-point protocol) support
|
| 187 |
<*> PPP support for async serial ports
|
| 188 |
<*> PPP support for sync tty ports
|
| 189 |
</pre>
|
| 190 |
|
| 191 |
<p>
|
| 192 |
The two compression options won't harm but are not definitely needed, neither
|
| 193 |
does the <c>PPP over Ethernet</c> option, that might only be used by
|
| 194 |
<c>rp-pppoe</c> when configured to do kernel mode PPPoE.
|
| 195 |
</p>
|
| 196 |
|
| 197 |
<p>
|
| 198 |
If you require it, don't forget to include support in the kernel for your
|
| 199 |
ethernet card.
|
| 200 |
</p>
|
| 201 |
|
| 202 |
<p>
|
| 203 |
Users of NewWorld and OldWorld machines will want HFS support as well. OldWorld
|
| 204 |
users require it for copying compiled kernels to the MacOS partition. NewWorld
|
| 205 |
users require it for configuring the special Apple_Bootstrap partition:
|
| 206 |
</p>
|
| 207 |
|
| 208 |
<pre caption="Activating HFS support">
|
| 209 |
File Systems --->
|
| 210 |
[*] HFS Support
|
| 211 |
</pre>
|
| 212 |
|
| 213 |
<p>
|
| 214 |
At this time, kernel preemption is still unstable on PPC and may cause
|
| 215 |
compilation failures and random segfaults. It is <e>strongly</e> suggested
|
| 216 |
that you do not use this feature.
|
| 217 |
</p>
|
| 218 |
|
| 219 |
<pre caption="Ensure the Preemptible Kernel Option is Off">
|
| 220 |
Platform options --->
|
| 221 |
[ ] Preemptible Kernel
|
| 222 |
</pre>
|
| 223 |
|
| 224 |
<p>
|
| 225 |
If you're booting from Firewire, you'll need to enable these options. If you
|
| 226 |
do not want to compile in support, you'll need to include these modules and
|
| 227 |
their dependencies in an initrd.
|
| 228 |
</p>
|
| 229 |
|
| 230 |
<pre caption="Enable support for firewire devices on boot">
|
| 231 |
Device Drivers --->
|
| 232 |
IEEE 1394 (FireWire) support --->
|
| 233 |
<*> IEEE 1394 (FireWire) support
|
| 234 |
<*> OHCI-1394 support
|
| 235 |
<*> SBP-2 support (Harddisks etc.)
|
| 236 |
</pre>
|
| 237 |
|
| 238 |
<p>
|
| 239 |
If you're booting from USB, you'll need to enable these options. If you do not
|
| 240 |
want to compile in support, you'll need to include these modules and their
|
| 241 |
dependencies in an initrd.
|
| 242 |
</p>
|
| 243 |
|
| 244 |
<pre caption="Enable support for USB devices on boot">
|
| 245 |
Device Drivers --->
|
| 246 |
USB support --->
|
| 247 |
<*> Support for Host-side USB
|
| 248 |
<*> OHCI HCD support
|
| 249 |
<*> USB Mass Storage support
|
| 250 |
</pre>
|
| 251 |
|
| 252 |
<p>
|
| 253 |
Do not turn off kernel framebuffer support as it is required for a successful
|
| 254 |
boot. If you are using an NVIDIA based chipset, you should use the OpenFirmware
|
| 255 |
framebuffer. If you are using an ATI based chipset, you should select the
|
| 256 |
framebuffer driver based upon your chipset (Mach64, Rage128 or Radeon).
|
| 257 |
</p>
|
| 258 |
|
| 259 |
<pre caption="Chosing a Framebuffer Driver">
|
| 260 |
Device Drivers --->
|
| 261 |
Graphics support --->
|
| 262 |
<*> Support for frame buffer devices
|
| 263 |
[*] Open Firmware frame buffer device support
|
| 264 |
<*> ATI Radeon display support
|
| 265 |
<*> ATI Rage128 display support
|
| 266 |
<*> ATI Mach64 display support
|
| 267 |
Console display driver support --->
|
| 268 |
<*> Framebuffer Console support
|
| 269 |
</pre>
|
| 270 |
|
| 271 |
<note>
|
| 272 |
If you select more than one framebuffer device, it may default to a less than
|
| 273 |
optimal driver. Either use only one framebuffer device or specify which
|
| 274 |
to use by passing the driver to use to the kernel on boot such as
|
| 275 |
<c>video=radeonfb</c>.
|
| 276 |
</note>
|
| 277 |
|
| 278 |
<p>
|
| 279 |
When you're done configuring your kernel, continue with <uri
|
| 280 |
link="#compiling">Compiling and Installing</uri>.
|
| 281 |
</p>
|
| 282 |
|
| 283 |
</body>
|
| 284 |
</subsection>
|
| 285 |
<subsection id="compiling">
|
| 286 |
<title>Compiling and Installing</title>
|
| 287 |
<body>
|
| 288 |
|
| 289 |
<p>
|
| 290 |
Now that your kernel is configured, it is time to compile and install it. Exit
|
| 291 |
the configuration and run the commands which will compile the kernel:
|
| 292 |
</p>
|
| 293 |
|
| 294 |
<pre caption="Compiling the kernel">
|
| 295 |
# <i>make && make modules_install</i>
|
| 296 |
</pre>
|
| 297 |
|
| 298 |
<p>
|
| 299 |
When the kernel has finished compiling, copy the kernel image to
|
| 300 |
<path>/boot</path> (be sure that it is mounted properly on Pegasos computers).
|
| 301 |
If you are using BootX to boot, we'll copy the kernel later.
|
| 302 |
</p>
|
| 303 |
|
| 304 |
<p>
|
| 305 |
Yaboot and BootX expect to use an uncompressed kernel unlike many other
|
| 306 |
bootloaders. The uncompressed kernel is called vmlinux and it is placed in
|
| 307 |
<path>/usr/src/linux</path> after the kernel has finished compiling. If you
|
| 308 |
are using a Pegasos machine, the Pegasos firmware requires a compressed
|
| 309 |
kernel called zImage.chrp which can be found in
|
| 310 |
<path>/usr/src/linux/arch/ppc/boot/images</path>.
|
| 311 |
</p>
|
| 312 |
|
| 313 |
<pre caption="Installing the kernel">
|
| 314 |
# <i>cd /usr/src/linux</i>
|
| 315 |
<comment>replace <kernel-version> with your kernel version</comment>
|
| 316 |
<comment>(Apple/IBM)</comment>
|
| 317 |
# <i>cp vmlinux /boot/<kernel-version></i>
|
| 318 |
<comment>(Pegasos)</comment>
|
| 319 |
# <i>cp arch/ppc/boot/images/zImage.chrp /boot/<kernel-version></i>
|
| 320 |
</pre>
|
| 321 |
|
| 322 |
<p>
|
| 323 |
Now continue with <uri link="#kernel_modules">Installing Separate Kernel
|
| 324 |
Modules</uri>.
|
| 325 |
</p>
|
| 326 |
|
| 327 |
</body>
|
| 328 |
</subsection>
|
| 329 |
</section>
|
| 330 |
<section id="kernel_modules">
|
| 331 |
<title>Installing Separate Kernel Modules</title>
|
| 332 |
<subsection>
|
| 333 |
<title>Configuring the Modules</title>
|
| 334 |
<body>
|
| 335 |
|
| 336 |
<p>
|
| 337 |
You should list the modules you want automatically loaded in
|
| 338 |
<path>/etc/modules.autoload.d/kernel-2.6</path>.
|
| 339 |
You can add extra options to the modules too if needed.
|
| 340 |
</p>
|
| 341 |
|
| 342 |
<p>
|
| 343 |
To view all available modules, run the following <c>find</c> command. Don't
|
| 344 |
forget to substitute "<kernel version>" with the version of the kernel you
|
| 345 |
just compiled:
|
| 346 |
</p>
|
| 347 |
|
| 348 |
<pre caption="Viewing all available modules">
|
| 349 |
# <i>find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko'</i>
|
| 350 |
</pre>
|
| 351 |
|
| 352 |
<p>
|
| 353 |
For instance, to automatically load the <c>3c59x.o</c> module, edit the
|
| 354 |
<path>kernel-2.6</path> file and enter the module
|
| 355 |
name in it.
|
| 356 |
</p>
|
| 357 |
|
| 358 |
<pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
|
| 359 |
# <i>nano -w /etc/modules.autoload.d/kernel-2.6</i>
|
| 360 |
</pre>
|
| 361 |
|
| 362 |
<pre caption="/etc/modules.autoload.d/kernel-2.6">
|
| 363 |
3c59x
|
| 364 |
</pre>
|
| 365 |
|
| 366 |
<p>
|
| 367 |
Continue the installation with <uri link="?part=1&chap=8">Configuring
|
| 368 |
your System</uri>.
|
| 369 |
</p>
|
| 370 |
|
| 371 |
</body>
|
| 372 |
</subsection>
|
| 373 |
</section>
|
| 374 |
<section id="genkernel">
|
| 375 |
<title>Alternative: Using genkernel</title>
|
| 376 |
<body>
|
| 377 |
|
| 378 |
<p>
|
| 379 |
If you are reading this section, you have chosen to use our <c>genkernel</c>
|
| 380 |
script to configure your kernel for you.
|
| 381 |
</p>
|
| 382 |
|
| 383 |
<p>
|
| 384 |
Now that your kernel source tree is installed, it's now time to compile your
|
| 385 |
kernel by using our <c>genkernel</c> script to automatically build a kernel for
|
| 386 |
you. <c>genkernel</c> works by configuring a kernel nearly identically to the
|
| 387 |
way our Installation CD kernel is configured. This means that when you use
|
| 388 |
<c>genkernel</c> to build your kernel, your system will generally detect all
|
| 389 |
your hardware at boot-time, just like our Installation CD does.
|
| 390 |
Because genkernel doesn't require any manual kernel configuration, it is an
|
| 391 |
ideal solution for those users who may not be comfortable compiling their own
|
| 392 |
kernels.
|
| 393 |
</p>
|
| 394 |
|
| 395 |
<p>
|
| 396 |
Now, let's see how to use genkernel. First, emerge the genkernel ebuild:
|
| 397 |
</p>
|
| 398 |
|
| 399 |
<pre caption="Emerging genkernel">
|
| 400 |
# <i>emerge genkernel</i>
|
| 401 |
</pre>
|
| 402 |
|
| 403 |
<p>
|
| 404 |
Next, copy over the kernel configuration used by the Installation CD to the
|
| 405 |
location where genkernel looks for the default kernel configuration:
|
| 406 |
</p>
|
| 407 |
|
| 408 |
<pre caption="Copying over the Installation CD kernel config">
|
| 409 |
# <i>zcat /proc/config.gz > /usr/share/genkernel/ppc/kernel-config-2.6</i>
|
| 410 |
</pre>
|
| 411 |
|
| 412 |
<p>
|
| 413 |
If you are using firewire or USB to boot, you'll need to add modules to the
|
| 414 |
initrd. Edit <path>/usr/share/genkernel/ppc/modules_load</path> and change
|
| 415 |
<c>MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"</c> for firewire support or
|
| 416 |
<c>MODULES_USB="usbcore ohci-hcd ehci-hcd usb-storage"</c> for USB support.
|
| 417 |
</p>
|
| 418 |
|
| 419 |
<p>
|
| 420 |
Now, compile your kernel sources by running <c>genkernel --genzimage all</c>.
|
| 421 |
For Pegasos, we will need to use a different config and create a zImage instead
|
| 422 |
of the vmlinux kernel used on Apple machines. Be aware, as <c>genkernel</c>
|
| 423 |
compiles a kernel that supports almost all hardware, this compilation can take
|
| 424 |
quite a while to finish!
|
| 425 |
</p>
|
| 426 |
|
| 427 |
<p>
|
| 428 |
Note that, if your partition where the kernel should be located doesn't use ext2
|
| 429 |
or ext3 as filesystem you might need to manually configure your kernel using
|
| 430 |
<c>genkernel --menuconfig --genzimage all</c> and add support for your
|
| 431 |
filesystem <e>in</e> the kernel (i.e. <e>not</e> as a module). Users of EVMS2 or
|
| 432 |
LVM2 will probably want to add <c>--evms2</c> or <c>--lvm2</c> as argument as
|
| 433 |
well.
|
| 434 |
</p>
|
| 435 |
|
| 436 |
<pre caption="Running genkernel">
|
| 437 |
# <i>genkernel all</i>
|
| 438 |
</pre>
|
| 439 |
|
| 440 |
<pre caption="Running genkernel on the Pegasos">
|
| 441 |
# <i>genkernel --genzimage --kernel-config=/usr/share/genkernel/ppc/Pegasos all</i>
|
| 442 |
</pre>
|
| 443 |
|
| 444 |
<p>
|
| 445 |
Once <c>genkernel</c> completes, a kernel, full set of modules and
|
| 446 |
<e>initial root disk</e> (initrd) will be created. We will use the kernel
|
| 447 |
and initrd when configuring a boot loader later in this document. Write
|
| 448 |
down the names of the kernel and initrd as you will need it when writing
|
| 449 |
the bootloader configuration file. The initrd will be started immediately after
|
| 450 |
booting to perform hardware autodetection (just like on the Installation CD)
|
| 451 |
before your "real" system starts up. Be sure to also copy down the required
|
| 452 |
boot arguments, these are required for a successful boot with genkernel.
|
| 453 |
</p>
|
| 454 |
|
| 455 |
<pre caption="Checking the created kernel image name and initrd">
|
| 456 |
# <i>ls /boot/kernel* /boot/initramfs*</i>
|
| 457 |
</pre>
|
| 458 |
|
| 459 |
<p>
|
| 460 |
Now, let's perform one more step to get our system to be more like the
|
| 461 |
Installation CD -- let's emerge <c>coldplug</c>. While the initrd autodetects
|
| 462 |
hardware that is needed to boot your system, <c>coldplug</c> autodetects
|
| 463 |
everything else. To emerge and enable <c>coldplug</c>, type the following:
|
| 464 |
</p>
|
| 465 |
|
| 466 |
<pre caption="Emerging and enabling coldplug">
|
| 467 |
# <i>emerge coldplug</i>
|
| 468 |
# <i>rc-update add coldplug boot</i>
|
| 469 |
</pre>
|
| 470 |
|
| 471 |
<p>
|
| 472 |
Now continue with <uri link="?part=1&chap=8">Configuring your System</uri>.
|
| 473 |
</p>
|
| 474 |
|
| 475 |
</body>
|
| 476 |
</section>
|
| 477 |
|
| 478 |
</sections>
|