<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE sections SYSTEM "/dtd/book.dtd">

<!-- The content of this document is licensed under the CC-BY-SA license -->
<!-- See http://creativecommons.org/licenses/by-sa/1.0 -->

<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-ppc-kernel.xml,v 1.2 2004/04/28 07:52:30 swift Exp $ -->

<sections>
<section>
<title>Timezone</title>
<body>

<p>
You first need to select your timezone so that your system knows where it is
located. Look for your timezone in <path>/usr/share/zoneinfo</path>, then make a
symlink to <path>/etc/localtime</path> using <c>ln</c>:
</p>

<pre caption="Setting the timezone information">
# <i>ls /usr/share/zoneinfo</i>
<comment>(Suppose you want to use GMT)</comment>
# <i>ln -sf /usr/share/zoneinfo/GMT /etc/localtime</i>
</pre>

</body>
</section>
<section>
<title>Installing the Sources</title>
<subsection>
<title>Choosing a Kernel</title>
<body>

<p>
The core around which all distributions are built is the Linux kernel. It is the
layer between the user programs and your system hardware. Gentoo provides its
users several possible kernel sources. A full listing with description is
available at the <uri link="/doc/en/gentoo-kernel.xml">Gentoo Kernel
Guide</uri>. 
</p>

<p>
For PPC you can choose between <c>ppc-sources</c>, <c>ppc-sources-benh</c>,
<c>ppc-sources-dev</c>, <c>ppc-sources-crypto</c> and
<c>ppc-development-sources</c>. This latter kernel is available when you
perform a networkless installation. So let's continue with
<c>emerge</c>'ing the kernel sources:
</p>

<pre caption="Installing a kernel source">
# <i>emerge ppc-development-sources</i>
</pre>

<p>
When you take a look in <path>/usr/src</path> you should see a symlink called
<path>linux</path> pointing to your kernel source:
</p>

<pre caption="Viewing the kernel source symlink">
# <i>ls -l /usr/src/linux</i>
lrwxrwxrwx    1 root     root           12 Oct 13 11:04 /usr/src/linux -&gt; linux-2.6.1
</pre>

<p>
If this isn't the case (i.e. the symlink points to a different kernel source) 
change the symlink before you continue:
</p>

<pre caption="Changing the kernel source symlink">
# <i>rm /usr/src/linux &amp;&amp; ln -s /usr/src/linux-2.6.1 /usr/src/linux</i>
</pre>

<p>
Now it is time to configure and compile your kernel source. All architectures 
can use <c>genkernel</c> for this, which will build a generic kernel as used 
by the LiveCD. We explain the "manual" configuration first though, as it is 
the best way to optimize your environment.
</p>

<p>
Continue now with <uri link="#manual">Manual Configuration</uri>. 
</p>

</body>
</subsection>
</section>
<section id="manual">
<title>Manual Configuration</title>
<subsection>
<title>Introduction</title>
<body>

<p>
Manually configuring a kernel is often seen as the most difficult course every
Linux users ever has to go through. Nothing is less true -- after configuring a
couple of kernels you don't even remember that it was difficult ;)
</p>

<p>
However, one thing <e>is</e> true: you must know your system when you start
configuring a kernel manually. Most information can be gathered by viewing the
contents of <path>/proc/pci</path> (or by using <c>lspci</c> if available). You
can also run <c>lsmod</c> to see what kernel modules the LiveCD uses (it might
provide you with a nice hint on what to enable).
</p>

<p>
Now go to your kernel source directory and execute <c>make menuconfig</c>. This
will fire up an ncurses-based configuration menu.
</p>

<pre caption="Invoking menuconfig">
# <i>cd /usr/src/linux</i>
# <i>make menuconfig</i>
</pre>

<p>
You will be greeted with several configuration sections. We'll first list some
options you must activate (otherwise Gentoo will not function, or not function
properly without additional tweaks).
</p>

</body>
</subsection>
<subsection>
<title>Activating Required Options</title>
<body>

<p>
First of all, activate the use of development and experimental code/drivers.
You need this, otherwise some very important code/drivers won't show up:
</p>

<pre caption="Selecting experimental code/drivers">
Code maturity level options ---&gt;
  [*] Prompt for development and/or incomplete code/drivers
</pre>

<p>
Now go to <c>File Systems</c> and select support for the filesystems you use.
<e>Don't</e> compile them as modules, otherwise your Gentoo system will not be
able to mount your partitions. Also select <c>Virtual memory</c>, <c>/proc
file system</c>, <c>/dev file system</c> + <c>Automatically mount at boot</c>:
</p>

<pre caption="Selecting necessary file systems">
File systems ---&gt;
  [*] Virtual memory file system support (former shm fs)
  [*] /proc file system support
  [*] /dev file system support (EXPERIMENTAL)
  [*]   Automatically mount at boot

<comment>(Deselect the following unless you have a 2.6 kernel)</comment>
  [ ] /dev/pts file system for Unix98 PTYs

<comment>(Select one or more of the following options as needed by your system)</comment>
  &lt;*&gt; Reiserfs support
  &lt;*&gt; Ext3 journalling file system support
  &lt;*&gt; JFS filesystem support
  &lt;*&gt; Second extended fs support
  &lt;*&gt; XFS filesystem support
</pre>

<note>
Users of a 2.6 kernel will find some of the mentioned options under <c>Pseudo
filesystems</c> which is a subpart of <c>File systems</c>.
</note>

<p>
If you are using PPPoE to connect to the Internet or you are using a dial-up
modem, you will need the following options in the kernel:
</p>

<pre caption="Selecting PPPoE necessary drivers">
Network device support ---&gt;
  &lt;*&gt; PPP (point-to-point protocol) support
  &lt;*&gt;   PPP support for async serial ports
  &lt;*&gt;   PPP support for sync tty ports
</pre>

<note>
Users of a 2.6 kernel will find the mentioned options under <c>Networking
support</c> which is a subpart of <c>Device Drivers</c>.
</note>

<p>
The two compression options won't harm but are not definitely needed, neither
does the <c>PPP over Ethernet</c> option, that might only be used by 
<c>rp-pppoe</c> when configured to do kernel mode PPPoE.
</p>

<p>
If you require it, don't forget to include support in the kernel for your
ethernet card.
</p>

<p>
Disable ADB raw keycodes:
</p>

<pre caption="Disabling ADB raw keycodes">
Macintosh Device Drivers ---&gt;
  [ ] Support for ADB raw keycodes
</pre>

<p>
Also choose the correct RTC support (<e>disable</e> the <c>Enhanced RTC</c> 
option):
</p>

<pre caption="Activating the correct RTC option">
Character devices ---&gt;
  [ ] Enhanced RTC

General setup ---&gt;
  [*] Support for /dev/rtc
</pre>

<p>
Users of OldWorld machines will want HFS support so they can copy compiled
kernels to the MacOS partition.
</p>

<pre caption="Activating HFS support">
File Systems ---&gt;
  [*] HFS Support
</pre>

<p>
When you're done configuring your kernel, continue with <uri
link="#compiling">Compiling and Installing</uri>.
</p>

</body>
</subsection>
<subsection id="compiling">
<title>Compiling and Installing</title>
<body>

<p>
Now that your kernel is configured, it is time to compile and install it. Exit 
the configuration and run <c>make dep &amp;&amp; make vmlinux modules 
modules_install</c> or on the Pegasos run <c>make dep &amp;&amp; make zImage
modules modules_install</c>:
</p>

<pre caption="Compiling the kernel">
(Apple/IBM)  # <i>make dep &amp;&amp; make vmlinux modules modules_install</i>
(Pegasos)    # <i>make dep &amp;&amp; make zImage modules modules_install</i>
</pre>

<p>
When the kernel is done compiling, copy over the kernel image to
<path>/boot</path>. 
</p>

<pre caption="Installing the kernel">
(Apple/IBM)  # <i>cp vmlinux /boot/kernel-2.4.24</i>
(Pegasos)    # <i>cp arch/ppc/boot/images/zImage.chrp /boot/kernel-2.4.24</i>
</pre>

<p>
Also don't forget to copy over the system map:
</p>

<pre caption="Copying the system map">
# <i>cp System.map /boot/System.map-2.4.24</i>
</pre>

<p>
It is also wise to copy over your kernel configuration file to
<path>/boot</path>, just in case :)
</p>

<pre caption="Backing up your kernel configuration">
# <i>cp .config /boot/config-2.4.24</i>
</pre>

<p>
Now continue with <uri link="#kernel_modules">Installing Separate Kernel
Modules</uri>.
</p>

</body>
</subsection>
</section>
<section id="kernel_modules">
<title>Installing Separate Kernel Modules</title>
<subsection>
<title>Installing Extra Modules</title>
<body>

<p>
If appropriate, you should emerge ebuilds for any additional hardware that is 
on your system. Here is a list of kernel-related ebuilds that you could emerge:
</p>

<table>
<tcolumn width="1in"/>
<tcolumn width="4in"/>
<tcolumn width="2in"/>
<tr>
  <th>Ebuild</th>
  <th>Purpose</th>
  <th>Command</th>
</tr>
<tr>
  <ti>xfree-drm</ti>
  <ti>
    Accelerated graphics for ATI Radeon up to 9200, Rage128, Matrox, Voodoo and
    other cards for XFree86. Please check the <c>IUSE_VIDEO_CARDS</c> variable
    in the <path>/usr/portage/x11-base/xfree-drm</path> ebuilds to see what you
    need to fill in as <c>yourcard</c>.
  </ti>
  <ti><c>VIDEO_CARDS="yourcard" emerge xfree-drm</c></ti>
</tr>
</table>

<p>
Beware though, some of these ebuilds might deal with big dependencies. To verify
what packages will be installed by emerging an ebuild, use <c>emerge 
--pretend</c>. For instance, for the <c>xfree-drm</c> package:
</p>

<pre caption="View full installation package listing">
# <i>emerge --pretend xfree-drm</i>
</pre>

</body>
</subsection>
<subsection>
<title>Configuring the Modules</title>
<body>

<p>
You should list the modules you want automatically loaded in 
<path>/etc/modules.autoload.d/kernel-2.4</path> (or <path>kernel-2.6</path>). 
You can add extra options to the modules too if you want.
</p>

<p>
To view all available modules, run the following <c>find</c> command. Don't
forget to substitute "&lt;kernel version&gt;" with the version of the kernel you
just compiled:
</p>

<pre caption="Viewing all available modules">
# <i>find /lib/modules/&lt;kernel version&gt;/ -type f -iname '*.o' -or -iname '*.ko'</i>
</pre>

<p>
For instance, to automatically load the <c>3c59x.o</c> module, edit the
<path>kernel-2.4</path> or <path>kernel-2.6</path> file and enter the module
name in it.
</p>

<pre caption="Editing /etc/modules.autoload.d/kernel-2.4">
<comment>(Example for 2.4 kernels)</comment>
# <i>nano -w /etc/modules.autoload.d/kernel-2.4</i>
</pre>

<pre caption="/etc/modules.autoload.d/kernel-2.4 or kernel-2.6">
3c59x
</pre>

<p>
Now run <c>modules-update</c> to commit your changes to the
<path>/etc/modules.conf</path> file:
</p>

<pre caption="Running modules-update">
# <i>modules-update</i>
</pre>

<p>
Continue the installation with <uri link="?part=1&amp;chap=8">Configuring 
your System</uri>.
</p>

</body>
</subsection>
</section>
</sections>
