| 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.65 2011/08/03 08:22:56 jkt Exp $ --> |
| 8 |
|
| 9 |
<sections> |
| 10 |
|
| 11 |
<abstract> |
| 12 |
The Linux kernel is the core of every distribution. This chapter |
| 13 |
explains how to configure your kernel. |
| 14 |
</abstract> |
| 15 |
|
| 16 |
<version>12</version> |
| 17 |
<date>2011-08-12</date> |
| 18 |
|
| 19 |
<section> |
| 20 |
<title>Timezone</title> |
| 21 |
<body> |
| 22 |
|
| 23 |
<p> |
| 24 |
You first need to select your timezone so that your system knows where it is |
| 25 |
located. Look for your timezone in <path>/usr/share/zoneinfo</path>, then copy |
| 26 |
it to <path>/etc/localtime</path>. Please avoid the |
| 27 |
<path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not |
| 28 |
indicate the expected zones. For instance, <path>GMT-8</path> is in fact |
| 29 |
GMT+8. |
| 30 |
</p> |
| 31 |
|
| 32 |
<pre caption="Setting the timezone information"> |
| 33 |
# <i>ls /usr/share/zoneinfo</i> |
| 34 |
<comment>(Suppose you want to use GMT)</comment> |
| 35 |
# <i>cp /usr/share/zoneinfo/GMT /etc/localtime</i> |
| 36 |
</pre> |
| 37 |
|
| 38 |
</body> |
| 39 |
</section> |
| 40 |
<section> |
| 41 |
<title>Installing the Kernel Sources</title> |
| 42 |
<subsection> |
| 43 |
<title>Choosing a Kernel</title> |
| 44 |
<body> |
| 45 |
|
| 46 |
<p> |
| 47 |
The core around which all distributions are built is the Linux kernel. It is the |
| 48 |
layer between the user programs and your system hardware. Gentoo provides its |
| 49 |
users several possible kernel sources. A full listing with description is |
| 50 |
available at the <uri link="/doc/en/gentoo-kernel.xml">Gentoo Kernel |
| 51 |
Guide</uri>. |
| 52 |
</p> |
| 53 |
|
| 54 |
<p> |
| 55 |
For <keyval id="arch"/>-based systems we have <c>gentoo-sources</c> |
| 56 |
(kernel source patched for extra features). |
| 57 |
</p> |
| 58 |
|
| 59 |
<p> |
| 60 |
Choose your kernel source and install it using <c>emerge</c>. |
| 61 |
</p> |
| 62 |
|
| 63 |
<pre caption="Installing a kernel source"> |
| 64 |
# <i>emerge gentoo-sources</i> |
| 65 |
</pre> |
| 66 |
|
| 67 |
<p> |
| 68 |
When you take a look in <path>/usr/src</path> you should see a symlink called |
| 69 |
<path>linux</path> pointing to your kernel source. In this case, the installed |
| 70 |
kernel source points to <c>gentoo-sources-<keyval id="kernel-version"/></c>. |
| 71 |
Your version may be different, so keep this in mind. |
| 72 |
</p> |
| 73 |
|
| 74 |
<pre caption="Viewing the kernel source symlink"> |
| 75 |
# <i>ls -l /usr/src/linux</i> |
| 76 |
lrwxrwxrwx 1 root root 12 Oct 13 11:04 /usr/src/linux -> linux-<keyval id="kernel-version"/> |
| 77 |
</pre> |
| 78 |
|
| 79 |
<p> |
| 80 |
Now it is time to configure and compile your kernel source. You can use |
| 81 |
<c>genkernel</c> for this, which will build a generic kernel as used by the |
| 82 |
Installation CD. We explain the "manual" configuration first though, as it is |
| 83 |
the best way to optimize your environment. |
| 84 |
</p> |
| 85 |
|
| 86 |
<p> |
| 87 |
If you want to manually configure your kernel, continue now with <uri |
| 88 |
link="#manual">Default: Manual Configuration</uri>. If you want to use |
| 89 |
<c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using |
| 90 |
genkernel</uri> instead. |
| 91 |
</p> |
| 92 |
|
| 93 |
</body> |
| 94 |
</subsection> |
| 95 |
</section> |
| 96 |
<section id="manual"> |
| 97 |
<title>Default: Manual Configuration</title> |
| 98 |
<subsection> |
| 99 |
<title>Introduction</title> |
| 100 |
<body> |
| 101 |
|
| 102 |
<p> |
| 103 |
Manually configuring a kernel is often seen as the most difficult procedure a |
| 104 |
Linux user ever has to perform. Nothing is less true -- after configuring a |
| 105 |
few kernels you won't even remember that it was difficult ;) |
| 106 |
</p> |
| 107 |
|
| 108 |
<p> |
| 109 |
However, one thing <e>is</e> true: you must know your system when you start |
| 110 |
configuring a kernel manually. Most information can be gathered by emerging |
| 111 |
pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now |
| 112 |
be able to use <c>lspci</c> within the chrooted environment. You may safely |
| 113 |
ignore any <e>pcilib</e> warnings (like pcilib: cannot open |
| 114 |
/sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run |
| 115 |
<c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same. |
| 116 |
You can also run <c>lsmod</c> to see what kernel modules the Installation CD |
| 117 |
uses (it might provide you with a nice hint on what to enable). |
| 118 |
</p> |
| 119 |
|
| 120 |
<p> |
| 121 |
Now, go to your kernel source directory, it's time to configure your kernel. |
| 122 |
Start by configuring a kernel that will boot on most 32 Bit PowerPC machines |
| 123 |
by first running <c>make pmac32_defconfig</c>. After the default configuration |
| 124 |
has been generated, run <c>make menuconfig</c> to start an ncurses-based |
| 125 |
configuration menu. |
| 126 |
</p> |
| 127 |
|
| 128 |
<pre caption="Invoking menuconfig"> |
| 129 |
# <i>cd /usr/src/linux</i> |
| 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 go to <c>File Systems</c> and select support for the filesystems you use. |
| 148 |
<e>Don't</e> compile them as modules, otherwise your Gentoo system will not be |
| 149 |
able to mount your partitions. Also select the <c>/proc file system</c> and |
| 150 |
<c>Virtual memory</c>. Make sure that you also enable support for Amiga |
| 151 |
partitions if you are using a Pegasos, or Macintosh partitions if you are using |
| 152 |
an Apple computer. |
| 153 |
</p> |
| 154 |
|
| 155 |
<pre caption="Selecting necessary file systems"> |
| 156 |
File systems ---> |
| 157 |
Pseudo Filesystems ---> |
| 158 |
<comment>(/proc may already be forced on by your configuration, if so, you'll see --- instead)</comment> |
| 159 |
[*] /proc file system support |
| 160 |
[*] Virtual memory file system support (former shm fs) |
| 161 |
Partition Types ---> |
| 162 |
[*] Advanced partition support |
| 163 |
[*] Amiga partition table support |
| 164 |
[*] Macintosh partition map support |
| 165 |
|
| 166 |
<comment>(Select one or more of the following options as needed by your system)</comment> |
| 167 |
<*> Reiserfs support |
| 168 |
<*> Ext3 journalling file system support |
| 169 |
<*> Second extended fs support |
| 170 |
<*> XFS filesystem support |
| 171 |
</pre> |
| 172 |
|
| 173 |
<p> |
| 174 |
Users of NewWorld and OldWorld machines will want HFS support as well. OldWorld |
| 175 |
users require it for copying compiled kernels to the MacOS partition. NewWorld |
| 176 |
users require it for configuring the special Apple_Bootstrap partition: |
| 177 |
</p> |
| 178 |
|
| 179 |
<pre caption="Activating HFS support"> |
| 180 |
File Systems ---> |
| 181 |
Miscellaneous filesystems ---> |
| 182 |
<M> Apple Macintosh file system support |
| 183 |
<M> Apple Extended HFS file system support |
| 184 |
</pre> |
| 185 |
|
| 186 |
<p> |
| 187 |
If you are using PPPoE to connect to the Internet or you are using a dial-up |
| 188 |
modem, you will need the following options in the kernel: |
| 189 |
</p> |
| 190 |
|
| 191 |
<pre caption="Selecting PPPoE necessary drivers"> |
| 192 |
Device Drivers ---> |
| 193 |
Network device support ---> |
| 194 |
<*> PPP (point-to-point protocol) support |
| 195 |
<*> PPP support for async serial ports |
| 196 |
<*> PPP support for sync tty ports |
| 197 |
</pre> |
| 198 |
|
| 199 |
<p> |
| 200 |
The two compression options won't harm but are not always needed. The <c>PPP |
| 201 |
over Ethernet</c> option might only be used by <c>ppp</c> when configured to |
| 202 |
perform kernel mode PPPoE. |
| 203 |
</p> |
| 204 |
|
| 205 |
<p> |
| 206 |
Don't forget to include support in the kernel for your ethernet card! Most |
| 207 |
newer Apple computers use the SunGEM ethernet driver. Older iMacs commonly use |
| 208 |
the BMAC driver. |
| 209 |
</p> |
| 210 |
|
| 211 |
<pre caption="Selecting the network driver"> |
| 212 |
Device Drivers ---> |
| 213 |
Network device support ---> |
| 214 |
Ethernet (10 or 100Mbit) ---> |
| 215 |
[*] Ethernet (10 or 100Mbit) |
| 216 |
<*> Generic Media Independent Interface device support |
| 217 |
<*> MACE (Power Mac ethernet) support |
| 218 |
<*> BMAC (G3 ethernet) support |
| 219 |
<*> Sun GEM support |
| 220 |
</pre> |
| 221 |
|
| 222 |
<p> |
| 223 |
If you're booting from FireWire, you'll need to enable these options. If you do |
| 224 |
not want to compile in support, you'll need to include these modules and their |
| 225 |
dependencies in an initrd. |
| 226 |
</p> |
| 227 |
|
| 228 |
<pre caption="Enable support for FireWire devices on boot"> |
| 229 |
Device Drivers ---> |
| 230 |
IEEE 1394 (FireWire) support ---> |
| 231 |
<*> IEEE 1394 (FireWire) support |
| 232 |
<*> OHCI-1394 support |
| 233 |
<*> SBP-2 support (Harddisks etc.) |
| 234 |
</pre> |
| 235 |
|
| 236 |
<p> |
| 237 |
If you're booting from USB, you'll need to enable these options. If you do not |
| 238 |
want to compile in support, you'll need to include these modules and their |
| 239 |
dependencies in an initrd. |
| 240 |
</p> |
| 241 |
|
| 242 |
<pre caption="Enable support for USB devices on boot"> |
| 243 |
Device Drivers ---> |
| 244 |
USB support ---> |
| 245 |
<*> Support for Host-side USB |
| 246 |
<*> OHCI HCD support |
| 247 |
<*> USB Mass Storage support |
| 248 |
</pre> |
| 249 |
|
| 250 |
<p> |
| 251 |
Do not turn off kernel framebuffer support as it is required for a successful |
| 252 |
boot. If you are using an NVIDIA based chipset, you should use the Open |
| 253 |
Firmware framebuffer. If you are using an ATI based chipset, you should select |
| 254 |
the framebuffer driver based upon your chipset (Mach64, Rage128 or Radeon). |
| 255 |
</p> |
| 256 |
|
| 257 |
<pre caption="Choosing a Framebuffer Driver"> |
| 258 |
Device Drivers ---> |
| 259 |
Graphics support ---> |
| 260 |
<*> Support for frame buffer devices |
| 261 |
[*] Open Firmware frame buffer device support |
| 262 |
<*> ATI Radeon display support |
| 263 |
<*> ATI Rage128 display support |
| 264 |
<*> ATI Mach64 display support |
| 265 |
Console display driver support ---> |
| 266 |
<*> Framebuffer Console support |
| 267 |
</pre> |
| 268 |
|
| 269 |
<note> |
| 270 |
If you select more than one framebuffer device, it may default to a less than |
| 271 |
optimal driver. Either use only one framebuffer device or specify which to use |
| 272 |
by passing the driver to use to the kernel on boot by appending a video line |
| 273 |
such as: <c>video=radeonfb</c>. |
| 274 |
</note> |
| 275 |
|
| 276 |
<p> |
| 277 |
When you're done configuring your kernel, continue with <uri |
| 278 |
link="#compiling">Compiling and Installing</uri>. |
| 279 |
</p> |
| 280 |
|
| 281 |
</body> |
| 282 |
</subsection> |
| 283 |
<subsection id="compiling"> |
| 284 |
<title>Compiling and Installing</title> |
| 285 |
<body> |
| 286 |
|
| 287 |
<p> |
| 288 |
Now that your kernel is configured, it is time to compile and install it. Exit |
| 289 |
the configuration menu and run the following commands: |
| 290 |
</p> |
| 291 |
|
| 292 |
<pre caption="Compiling the kernel"> |
| 293 |
# <i>make && make modules_install</i> |
| 294 |
</pre> |
| 295 |
|
| 296 |
<p> |
| 297 |
When the kernel has finished compiling, copy the kernel image to |
| 298 |
<path>/boot</path> as shown below. If you have a separate boot partition, as |
| 299 |
on Pegasos computers, be sure that it is mounted properly. If you are using |
| 300 |
BootX to boot, we'll copy the kernel later. |
| 301 |
</p> |
| 302 |
|
| 303 |
<p> |
| 304 |
Yaboot and BootX expect to use an uncompressed kernel unlike many other |
| 305 |
bootloaders. The uncompressed kernel is called vmlinux and it is placed in |
| 306 |
<path>/usr/src/linux</path> after the kernel has finished compiling. If you are |
| 307 |
using a Pegasos machine, the Pegasos firmware requires a compressed kernel |
| 308 |
called zImage which can be found in |
| 309 |
<path>/usr/src/linux/arch/powerpc/boot/images</path>. |
| 310 |
</p> |
| 311 |
|
| 312 |
<pre caption="Installing the kernel"> |
| 313 |
# <i>cd /usr/src/linux</i> |
| 314 |
<comment>Note, your kernel version might be different</comment> |
| 315 |
<comment>(Apple/IBM)</comment> |
| 316 |
# <i>cp vmlinux /boot/<keyval id="kernel-name"/></i> |
| 317 |
<comment>(Pegasos)</comment> |
| 318 |
# <i>cp arch/powerpc/boot/images/zImage /boot/<keyval id="kernel-name"/></i> |
| 319 |
</pre> |
| 320 |
|
| 321 |
<p> |
| 322 |
Now continue with <uri link="#kernel_modules">Kernel Modules</uri>. |
| 323 |
</p> |
| 324 |
|
| 325 |
</body> |
| 326 |
</subsection> |
| 327 |
</section> |
| 328 |
<section id="genkernel"> |
| 329 |
<title>Alternative: Using genkernel</title> |
| 330 |
<body> |
| 331 |
|
| 332 |
<p> |
| 333 |
Now that your kernel source tree is installed, it's now time to compile your |
| 334 |
kernel by using our <c>genkernel</c> script to automatically build a kernel for |
| 335 |
you. <c>genkernel</c> works by configuring a kernel nearly identically to the |
| 336 |
way our Installation CD kernel is configured. This means that when you use |
| 337 |
<c>genkernel</c> to build your kernel, your system will generally detect all |
| 338 |
your hardware at boot-time, just like our Installation CD does. Because |
| 339 |
genkernel doesn't require any manual kernel configuration, it is an ideal |
| 340 |
solution for those users who may not be comfortable compiling their own |
| 341 |
kernels. |
| 342 |
</p> |
| 343 |
|
| 344 |
<p> |
| 345 |
Now, let's see how to use genkernel. First, emerge the genkernel ebuild: |
| 346 |
</p> |
| 347 |
|
| 348 |
<pre caption="Emerging genkernel"> |
| 349 |
# <i>emerge genkernel</i> |
| 350 |
</pre> |
| 351 |
|
| 352 |
<p> |
| 353 |
Next, copy over the kernel configuration used by the Installation CD to the |
| 354 |
location where genkernel looks for the default kernel configuration: |
| 355 |
</p> |
| 356 |
|
| 357 |
<pre caption="Copying over the Installation CD kernel config"> |
| 358 |
# <i>zcat /proc/config.gz > /usr/share/genkernel/arch/ppc/kernel-config</i> |
| 359 |
</pre> |
| 360 |
|
| 361 |
<p> |
| 362 |
If you are using FireWire or USB to boot, you'll need to add modules to the |
| 363 |
initrd. Edit <path>/usr/share/genkernel/arch/ppc/modules_load</path> and change |
| 364 |
<c>MODULES_FIREWIRE="ieee1394 ohci1394 sbp2"</c> for FireWire support or |
| 365 |
<c>MODULES_USB="usbcore ohci-hcd ehci-hcd usb-storage"</c> for USB support. |
| 366 |
</p> |
| 367 |
|
| 368 |
<p> |
| 369 |
Before compiling your sources, the fstab needs a slight adjustment. The rest of |
| 370 |
the fstab will be completed during a later step, so don't worry about the |
| 371 |
details now. If you did not create a separate boot partition (NOT bootstrap, |
| 372 |
that's different), remove the line referencing <path>/boot</path> from |
| 373 |
<path>/etc/fstab</path>. This will need to be done on most Apple computers. |
| 374 |
</p> |
| 375 |
|
| 376 |
<pre caption="Removing /boot from /etc/fstab on machines without a boot partition"> |
| 377 |
# <i>nano -w /etc/fstab</i> |
| 378 |
<comment>Remove this line</comment> |
| 379 |
/dev/BOOT /boot ext2 noauto,noatime 1 2 |
| 380 |
</pre> |
| 381 |
|
| 382 |
<p> |
| 383 |
Now, compile your kernel sources by running <c>genkernel --genzimage all</c>. |
| 384 |
For Pegasos, we will need to use a different config and create a zImage instead |
| 385 |
of the vmlinux kernel used on Apple machines. Be aware, as <c>genkernel</c> |
| 386 |
compiles a kernel that supports almost all hardware, this compilation can take |
| 387 |
quite a while to finish! |
| 388 |
</p> |
| 389 |
|
| 390 |
<p> |
| 391 |
Note that, if your partition where the kernel should be located doesn't use ext2 |
| 392 |
or ext3 as filesystem you might need to manually configure your kernel using |
| 393 |
<c>genkernel --menuconfig all</c> and add support for your |
| 394 |
filesystem <e>in</e> the kernel (i.e. <e>not</e> as a module). Users of EVMS2 or |
| 395 |
LVM2 will probably want to add <c>--evms2</c> or <c>--lvm2</c> as an argument as |
| 396 |
well. |
| 397 |
</p> |
| 398 |
|
| 399 |
<pre caption="Running genkernel"> |
| 400 |
# <i>genkernel all</i> |
| 401 |
</pre> |
| 402 |
|
| 403 |
<pre caption="Running genkernel on the Pegasos"> |
| 404 |
# <i>genkernel --genzimage all</i> |
| 405 |
</pre> |
| 406 |
|
| 407 |
<p> |
| 408 |
Once <c>genkernel</c> completes, a kernel, full set of modules and |
| 409 |
<e>initial ram disk</e> (initramfs) will be created. We will use the kernel |
| 410 |
and initrd when configuring a boot loader later in this document. Write |
| 411 |
down the names of the kernel and initrd as you will need them when writing |
| 412 |
the bootloader configuration file. The initrd will be started immediately after |
| 413 |
booting to perform hardware autodetection (just like on the Installation CD) |
| 414 |
before your "real" system starts up. Be sure to also copy down the required |
| 415 |
boot arguments, these are required for a successful boot with genkernel. |
| 416 |
</p> |
| 417 |
|
| 418 |
<pre caption="Checking the created kernel image name and initrd"> |
| 419 |
<comment>Note, your kernel version might be different</comment> |
| 420 |
# <i>ls /boot/<keyval id="genkernel-name"/> /boot/<keyval id="genkernel-initrd"/></i> |
| 421 |
</pre> |
| 422 |
|
| 423 |
<p> |
| 424 |
Now continue with <uri link="#kernel_modules">Kernel Modules</uri>. |
| 425 |
</p> |
| 426 |
|
| 427 |
</body> |
| 428 |
</section> |
| 429 |
<section id="kernel_modules"> |
| 430 |
<title>Kernel Modules</title> |
| 431 |
|
| 432 |
<subsection> |
| 433 |
<include href="hb-install-kernelmodules.xml"/> |
| 434 |
</subsection> |
| 435 |
|
| 436 |
</section> |
| 437 |
</sections> |