<?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-sparc-kernel.xml,v 1.43 2012/03/27 17:46:07 swift Exp $ -->

<sections>

<version>13</version>
<date>2012-03-27</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 Europe/Brussels)</comment>
# <i>cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime</i>
<comment>(Next set the timezone)</comment>
# <i>echo "Europe/Brussels" &gt; /etc/timezone</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 <keyval id="arch"/>-based systems we have <c>gentoo-sources</c>
(kernel source patched for extra features).
</p>

<p>
Choose your kernel source and install it using <c>emerge</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>linux-<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 Oct 13 11:04 /usr/src/linux -&gt; linux-<keyval id="kernel-version"/>
</pre>

<p>
Now it is time to configure and compile your kernel source. 
</p>

</body>
</subsection>
</section>
<section>
<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 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, we set up the proper cross compilation settings to make sure that the
Linux kernel is built for the correct system type. To do so, set the
<e>Cross-compiler tool prefix</e> to <c>sparc64-unknown-linux-gnu-</c>
(including the trailing dash):
</p>

<pre caption="Identifying the proper cross compilation platform">
General setup ---&gt;
  (<i>sparc64-unknown-linux-gnu-</i>) Cross-compiler tool prefix
</pre>

<p>
Then 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>:
</p>

<pre caption="Selecting necessary file systems">
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; Ext3 journalling file system support
  &lt;*&gt; Second extended fs 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">
Device Drivers ---&gt;
  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>
Now activate the correct bus-support:
</p>

<pre caption="Activating SBUS/UPA">
Console drivers ---&gt;
  Frame-buffer support ---&gt;
    [*] SBUS and UPA framebuffers             
      [*] Creator/Creator3D support     <comment>(Only for UPA slot adapter used in many Ultras)</comment>
    [*] CGsix (GX,TurboGX) support      <comment>(Only for SBUS slot adapter used in many SPARCStations)</comment>
</pre>

<p>
Of course you want support for the OBP:
</p>

<pre caption="Activating OBP Support">
Misc Linux/SPARC drivers ---&gt;
  [*]  /dev/openprom device support
</pre>

<p>
You will also need SCSI-specific support:
</p>

<pre caption="Activating SCSI-specific support">
SCSI support ---&gt;
  SCSI low-level drivers ---&gt;
    &lt;*&gt; Sparc ESP Scsi Driver             <comment>(Only for SPARC ESP on-board SCSI adapter)</comment>
    &lt;*&gt; PTI Qlogic, ISP Driver            <comment>(Only for SBUS SCSI controllers from PTI or QLogic)</comment>
    &lt;*&gt; SYM53C8XX Version 2 SCSI support  <comment>(Only for Ultra 60 on-board SCSI adapter)</comment>
</pre>

<p>
To support your network card, select one of the following:
</p>

<pre caption="Activating networking support">
Network device support ---&gt;
  Ethernet (10 or 100Mbit) ---&gt;
    &lt;*&gt; Sun LANCE support                   <comment>(Only for SPARCStation, older Ultra systems, and as Sbus option)</comment>
    &lt;*&gt; Sun Happy Meal 10/100baseT support  <comment>(Only for Ultra; also supports "qfe" quad-ethernet on PCI and Sbus)</comment>
    &lt;*&gt; DECchip Tulip (dc21x4x) PCI support <comment>(For some Netras, like N1)</comment>
  Ethernet (1000Mbit) ---&gt;
    &lt;*&gt; Broadcom Tigon3 support <comment>(Modern Netra, Sun Fire machines)</comment>
</pre>

<p>
When you have a 4-port Ethernet machine (10/100 or 10/100/1000) the port order
is different from the one used by Solaris. You can use <c>sys-apps/ethtool</c>
to check the port link status.
</p>

<p>
If you're using a qla2xxx disk controller, you'll need to use a 2.6.27 kernel or
newer, and you'll also need to emerge <c>sys-block/qla-fc-firmware</c>. Next,
run <c>make menuconfig</c> and navigate to the Device Drivers section. You'll
need to add support for loading external firmware.
</p>

<pre caption="Enabling external firmware">
Device Drivers  ---&gt;
   Generic Driver Options  ---&gt;
   ()  External firmware blobs to build into the kernel binary
   ()  Firmware blobs root directory
</pre>

<p>
Set "External firmware blobs" to <path>ql2200_fw.bin</path> and "Firmware blobs
root directory" to <path>/lib/firmware</path>.
</p>

<p>
When you're done configuring your kernel, continue with <uri
link="#compiling">Compiling and Installing</uri>. However, after having
compiled the kernel, check its size:
</p>

<pre caption="Check kernel size">
# <i>ls -lh vmlinux</i>
-rw-r--r--    1 root     root         2.4M Oct 25 14:38 vmlinux
</pre>

<p>
If the (uncompressed) size is bigger than 7.5 MB, reconfigure your kernel until
it doesn't exceed these limits. One way of accomplishing this is by having most
kernel drivers compiled as modules.  Ignoring this can lead to a non-booting
kernel.
</p>

<p>
Also, if your kernel is just a tad too big, you can try stripping it using the
<c>strip</c> command:
</p>

<pre caption="Stripping the kernel">
# <i>strip -R .comment -R .note vmlinux</i>
</pre>

</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>.
</p>

<pre caption="Installing the kernel">
# <i>cp arch/sparc/boot/image /boot/<keyval id="kernel-name"/></i>
</pre>

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

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

<subsection>
<include href="hb-install-kernelmodules.xml"/>
</subsection>

</section>
</sections>
