Difference between revisions of "JetwayMiniITX"

From SME Server
Jump to navigationJump to search
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
  
This HowTo describes how to get SME 7.x working properly on a [http://www.mini-itx.com/store/?c=34#j7f4 Jetway J7F4 Mini-ITX motherboard]. These motherboards are an extremely attractive option for builing a small, energy-efficient yet relatively fast server. The J7F4 series have two Realtek RTL8110SC Gigabit LAN adapters on board, and are powered by a VIA C7 (Ester) processor at 1.2 Ghz (with passive cooling), or at 1.5 or 2.0 Ghz with active cooling. In addition, it includes hardware AES and SHA encryption/decryption, hardware MPEG2/4 decoding and a number of other potentially useful features. Unfortunately however, most of its hardware is not very well supported by the 2.6.9 kernel that is supplied with SME and CentOS 4. This document describes the compilation and installation of a custom kernel. It can also be used as an example of how to get SME running on or with any hardware that requires a modified or newer linux kernel.
+
This HowTo describes how to get SME 7.x working properly on a [http://www.mini-itx.com/store/?c=34#j7f4 Jetway J7F4 Mini-ITX motherboard] (or other Mini-ITX boards based on the VIA CN700 chipset). These motherboards are an extremely attractive option for builing a small, energy-efficient yet relatively fast server. The J7F4 series have two Realtek RTL8110SC Gigabit LAN adapters on board, and are powered by a VIA C7 (Ester) processor at 1.2 Ghz (with passive cooling), or at 1.5 or 2.0 Ghz with active cooling. In addition, the chipset includes hardware AES and SHA encryption/decryption, hardware MPEG2/4 decoding and a number of other potentially useful features. Unfortunately however, this hardware is not very well supported by the 2.6.9 kernel that is supplied with SME and CentOS 4. This document describes the compilation and installation of a custom kernel. It can also be used as an example of how to get SME running on or with any hardware that requires a modified or newer linux kernel.
  
  
Line 8: Line 8:
 
===Before you start===
 
===Before you start===
  
It is always a good idea to make a backup, in case things get messed up. Furthermore, as the standard SME 7.x kernel doesn't support the on-board RTL8110SC network controllers, you might want to perform at least steps 1 through 4 on a different machine, and switch the harddisk to the Jetway machine after the new kernel is installed. If you follow the instructions below, the new kernel should run on most machines with a 686-compatible CPU (i.e. a Pentium II or higher).  
+
It is always a good idea to make a backup, in case things get messed up. Furthermore, as the standard SME 7.x kernel doesn't support the RTL8110SC network controllers on board the J7F4, you might want to perform at least steps 1 through 4 on a different machine, and switch the harddisk to the Jetway machine after the new kernel is installed. If you follow the instructions below, the new kernel should run on most machines with a 686-compatible CPU (i.e. a Pentium II or higher).  
  
 
Alternatively you could install a temporary network-card in the PCI slot on the Jetway-board, or [http://forums.contribs.org/index.php?topic=35435.0 temporarily install the r1000 kernel module from Realtek]. The r1000 driver works with all RTL8169 and RTL8110 gigabit ethernet controllers. However, many people have found it to be buggy and unstable, so as soon as you have installed the new kernel you should switch to the r8169 kernel module. Recent versions of this driver have support for the RTL8110.
 
Alternatively you could install a temporary network-card in the PCI slot on the Jetway-board, or [http://forums.contribs.org/index.php?topic=35435.0 temporarily install the r1000 kernel module from Realtek]. The r1000 driver works with all RTL8169 and RTL8110 gigabit ethernet controllers. However, many people have found it to be buggy and unstable, so as soon as you have installed the new kernel you should switch to the r8169 kernel module. Recent versions of this driver have support for the RTL8110.
Line 131: Line 131:
 
Finally you should make sure that all necessary modules are built for
 
Finally you should make sure that all necessary modules are built for
 
the hardware that you have. The default settings are quite reasonable,
 
the hardware that you have. The default settings are quite reasonable,
but for the Jetway board, I would select at least the following additional options (when available):
+
but for Jetway or VIA Epia boards, I would select at least the following additional options (when available):
  
 
  Processor type and features  --->
 
  Processor type and features  --->
Line 164: Line 164:
 
                 <*>        VIA82CXXX chipset support
 
                 <*>        VIA82CXXX chipset support
 
         Network device support  --->
 
         Network device support  --->
 +
                Ethernet (10 or 100Mbit)  --->
 +
                        <M>  VIA Rhine support
 +
                        [*]    Use MMIO instead of PIO
 
                 Ethernet (1000 Mbit)  --->
 
                 Ethernet (1000 Mbit)  --->
 
                         <M> Realtek 8169 gigabit ethernet support
 
                         <M> Realtek 8169 gigabit ethernet support
 +
                        <M> VIA Velocity support
 
         Character devices  --->
 
         Character devices  --->
 
                 <M> Hardware Random Number Generator Core support
 
                 <M> Hardware Random Number Generator Core support
Line 225: Line 229:
 
         initrd /initrd-2.6.21-rc5-git1-custom-via.img
 
         initrd /initrd-2.6.21-rc5-git1-custom-via.img
  
Before rebooting, you should tell SME that wou want to use the r8169 driver for the on-board ethernet controllers:
+
Before rebooting, you should tell SME what driver you want to use for the on-board ethernet controllers.
 +
 
 +
If your board has RealTek RTL8169 or RTL8110 gigabit ethernet controllers (e.g. the Jetway J7F4 or the [http://www.mini-itx.com/store/?c=34#modules 3x Gigabit LAN extension module] for the [http://www.mini-itx.com/store/?c=34#j7f2 Jetway J7F2]), you'll want to use the r8169 driver:
  
 
  /sbin/e-smith/config set EthernetDriver1 r8169
 
  /sbin/e-smith/config set EthernetDriver1 r8169
 
  /sbin/e-smith/config set EthernetDriver2 r8169
 
  /sbin/e-smith/config set EthernetDriver2 r8169
 +
 +
If your board has VIA 'Velocity' series gigabit ethernet controllers (e.g. many newer VIA Epia boards), you'll want to use the via-velocity driver:
 +
 +
/sbin/e-smith/config set EthernetDriver1 via-velocity
 +
/sbin/e-smith/config set EthernetDriver2 via-velocity
 +
 +
If your board has dual VIA 10/100 Mbit ethernet controllers (e.g. the [http://www.mini-itx.com/store/?c=2#epiavt VIA Epia VT series]), you'll want to use the via-velocity driver:
 +
 +
/sbin/e-smith/config set EthernetDriver1 via-rhine
 +
/sbin/e-smith/config set EthernetDriver2 via-rhine
 +
 +
These instructions assume that you have at two controllers on board with the same chipset. If you have more than one type of controller, you should of course modify the 'set EthernetDriver1' etc. lines to use the correct drivers.
  
  

Revision as of 22:15, 21 May 2007

Introduction

This HowTo describes how to get SME 7.x working properly on a Jetway J7F4 Mini-ITX motherboard (or other Mini-ITX boards based on the VIA CN700 chipset). These motherboards are an extremely attractive option for builing a small, energy-efficient yet relatively fast server. The J7F4 series have two Realtek RTL8110SC Gigabit LAN adapters on board, and are powered by a VIA C7 (Ester) processor at 1.2 Ghz (with passive cooling), or at 1.5 or 2.0 Ghz with active cooling. In addition, the chipset includes hardware AES and SHA encryption/decryption, hardware MPEG2/4 decoding and a number of other potentially useful features. Unfortunately however, this hardware is not very well supported by the 2.6.9 kernel that is supplied with SME and CentOS 4. This document describes the compilation and installation of a custom kernel. It can also be used as an example of how to get SME running on or with any hardware that requires a modified or newer linux kernel.


Procedure

Before you start

It is always a good idea to make a backup, in case things get messed up. Furthermore, as the standard SME 7.x kernel doesn't support the RTL8110SC network controllers on board the J7F4, you might want to perform at least steps 1 through 4 on a different machine, and switch the harddisk to the Jetway machine after the new kernel is installed. If you follow the instructions below, the new kernel should run on most machines with a 686-compatible CPU (i.e. a Pentium II or higher).

Alternatively you could install a temporary network-card in the PCI slot on the Jetway-board, or temporarily install the r1000 kernel module from Realtek. The r1000 driver works with all RTL8169 and RTL8110 gigabit ethernet controllers. However, many people have found it to be buggy and unstable, so as soon as you have installed the new kernel you should switch to the r8169 kernel module. Recent versions of this driver have support for the RTL8110.


Step 1: Installing a compiler and build tools

Log in to the shell as root, and install the packages needed for compiling a kernel:

yum install kernel-devel gcc gcc-c++ ncurses-devel


Step 2: Installing the kernel sources

You can download the source tree for the newest Linux kernel from http://www.kernel.org. You should check to see which versions are available. If you need stability, you're best off using a 'stable' version. If you need maximum support for new hardware, you can try a 'testing' version, with or without the latest snapshot patches. For example, I used the latest 'testing' kernel, at the time of writing this was 2.6.21-rc5:

cd /usr/src/
wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.21-rc5.tar.bz2

Unpack the source tree and make /usr/src/linux a symbolic link to the source directory:

tar xvjf linux-2.6.21-rc5.tar.bz2
ln -s /usr/src/linux-2.6.21-rc5 /usr/src/linux

I also downloaded and applied the latest snapshot patches (this is of course optional, see the references section for more information):

wget http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-2.6.21-rc5-git1.bz2
cd /usr/src/linux/
bzip2 -dc /usr/src/patch-2.6.21-rc5-git1.bz2 | patch -p1

Finally, I applied a patch to add kernel support for the VIA C7 processor (this is also optional, the C7 is i686 compatible so it should work just fine without this patch):

wget -O /usr/src/via-c7.patch http://lkml.org/lkml/diff/2007/2/12/428/1
cd /usr/src/linux/
patch -p1 </usr/src/via-c7.patch

Step 3: Configuring the kernel

Next, we need to configure our new kernel. We need to make sure that all the drivers we need are included in the kernel or are built as modules. It is always a good idea to use the current kernel configuration as a starting point:

cd /usr/src/linux
make clean && make mrproper
cp /boot/config-`uname -r` ./smeconfig

Run the configuration tool:

make menuconfig

Select "Load an Alternate Configuration File" and load the file "smeconfig". If you don't want to bother with the manual configuration below, you may also load the ready-made configuration file from this site and skip to the next step.

We should give our custom kernel a name, to distinguish it from a generic kernel. You may choose any suffix you want, in this example I will use "-custom-via". Select the following in the menu:

General setup  --->
        () Local version - append to kernel release

Fill in "-custom-via".

Next comes a tricky part, you need to select the appropriate drivers. You will need at least these options to make MASQ routing and VPN work:

Device Drivers  --->
       Network device support  --->
               <M>   PPP (point-to-point protocol) support
               <M>     PPP MPPE compression (encryption) (EXPERIMENTAL)
Networking  --->
 Networking options  --->

 [*] Network packet filtering framework (Netfilter)  --->

 --- Network packet filtering framework (Netfilter)
        [ ]   Network packet filtering debugging
        [*]   Bridged IP/ARP packets filtering

               Core Netfilter Configuration  --->
               <M> Netfilter connection tracking support
                       Netfilter connection tracking support (Layer 3 Dependent Co.
               <M> Netfilter Xtables support (required for ip_tables)
               [...]


I also selected all the netfilter targets as modules:

               IP: Netfilter Configuration  --->
               [...]
               <M> FTP protocol support
               <M> PPTP protocol support
               <M> IP tables support (required for filtering/masq/NAT)
               <M>   IP range match support
               <M>   TOS match support
               <M>   recent match support
               <M>   ECN match support
               <M>   TTL match support
               <M>   Owner match support
               <M>   address type match support
               <M>   Packet filtering
               <M>     REJECT target support
               <M>   LOG target support
               <M>   ULOG target support
               <M>   Full NAT
               <M> MASQUERADE target support
               <M> REDIRECT target support
               <M> NETMAP target support
               <M> SAME target support
               <M> Packet mangling 
               <M>   TOS target support
               <M>   ECN target support
               <M> raw table support (required for NOTRACK/TRACE)
               <M> ARP tables support
               <M>   ARP packet filtering
               <M>   ARP payload mangling

I also selected these, just in case:

               <M> IRC protocol support
               <M> TFTP protocol support
               <M> Amanda backup protocol support
               <M> H.323 protocol support (EXPERIMENTAL)
               <M> SIP protocol support (EXPERIMENTAL)


Finally you should make sure that all necessary modules are built for the hardware that you have. The default settings are quite reasonable, but for Jetway or VIA Epia boards, I would select at least the following additional options (when available):

Processor type and features  --->
   Processor family (VIA C7)  --->
       (X) VIA C7
Power management options (ACPI, APM)  --->
       [*] Power Management support
       ACPI (Advanced Configuration and Power Interface) Support --->
               [*] ACPI Support
               [*]   Procfs interface (deprecated)
               <M>   AC Adapter
               <M>   Button
               <*>   Fan
               <*>   Processor
               <*>     Thermal Zone
       CPU Frequency scaling  --->
               [*] CPU Frequency scaling
               <*>   CPU frequency translation statistics
               Default CPUFreq governor (userspace)  --->
               <*>   'performance' governor
               <*>   'powersave' governor
               ---   'userspace' governor for userspace frequency scaling
               <*>   'ondemand' cpufreq policy governor
               <*>   'conservative' cpufreq policy governor
               ---   CPUFreq processor drivers
               <*>   ACPI Processor P-States driver
               <*>   VIA C7 Enhanced PowerSaver (EXPERIMENTAL)
Device Drivers  --->
       ATA/ATAPI/MFM/RLL support  --->
               <*>         VIA82CXXX chipset support
       Network device support  --->
               Ethernet (10 or 100Mbit)  --->
                       <M>   VIA Rhine support
                       [*]     Use MMIO instead of PIO
               Ethernet (1000 Mbit)  --->
                       <M> Realtek 8169 gigabit ethernet support
                       <M> VIA Velocity support
       Character devices  --->
               <M> Hardware Random Number Generator Core support
               <M>   VIA HW Random Number Generator support
               <*>   VIA chipset support
               <M>   Via unichrome video cards
       I2C support  --->
               <M> I2C support
               <M>   I2C device interface
               I2C Hardware Bus support  --->
                       <M> VIA VT82C596/82C686/82xx and CX700
       Sound  --->
               <M> Sound card support
               Advanced Linux Sound Architecture  --->
                       <M> Advanced Linux Sound Architecture
                       <M>   Sequencer support
                       <M>   OSS Mixer API
                       <M>   OSS PCM (digital audio) API
                       PCI devices  --->
                               <M> VIA 82C686A/B, 8233/8235 AC97 Controller
Cryptographic options  --->
       Hardware crypto devices  --->
               <M> Support for VIA PadLock ACE
               <M>   PadLock driver for AES algorithm
               <M>   PadLock driver for SHA1 and SHA256 algorithms

When you're done, exit and save your configuration.


Step 4: Compiling and installing the kernel

When everything is configured, you can can build the kernel. In order to facilitate an easy installation and maintenace, we will build the new kernel as an RPM package:

make rpm

This will take a while. When the build is done, the kernel package will be located in /usr/src/redhat/RPMS/i386/. You can install it using rpm, e.g.:

cd /usr/src/redhat/RPMS/i386/
rpm -ivh --nodeps kernel-2.6.21rc5git1customvia.i386.rpm

Add the switch --force if you want to replace a previously installed version.

The new kernel is now almost ready for booting. You need to create an initrd ramdisk for the new kernel:

/sbin/mkinitrd /boot/initrd-2.6.21-rc5-git1-custom-via.img 2.6.21-rc5-git1-custom-via

And you need to add the new kernel to the configuration file of the GRUB bootloader:

mcedit /boot/grub/grub.conf

My kernel is at /boot/vmlinuz-2.6.21-rc5-git1-custom-via and my initrd image is /boot/initrd-2.6.21-rc5-git1-custom-via.img. So I add the following kernel definition to grub.conf, as the first kernel in the list:

title SME Server (2.6.21-rc5-git1-custom-via)
       root (hd0,0)
       kernel /vmlinuz-2.6.21-rc5-git1-custom-via ro root=/dev/hda6
       initrd /initrd-2.6.21-rc5-git1-custom-via.img

Before rebooting, you should tell SME what driver you want to use for the on-board ethernet controllers.

If your board has RealTek RTL8169 or RTL8110 gigabit ethernet controllers (e.g. the Jetway J7F4 or the 3x Gigabit LAN extension module for the Jetway J7F2), you'll want to use the r8169 driver:

/sbin/e-smith/config set EthernetDriver1 r8169
/sbin/e-smith/config set EthernetDriver2 r8169

If your board has VIA 'Velocity' series gigabit ethernet controllers (e.g. many newer VIA Epia boards), you'll want to use the via-velocity driver:

/sbin/e-smith/config set EthernetDriver1 via-velocity
/sbin/e-smith/config set EthernetDriver2 via-velocity

If your board has dual VIA 10/100 Mbit ethernet controllers (e.g. the VIA Epia VT series), you'll want to use the via-velocity driver:

/sbin/e-smith/config set EthernetDriver1 via-rhine
/sbin/e-smith/config set EthernetDriver2 via-rhine

These instructions assume that you have at two controllers on board with the same chipset. If you have more than one type of controller, you should of course modify the 'set EthernetDriver1' etc. lines to use the correct drivers.


Step 5: Booting the new kernel

Now you can reboot the server:

/sbin/e-smith/signal-event post-upgrade
/sbin/e-smith/signal-event reboot

Don't forget to select the new kernel in the GRUB boot menu! You can enter the kernel selection menu by hitting a key when in the GRUB splash-screen. Select the new kernel using the cursor keys, and keep your fingers crossed... ;-) GRUB will automagically remember the last-used kernel next time you boot.

If all goes well, your server should come up after a minute or so. You should check if everything still works, especially networking. If not, you have probably forgotten one or more essential modules, and you should go back to step 3.


Step 6: Final configuration

If all has gone well, you should now be up and running on your brand new kernel. All that remains is to make sure that any remaining 'extra features' are loaded into the kernel. If you are running on a VIA C7 based board such as the Jetway J7F4, try the following to enable hardware crypting support:

/sbin/modprobe via-rng
/sbin/modprobe padlock

And in the unlikely event that you want to run an Xserver with hardware accellerated 2D graphics and MPEG-decoding:

/sbin/modprobe via

You should also enable on-demand frequency scaling, so the processor will switch from 400 Mhz to 1200 Mhz when needed:

echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Of course, you don't want to type all of this every time you reboot the server. So you can create a script in /etc/e-smith/events/local that will configure things for you at boot-time:

mcedit /etc/e-smith/events/actions/custom-setup-via

Type or paste the following into the script:

#!/bin/sh
# Custom initialisation stuff for the VIA C7
/sbin/modprobe via_rng
/sbin/modprobe padlock
echo ondemand >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Save the script (F2 or F10 in mcedit) and set the right permissions:

chmod 554 /etc/e-smith/events/actions/custom-setup-via

Add the script to the 'local' event by making a link to it in /etc/e-smith/events/local/:

ln -s /etc/e-smith/events/actions/custom-setup-via /etc/e-smith/events/local/S60custom-setup-via

Alternatively, you can put the script directly in etc/e-smith/events/local/ if you find that more convenient. It will be run at boot time, and you can always trigger it manually by issuing:

/sbin/e-smith/signal-event local


Step 7: Cleaning up

For security reasons, it is best to remove the compiler and development tools if you are not going to use them anymore:

yum -y remove libstdc++-devel cpp glibc-kernheaders glibc-headers glibc-devel gcc gcc-c++ kernel-devel ncurses-devel

You can also delete the remaining packages and sources in /usr/src, if you wish.


Author and Acknowledgements

This HowTo is written by Levien van Zon (levien at scum.org). It is based to a large extent on forum postings and documents by Harro, Charlie Brady, Falko Timme, Simon Arlott and many others. See the references below for more information. This document may still contain mistakes and typos, so please feel free to add or correct things if you have wiki-access. You can also send corrections and suggestions to the author by e-mail.

References