<?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/2.5 -->

<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/2008.0/hb-install-ppc64-kernel.xml,v 1.4 2009/08/05 15:25:24 nightmorph Exp $ -->

<sections>

<version>9.1</version>
<date>2009-08-05</date>

<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 copy
it to <path>/etc/localtime</path>. Please avoid the
<path>/usr/share/zoneinfo/Etc/GMT*</path> timezones as their names do not
indicate the expected zones. For instance, <path>GMT-8</path> is in fact
GMT+8.
</p>

<pre caption="Setting the timezone information">
# <i>ls /usr/share/zoneinfo</i>
<comment>(Suppose you want to use GMT)</comment>
# <i>cp /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 PPC64 you should use <c>gentoo-sources</c>.
</p>

<pre caption="Installing a kernel source">
# <i>emerge gentoo-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. In this case, the installed
kernel source points to <c>gentoo-sources-<keyval id="kernel-version"/></c>.
Your version may be different, so keep this in mind.
</p>

<pre caption="Viewing the kernel source symlink">
# <i>ls -l /usr/src/linux</i>
lrwxrwxrwx    1 root    root       12 Aug 10 11:04 /usr/src/linux -&gt; linux-<keyval id="kernel-version"/>
</pre>

<p>
Now it is time to configure and compile your kernel source. There is the
ability to use "genkernel" which would create a generic kernel like the
ones used on the installation CDs, but it is not fully functional for PPC64 at
the moment.
</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 procedure a
Linux user ever has to perform. 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
configuring a kernel manually. Most information can be gathered by emerging 
pciutils (<c>emerge pciutils</c>) which contains <c>lspci</c>. You will now 
be able to  use <c>lspci</c> within the chrooted environment. You may safely 
ignore any <e>pcilib</e> warnings (like pcilib: cannot open 
/sys/bus/pci/devices) that <c>lspci</c> throws out. Alternatively, you can run 
<c>lspci</c> from a <e>non-chrooted</e> environment. The results are the same. 
You can also run <c>lsmod</c> to see what kernel modules the Installation CD 
uses (it might provide you with a nice hint on what to enable).
</p>

<pre caption="Invoking menuconfig">
# <i>cd /usr/src/linux</i>
<comment>Important: In case you are in 32-bit userland, you must edit the top
level Makefile in /usr/src/linux and change the CROSS_COMPILE option to
CROSS_COMPILE ?= powerpc64-unknown-linux-gnu-. You must do this before you run
make menuconfig or it may result in kernel compilation problems.</comment>
# <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 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>, and <c>/dev/pts file system for Unix98 PTYs</c>:
</p>

<pre caption="Selecting necessary file systems">
File systems ---&gt;
  [*] Virtual memory file system support (former shm fs)
  [*] /proc file system support
  [*] /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>
You 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 (you
will find the mentioned options under <c>Networking support</c> which is
a subpart of <c>Device Drivers</c>):
</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>

<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>ppp</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>
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 start the compilation process:
</p>

<pre caption="Compiling the kernel">
# <i>make &amp;&amp; make modules_install</i>
</pre>

<p>
When the kernel has finished compiling, copy the kernel image to
<path>/boot</path>. Remember to replace <path>&lt;kernel-version&gt;</path>
with your actual kernel version: 
</p>

<pre caption="Installing the kernel">
# <i>cp vmlinux /boot/&lt;kernel-version&gt;</i>
</pre>

<p>
Now continue with <uri link="#kernel_modules">Configuring the Modules</uri>.
</p>

</body>
</subsection>
</section>
<section id="kernel_modules">
<title>Configuring the Modules</title>
<body>

<p>
You should list the modules you want automatically loaded in 
<path>/etc/modules.autoload.d/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.ko</c> module, edit the
<path>kernel-2.6</path> file and enter the module name in it.
</p>

<pre caption="Editing /etc/modules.autoload.d/kernel-2.6">
# <i>nano -w /etc/modules.autoload.d/kernel-2.6</i>
</pre>

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

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

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