EPIA HOWTO

Andrew Howlett

This Howto explains how to enable linux on an EPIA mainboard.


Table of Contents
1. Introduction
1.1. General
1.2. VIA EPIA CPUs
1.3. VIA EPIA Models
1.4. Attention: Newbies read this
1.5. Binary packages
1.6. Distributions
1.6.1. Debian
1.6.2. Fedora
1.6.3. Gentoo
1.6.4. Knoppix
1.6.5. Mandrake
1.6.6. Red Flag
1.6.7. Red Hat
1.6.8. SuSe
1.6.9. MiniMyth
1.6.10. Freepia
2. Ethernet
3. USB
4. Firewire
5. Audio
5.1. Kernel Audio Support
5.2. VIA Audio Combo
5.2.1. VIA Audio Combo RPM Install
5.2.2. VIA Audio Combo non-RPM Install
5.3. ALSA
5.4. Six Channel Audio
5.5. S/PDIF
5.6. 48kHz Sampling
5.7. XMMS
6. Video
6.1. VIA XFree86 Driver
6.2. Frame Buffer
6.2.1. VESA Frame Buffer
6.2.2. VIA CLE266 Frame Buffer
6.2.3. DirectFB
6.3. Hardware MPEG2 Decoding
6.3.1. Fedora Core 3 Unichrome HW Decoding
6.4. MPlayer
6.5. viaexp
6.6. Hauppage PVR 250
6.7. MythTV
6.8. Turn on DMA
6.9. TV Out
7. Hardware Sensors
7.1. Kernel 2.4
7.2. Linux 2.6
7.3. Notes
7.4. Hard Drive Temperature Sensor
7.5. I2C Connector
8. CPU Frequency Control
8.1. Linux 2.6 CPU Frequency Control
8.2. Userspace Governor
9. Hardware Random Number Generation
10. Cardbus/PCMCIA & CF
11. Consumer Infra Red Header (CIR)
12. Building linux and XFree86 from Source
12.1. Building Linux 2.6.6-epia1
12.2. Building Linux 2.4-epia
12.3. Building XFree86 from Source
13. Frequently Asked Questions
13.1. How do I add shared library files?
13.2. Is the C3 Pentium compatible?
13.3. How do I install SuSe 8.2?
13.4. EPIA Links
13.5. The M10k is too noisy. How can I make it quieter?
13.5.1. Hush, Tranquil & Scythe
13.5.2. Fan Undervoltage
13.5.3. Fan Replacement
13.5.4. Heat Sink Replacement
13.6. DRI Only Works as root
13.7. DRI or GLX Crashing
13.8. DMA Lockup Problem
14. About this HowTo
14.1. Credits
14.2. Contact
14.3. Change Log
14.4. In-line References

1. Introduction

1.1. General

The EPIA products are small form factor mainboards, measuring about seven inches by seven inches. They features on-board ethernet, USB, firewire, audio, video, hardware monitoring and CPU frequency control. The EPIA boards use the C3 family of processors which implement Cyrix x86 emulation. The EPIA products are well suited for use in embedded application and silent terminal projects.

So first I did the hype, here's the reality - you will have to do some work if you want to use the EPIA features with linux. Sure, you could just install debian, Red Hat or Suse on it, and it will run, but many features will not be available. If you want to get the most out of your EPIA mainboard, you must do some work. This howto explains what you have to do.

Some features are better supported than others. In this HowTo I will explain each feature. Here is a brief summary of the state of each feature:

  • Ethernet - well supported, should work "out of the box" on most distros

  • USB - USB 1 is well supported, USB 2 is experimental in most recent distros

  • firewire - experimental in recent distros

  • audio - supported out of the box in a few distros. Others should install ALSA drivers

  • video - VESA works unaccelerated. VIA provides CLE266 accelerated video drivers for some distros. DVD hardware acceleration is only available as a binary library for via-xine. An experimental accelerated frame buffer driver has been released in source code form.

  • hardware monitoring - older EPIA boards lack reliable temperature sensors. Owners of newer boards (i.e. EPIA M series) must compile and install i2c and lm_sensors.

  • CPU Frequency Control - supported by add-on kernel module.

  • Random Number Generation - supported, requires a kernel compile

  • Cardbus/PCMCIA & CompactFlash - supported on all major distributions

1.2. VIA EPIA CPUs

The VIA EPIA boards use VIA CPUs. The identity of the CPUs is very confusing. VIA uses three brand names: Eden, C3 and Nehemiah. The Eden and C3 CPUs use identical technology according to this quote from the Eden ESP FAQ:

The VIA Eden Platform is "guaranteed" for fanless designs where the VIA C3 processor (EBGA Package) is aimed at the general PC market that where there is a demand for higher speeds and less demand for fanless systems. Both the VIA Eden ESP processor and the VIA C3 processor are based on the same process technology. The difference comes in where the VIA Eden ESP processor goes through a different production flow where the conditions for testing and reliability control for ultra low voltage and power, as well as high Tcase, are implemented.

Customers may try to lower the speed/voltage of VIA C3 processor (EBGA package) to achieve the same goal but VIA does not guarantee the stability of the platform while running fanless, out-of-spec VIA C3 processors (EBGA package) where the Tcase specification is limited to 70 degrees C. Note: The VIA C3 processor can operate in a "fanless" environment that has been "customized" for passive cooling, but this is not guaranteed for general designs. As for LongHaul2 technology (that can lower the voltage), this is only supported in the uFCPGA package used in the mobile market.

From the core design perspective, we do leverage the design intelligence from the same R&D team (Centaur) that designed the VIA C3 processor, but VIA Eden ESP processors are specially processed for fanless designs.

So Eden and C3 are marketing terms for chips which are technologically identical but have different heat and power related guarantees. On the other hand Nehemiah does describe a different technology - the Nehemiah core. But what technology did older C3s use? The older C3 (and Eden) processors use Samuel, Ezra and Ezra-T cores. The table below presents what little data I have found regarding these CPUs. Please provide additional data if you have it.

Table 1. VIA CPUs

IDNameCoreFam.Mod.StepSpeed (MHz)Commentsflags
C5AVIA Cyrix 3Samuel6.6.0500-73312 stage pipeline; FPU @ 50% clock; 1.8-2.0v; CPGA; 75 mm2; 0.18u Al; 11.3 mil transistors; 2001-06-06 
C5BVIA C3Samuel 26.7.0-7450-65012 stage pipeline; FPU @ 50% clock; 1.6v; CPGA/EBGA; 52 mm2; 0.15u Al; 15.2 mil transistors; 2001-03-25 (fpu de tsc msr cx8 mtrr pge mmx 3dnow)-march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer -mmmx
C5CVIA C3Ezra6.7.8-f800-100012 stage pipeline; FPU @ 50% clock; 1.35v; CPGA/EBGA; 52 mm2; 0.15u/0.13u hybrid Al; 15.4 mil transistors; 2001-09-11-march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer -mmmx
C5M/C5NVIA C3Ezra-T6.8.0-f900-120012 stage pipeline; FPU @ 50% clock; CPGA/EBGA/uPGA2/uFCPGA; 56 mm2; 0.15/0.13u hybrid (Cu); 15.5 mil transistors; C5N=copper interconnectrs; 2002-march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer -mmmx
C5XVIA C3Nehemiah6.?.?1100-130016 stage pipeline; 2 SSE units; FPU @ full clock; 0.13 (Cu); 78 mm2; 2003-01-22-march=i686 -msse -mmmx -mfpmath=sse -O3 -pipe -fomit-frame-pointer
C5XLVIA C3Nehemiah6.9.0-51000-120016 stage pipeline; 2 SSE units; FPU @ full clock; 0.13 (Cu); 54 mm2 (fpu de tsc msr mtrr pge cmov mmx fxsr sse)-march=i686 -msse -mmmx -mfpmath=sse -O3 -pipe -fomit-frame-pointer
C5PVIA C3Antaur6.9.81000 - 1200 GHz16 stage pipeline; 200 MHz FSB; 2 SSE units; FPU @ full clock; SMP; 2xRNG+AES module; 47 mm2; (fpu vme de pse tsc msr cx8 sep mtrr pge cmov pat mmx fxsr sse rng rng_en ace ace_en)-march= -mcpu=i686 -funroll-loops -msse -mmmx -mfpmath=sse -O3 -pipe -fomit-frame-pointer
C5IVIA C4Esther 2 GHzPentium M bus, new chipset (?), SMP, SSE2; RNG+AES+SHA1 module 

The C5P and C5I information was taken from the extremetech.com article. The clock speeds are approximate. Technically, CPU speed is determined by the front side bus speed and the cpu multiplier and is limited by heat dissipation. For more information regarding FSB and cpu multiplier, see the CPU Freqency Control section. The compilation flags have been determined by experimentation. Some users claim that -march=i486 produces more efficient code than -i586. Also, starting in gcc 3.3 you may use the -march=c3 flag to specify VIA Samuel, Samuel2, Ezra and Ezra-T processors. Some experimenters suggest that code compiled using -Os (compile for size) will run faster than -O3 (compile for speed) because the VIA processors have very small cache and the smaller code will improve the chances of cache hits. I haven't seen any numbers to confirm this - maybe someone will try it and let me know if it is true. For more information on gcc optimizations see the excellent Wiki at courville.org

Some other tidbits: the Nehemiah processors can run at bus speeds of 66, 100 and 133 MHz and use the Tualatin protocol. The Nehemiah is designed by Centaur Technologies. VIA bought Centaur and Cyrix many years ago, but the Cyrix team quit, so the newer VIA processors contain no Cyrix technology.

1.3. VIA EPIA Models

There are six families of EPIA mainboards. The primary difference lies in the choice of chipset - the north bridge and south bridge chips. The north bridge chip connects to the CPU, RAM, and AGP bus. In the case of the EPIA boards the AGP graphics processor is integrated on the Northbridge chip. The EPIA boards use one of two Northbridge chips: the PLE133 or the CLE266. The PLE133 uses 133 MHz SDRAM. The CLE266 is more powerful - it uses DDR266 modules. Both have integrated 2d/3d accerated AGP4x graphics processors with MPEG2 decoder. Both include the PCI bus controller; both can provide both 100 and 133 MHz front side bus.

The south bridge chip connects to peripheral devices. The EPIA boards use one of two different south bridge chips: the VT8231 or the VT8235. Both chips include a keyboard and mouse interface, floppy disc controller, parallel printer, serial ports, game port, infra red, 100BaseT ethernet, SB-Pro and AC97 codec, UDMA EIDE controller, RTC, ACPI, hardware monitoring, and USB. Note that although the chips support all these functions some may not be implemented on a particular board - for instance the EPIA and EPIA TC boards lack floppy connectors. The 8235 is a natural upgrade of the 8231 - it supports USB 2.0, ATA133, AC97 2.2. The 8231 connects to the north bridge on the PCI bus, whereas the 8235 can use the PCI bus or an advanced proprietary connection which operates four times faster than PCI.

In addition to the south bridge integrated peripheral controllers, EPIA boards will include an audio codec (VT1612 or VT1616) and a networking controller (VT6103). EPIA boards may include a TV-OUT interface (VT1621 or VT1622) and a firewire interface (VT6307S).

Table 2. EPIA Families

Familynorth bridgesouth bridgeComment
EPIAPLE1338231TV-out, one ethernet, 2xIDE no floppy
EPIA VPLE1338231similar to EPIA but faster CPUs, TV-out optional, 1 IDE and 1 floppy
EPIA MCLE2668235faster than EPIA, better chipset, USB2 + firewire, 2 IDE, 1 floppy
EPIA CLCLE2668235similar to EPIA M but no tv-out, 2 ethernet, 1 LVDS
EPIA TCCLE2668235EPIA M -tvout + LVDS - ATX + 12vDC, optional cardbus & compactflash, uses SODIMM, 2 IDE, no floppy
EPIA MIICLE2668235EPIA M + cardbus/compactflash

The EPIA V is a higher speed version of the EPIA with optional TV-out and they replaced one of the IDE ports with a floppy port. The EPIA TC is especially interesting because it does not use an ATX power supply - instead it takes 12v DC in. Special power connectors on the board provide power to the hard drive and DVD drive. The EPIA M is probably the most common model.

Users have submitted information about some specific models:

Table 3. EPIA Models

Model NumberCPUFamily
5000C3 533 MHzEPIA
ME6000C3 600MHz; 1196 bogomips; flags: fpu de tsc msr cx8 mtrr pge mmx 3dnowEPIA M
800C3 800 MHz; 1596 bogomips; flags: fpu de tsc msr cx8 mtrr pge mmx 3dnowEPIA
V8000C3 800 MHzEPIA V
M9000C3 933 MHzEPIA M
M10000C3 1 GHz; Note that some M10k boards use Ezra and some use Nehemiah CPUs.EPIA M
M10000NNehemiah 1 GHz; 1992 bogomips; flags: fpu de tsc msr mtrr pge cmov mmx fxsr sseEPIA M

1.4. Attention: Newbies read this

Getting all this to work requires some experience building software from source. If you have installed linux for the first time on your new VIA EPIA and never compiled a tarball, then you might be in for a shock. Prepare for some linux hacking. But if you read through this HowTo and decide that you aren't ready for it yet, don't worry too much. The VIA EPIA features are already in linux 2.4.23-test3 and xfree86 4.3.99-12. So all you have to do is wait until next year when the next stable versions of linux and xfree86 come out. Then the distribution companies like Red Hat and SuSe will package it for you in their next versions and you can install it with less difficulty.

1.5. Binary packages

VIA distributes binary packages for Mandrake, Red Flag, Red Hat, and Suse. These binaries include drivers, kernel modules and utilities. Many of the driver packages are useless. One or two are good: notably the CLE266 and viaexp packages. Just about everything that is available in a VIA binary package can be done from source following the instruction in, or linked from, this HowTo.

1.6. Distributions

The Eden and C3 CPUs implement Cyrix x86 emulation. Most distributions will recognize the CPU as a 586 or 686, and installation should happen smoothly although there are some problems - notably with some SuSe and Red Hat CD-ROMs. VIA officially supports four distros: Mandrake, Red Flag, Red Hat, and SuSe. VIA does not support debian or gentoo, but with some effort you can get everything working even in the unsupported distributions. I will try to collect distribution specific info in the following sub-sections, time permitting.

1.6.1. Debian

Debian Testing (aka Sarge) works well with the EPIA boards. If you are doing a new install, I recommend using the Sarge netinstall cd. Select the 2.6 kernel. Netinstall should automatically detect and install drivers for LAN, usb, firewire, audio and pcmcia.

As of this writing (November 2004), Sarge uses XFree86-4.3.0-1.8-dfsg. Select the via driver during debconfig. This via driver is functional, but does not support accelerated video. See the Video section in the next chapter for instructions on how to install DRI on a debian system.

1.6.2. Fedora

The default Fedora Core 3 and core 2 kernels are compiled for 686, which means that it will work fine with Nehemiah processors, but older processors will suffer the CMOV bug. For older processors, you can install fedora using the procedure described below, or switch to debian or fedora core 1. If you have a Nehemiah processor, then fc3 will work out of the box with no problems. Fedora will install the VESA Xorg driver. You can download Unichrome rpm packages courtesy of Terry Barnaby.

In order to get fc2 and fc3 to work with non-Nehemiah CPUs you must do the following:

  1. Download the fedora c3 boot iso

  2. burn it on to a CD as a CD image

  3. boot off it

  4. at the first menu swap in the normal FC2 CD1 and install FC

  5. on install completion, where it says to remove the CD and it will reboot, type ctrl-alt-F2 to get to a console

  6. chroot /mnt/sysimage

  7. stick back in the CD you booted from

  8. (replace hdc with your cdrom device if different) mount /dev/hdc /mnt/source -t iso9660

  9. rpm -Uvf /mnt/source/kernel*

  10. type ctrl-alt-F1 (for text mode install) or crtl-alt-F7 (graphical wqinstall) and complete the install

  11. You should reboot into a working kernel

Fedora core 1 works well with EPIA boards - USB, LAN, lm_sensors, sound. A Fedora core 1 install will "just work." But the default install uses the XFree86 VESA driver. If you want accelerated video then you have two choices: install the closed source binary drivers from viaarena or use the open source drivers provided by Alan Cox. The closed source drivers include install instructions. If you decide to use open source drivers then you must recompile the kernel to support VIA DRI, download the XFree86 drivers from Alan Cox's web space, and manually install the XFree86 drivers.

You can get the fedora iso images from this bittorrent.

1.6.3. Gentoo

Gentoo can be installed on EPIA. Tony Murray has created an excellent gentoo howto.

1.6.4. Knoppix

Knoppix 3.3 works very well with EPIA (sound, USB, XF86 VESA video, etc). Furthermore, knoppix is a debian distribution, so it is possible to get everything working following the debian instructions. There is a short knoppix specific howto at HowTo Install Knoppix on the EPIA M10000.

1.6.5. Mandrake

Mandrake 10.1 will install fine on the EPIA machines. Unfortunately, it will install an i686 kernel on the EPIA boards. This kernel doesn't work with Ezra and Samuel CPUs (e.g. ME6000, EPIA5000, and some M10000). On these machines you must install the Mandrake i586 kernel. After the install, boot the machine in rescue mode (boot from disc 1, select "More Options" and type "rescue" at the prompt). Use the menu option to change root into the hard drive. Launch the Mandrake Software Installation tool and type "kernel" in the search box. Install kernel-i586-up-1GB-2.6.8.1.12mdk. Reboot the machine. The new kernel should appear in the lilo boot menu.

1.6.6. Red Flag

The via proprietary drivers support some versions of Red Flag, but I have no other information regarding this distro.

1.6.7. Red Hat

The old Red Hat branded free distributions are getting pretty old, but they are tested and reliable. Therefore I have kept this section about Red Hat in the HowTo, but it hasn't been updated in a lllooonnnggg time.

VIA supports Red Hat Linux versions 7.3, 8.0 and 9. Version 7.3 is ancient and will not be discussed in this howto. Red Hat 8.0 used to be the best supported distro for EPIA - although Red Hat discontinued its support of version 8.0 on 2003-12-31. The Red Hat 9 kernel supports VT82xx sound "out of the box" but some M10000 users have reported installation problems. Red Hat Enterprise Linux suffers the same gcc conditional move problem as Suse 8.2. So Red Hat Enterprise Linux will probably work on the Nehemiah CPUs (I haven't tested it) but not on the C3 processors.

Note that the VIA binary drivers are compiled against the original Red Hat kernels. You cannot upgrade your kernel. For instance, if you use Red Hat Network (rhn) or up2date, and rhn upgrades your kernel, then the via binaries will no longer work. However some of the kernel upgrades are necessary to remove potential security problems. You have to make a decision - keep the original kernel and risk being hacked, or upgrade the kernel and lose the binary drivers. If you want to make a more informed decision about exactly what vulnerabilities you might be exposed to, you could check the Red Hat security errata page.

1.6.8. SuSe

SuSe is very popular amongst EPIA users. VIA supports versions 8.1 and 9.0. If you use a different version then you must use the open source video drivers. Versions 8.2 and 9.0 suffer the gcc conditional move problem, so don't use SUSE with older Ezra or Samuel 2 CPUs. I have heard that Suse 9.1 works ok on both the PD1000 (Nehemiah) and EPIA 5000 (Samuel 2) boards.

1.6.9. MiniMyth

MiniMyth is designed to boot over a network and run on a diskless EPIA M system. It then automatically starts up X window and runs mythfrontend from MythTV, version 0.15.1. It will run on all EPIA M series systems. It will not run on other EPIA platforms (e.g., V series).

In the current release (0.5.1), a few types of receivers are supported out-of-the-box. A homebrew IR receiver, a Pinnacle PCTV Pro external IR receiver, and the ATI RF receiver. See below for how to specify which one. It is also easy to add your own remote configuration.

This release provides TV Out (800x600) as well as CRT out. TV Out defaults to NTSC but can be switched to PAL with a simple kernel command line argument.

The release runs on Linux 2.4.24 -epia1. A compiled kernel is available in the download section, along with the .config file. It uses XFree86 4.3.99.902-epia7.

The image is currently about 66M, but since it runs in a cramfs file system, it really only takes up about 34M. On a system with 256M, this is plenty of headroom.

1.6.10. Freepia

Freepia is a small GNU/Linux distribution designed to run on Via Epia-M Mainboards. It currently runs on the M-9000 and M-10000 (ezra and nehemiah cpu) but with some modifications like kernel and X11 modules it should run on others too. (if someone has get it running on other Epia\x{00B4}s let me know). The main motivation behind this project is to build a full featured, low noise media box to play movies/mp3s/images etc. For this it uses freevo but in the future there maybe support for others like mythtv or vdr.