<?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/hb-install-alpha-kernel.xml,v 1.37 2007/03/13 00:30:09 nightmorph Exp $ -->

<sections>

<version>7.3</version>
<date>2007-03-12</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 alpha-based systems we have <c>vanilla-sources</c> (the default 2.6 kernel source).
</p>

<p>
Choose your kernel source and install it using <c>emerge</c>. 
</p>

<p>
In the next example we install <c>vanilla-sources</c>. Of course substitute with
your choice of sources, this is merely an example.
</p>

<pre caption="Installing a kernel source">
# <i>emerge vanilla-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>vanilla-sources-2.6.16.19</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 Oct 13 11:04 /usr/src/linux -&gt; linux-2.6.16.19
</pre>

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

<p>
If you want to manually configure your kernel, continue now with <uri
link="#manual">Default: Manual Configuration</uri>. If you want to use 
<c>genkernel</c> you should read <uri link="#genkernel">Alternative: Using 
genkernel</uri> instead.
</p>

</body>
</subsection>
</section>
<section id="manual">
<title>Default: 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 start
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>

<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, General setup">
Code maturity level options ---&gt;
  [*] Prompt for development and/or incomplete code/drivers
General setup ---&gt;
  [*] Support for hot-pluggable devices
</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> and <c>/proc
file system</c>.  If you are using a 2.4 kernel, you should also select the 
<c>/dev file system</c> and <c>Automatically mount at boot</c> options, and 
you should make sure to <c>emerge devfsd</c>.
</p>

<pre caption="Selecting necessary file systems">
<comment>(With a 2.4.x kernel)</comment>
File systems ---&gt;
  [*] Virtual memory file system support (former shm fs)
  [*] /proc file system support
  [*] /dev file system support (EXPERIMENTAL)
  [*]   Automatically mount at boot
  [ ] /dev/pts file system for Unix98 PTYs

<comment>(With a 2.6.x kernel)</comment>
File systems ---&gt;
  Pseudo Filesystems ---&gt;
    [*] /proc file system support
    [*] Virtual memory file system support (former shm fs)

<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>

<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">
<comment>(With a 2.4.x kernel)</comment>
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

<comment>(With a 2.6.x kernel)</comment>
Device Drivers ---&gt;
  Networking 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>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>
The following options are recommended as well:
</p>

<pre caption="Recommended Alpha options">
General setup ---&gt;
  &lt;*&gt; SRM environment through procfs
  &lt;*&gt; Configure uac policy via sysctl

Plug and Play configuration ---&gt;
  &lt;*&gt; Plug and Play support
  &lt;M&gt;   ISA Plug and Play support

SCSI support ---&gt;
  SCSI low-level drivers ---&gt;
    &lt;*&gt; SYM53C8XX Version 2 SCSI support (NEW)
    &lt;*&gt; Qlogic ISP SCSI support

Network device support ---&gt;
  Ethernet (10 or 100 Mbit) ---&gt;
    &lt;M&gt; DECchip Tulip (dc21x4x) PCI support
    &lt;M&gt; Generic DECchip &amp; DIGITAL EtherWORKS PCI/EISA
    &lt;M&gt; EtherExpressPro/100 support (eepro100)
    &lt;M&gt; EtherExpressPro/100 support (e100)
  Ethernet (1000 Mbit) ---&gt;
    &lt;M&gt; Alteon AceNIC
      [*] Omit support for old Tigon I
    &lt;M&gt; Broadcom Tigon3
  [*] FDDI driver support
  &lt;M&gt; Digital DEFEA and DEFPA
  &lt;*&gt; PPP support
    &lt;*&gt; PPP Deflate compression

Character devices ---&gt;
  [*] Support for console on serial port
  [*] Direct Rendering Manager

File systems ---&gt;
  &lt;*&gt; Kernel automounter version 4 support
  Network File Systems ---&gt;
    &lt;*&gt; NFS
      [*] NFSv3 client
      &lt;*&gt; NFS server
      [*] NFSv3 server
  Partition Types ---&gt;
    [*] Advanced partition selection
    [*] Alpha OSF partition support
  Native Language Support
    &lt;*&gt; NLS ISO 8859-1

Sound ---&gt;
  &lt;M&gt; Sound card support
    &lt;M&gt; OSS sound modules
      [*] Verbose initialisation
      [*] Persistent DMA buffers
      &lt;M&gt; 100% Sound Blaster compatibles
</pre>

<p>
When you've finished configuring the 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">
<comment>(For 2.4 kernel)</comment>
# <i>make dep &amp;&amp; make vmlinux modules modules_install</i>

<comment>(For 2.6 kernel)</comment>
# <i>make &amp;&amp; make modules_install</i>

<comment>(For all kernels)</comment>
# <i>make boot</i>
</pre>

<p>
When the kernel has finished compiling, copy the kernel image to
<path>/boot</path>. Recent kernels might create <path>vmlinux</path> instead of
<path>vmlinux.gz</path>. Keep this in mind when you copy your kernel image.
</p>

<pre caption="Installing the kernel">
# <i>cp arch/alpha/boot/vmlinux.gz /boot/</i>
</pre>

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

</body>
</subsection>
</section>
<section id="genkernel">
<title>Alternative: Using genkernel</title>
<body>

<p>
If you are reading this section, you have chosen to use our <c>genkernel</c>
script to configure your kernel for you.
</p>

<p>
Now that your kernel source tree is installed, it's now time to compile your 
kernel by using our <c>genkernel</c> script to automatically build a kernel for 
you. <c>genkernel</c> works by configuring a kernel nearly identically to the 
way our Installation CD kernel is configured. This means that when you use 
<c>genkernel</c> to build your kernel, your system will generally detect all 
your hardware at boot-time, just like our Installation CD does. Because genkernel 
doesn't require any manual kernel configuration, it is an ideal solution for 
those users who may not be comfortable compiling their own kernels.
</p>

<p>
Now, let's see how to use genkernel. First, emerge the genkernel ebuild:
</p>

<pre caption="Emerging genkernel">
# <i>emerge genkernel</i>
</pre>

<p>
Now, compile your kernel sources by running <c>genkernel all</c>.
Be aware though, as <c>genkernel</c> compiles a kernel that supports almost all 
hardware, this compilation will take quite a while to finish!
</p>

<p>
Note that, if your boot partition doesn't use ext2 or ext3 as filesystem you
need to manually configure your kernel using <c>genkernel --menuconfig all</c>
and add support for your filesystem <e>in</e> the kernel (i.e. <e>not</e> as a
module).
</p>

<pre caption="Running genkernel">
# <i>genkernel all</i>
* Gentoo Linux Genkernel; Version 3.4.0
* Running with options: all

* Linux Kernel 2.6.16.19 for alpha...
* kernel: >> Running mrproper...
<comment>(Output removed to increase readability)</comment>
* Kernel compiled successfully!
*
* Required Kernel Parameters:
*     real_root=/dev/$ROOT
*
*     Where $ROOT is the device node for your root partition as the
*     one specified in /etc/fstab
*
* If you require Genkernel's hardware detection features; you MUST
* tell your bootloader to use the provided INITRAMFS file. Otherwise;
* substitute the root argument for the real_root argument if you are
* not planning to use the initrd...

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...
* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
*
* Make sure you have the latest genkernel before reporting bugs.
</pre>

<p>
Once <c>genkernel</c> completes, a kernel, full set of modules and 
<e>initial root disk</e> (initrd) will be created. We will use the kernel 
and initrd when configuring a boot loader later in this document. Write
down the names of the kernel and initrd as you will need it when writing
the bootloader configuration file. The initrd will be started immediately after 
booting to perform hardware autodetection (just like on the Installation CD) before 
your "real" system starts up.
</p>

<pre caption="Checking the created kernel image name and initrd">
# <i>ls /boot/kernel* /boot/initramfs-*</i>
</pre>

</body>
</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>x11-drm</ti>
  <ti>
    Accelerated graphics for ATI Radeon up to 9200, Rage128, Matrox, Voodoo and
    other cards for xorg-x11. Please check the <c>IUSE_VIDEO_CARDS</c> variable
    in the <path>/usr/portage/x11-base/x11-drm</path> ebuilds to see what you
    need to fill in as <c>yourcard</c>. 
  </ti>
  <ti><c>VIDEO_CARDS="yourcard" emerge x11-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>x11-drm</c> package:
</p>

<pre caption="View full installation package listing">
# <i>emerge --pretend x11-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>
Continue the installation with <uri link="?part=1&amp;chap=8">Configuring 
your System</uri>.
</p>

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