12. Building linux and XFree86 from Source

12.1. Building Linux 2.6.6-epia1

The 2.6.6 kernel works well on the EPIA boards using Tony Murray's patch. First, start with a recent distribution - I used Knoppix 3.4. Download the 2.6.6 kernel from kernel.org. Next, download the 2.6.6-epia1 kernel patch. Next, extract and patch the kernel:

bash$ tar -xjf linux-2.6.6.tar.bz2
bash$ mv linux-2.6.6 linux-2.6.6-epia1
bash$ cd linux-2.6.6-epia1
bash$ bz2cat ../patch-2.6.6-epia1.bz | patch -p1

Next we have to configure the kernel. If you want, you can download this stripped down config file. Copy it to linux-2.6.6-epia1/.config and execute the make oldconfig. The example .config file is designed for a Nehemiah processor. If you are using an earlier processor then you must change the CPU type to C3. Also you might want to configure the CPU Frequency Scaling feature. If you want to change the configuration, then use the make menuconfig or make xconfig commands. Then save the new configuration and build the kernel.

bash$ make oldconfig
     ... deletia ...
bash$ make
bash$ su
Password:
bash# make modules_install
bash# make install

You should know how to modify your boot configuration to boot from the new kernel. The sample config file builds a kernel with console framebuffer support, so you can boot with framebuffer using vga=791 or whatever. I haven't had time to look at the new modprobe.conf system, so I load the modules using an init script, as shown below.

#!/bin/bash

#  Script to load the modules for the 2.6.2 kernel

KERNEL_VERSION=`uname -r`

echo $KERNEL_VERSION
if [ "$KERNEL_VERSION" = "2.6.6-epia" ]; then

  /sbin/modprobe via-rhine
  /sbin/modprobe uhci-hcd
  /sbin/modprobe via82cxxx_audio
  /sbin/modprobe usbhid
  /sbin/modprobe agpgart
  /sbin/modprobe via_agp
  /sbin/modprobe via_v4l_drv
  /sbin/modprobe via
  /etc/init.d/networking restart

fi

Also, you may need to edit your /etc/modules.conf file. The usb modules have changed names, so you should have something like this:

alias usb-controller uhci-hcd
alias usb-controller1 uhci-hcd

12.2. Building Linux 2.4-epia

DANGER. This section describes builds using test kernels and experimental patches. You should never use a test kernel on a production system. You could lose all the information on your harddrive. Backup all important data before building and running a new EPIA kernel. I do not recommend using the procedures described in this section - I provide them for information purposes only. If you decide to try the techniques described here then you are responsible for any damage to your system.

You should also consider what you expect to achieve by building from source. At this time mpeg2 hardware acceleration doesn't work with kernels built from source. So fewer features will be available with a kernel built from source. You should ask yourself "Why do I want to build a kernel?" And if you have a good answer, then read on.

First, we must decide which kernel version to use. We need a version that supports CLE266 DRM. Well, none of the stable kernels support CLE266 DRM. Linux 2.6.0-test5 doesn't even support CLE266. So we must use either a 2.4.22-ac (Alan Cox) kernel or a 2.4.23-pre kernel and add patches for additional features. But some of the ac kernels have broken via-rhine drivers. So we will use the patchset that Tony Murray put together (see the viaarena discussion for more details. The patchset adds the following features to the 2.4.23-pre4 test kernel:

We need the stable linux 2.4.22 kernel and the 2.4.23-pre4 patch. We also need the 2.4.23-pre4-epia1 patch from Tony Murray's website. Then extract and patch the kernel:

bash$ tar -xjf linux-2.4.22.tar.bz2
bash$ zcat patch-2.4.23-pre4.gz | patch -p0
bash$ mv linux-2.4.22 linux-2.4.23-pre4
bash$ zcat patch-2.4.23-pre4-epia1 | patch -p0
bash$ mv linux-2.4.23-pre4 linux-2.4.23-pre4-epia1

Kernel configuration.. You need to configure the kernel. To make it a bit easier, you can download a bare-bones red hat config file. Copy the config file to .config in the linux directory:

bash$ cp redhat_config linux-2.4.23-pre4-epia1/.config

otherwise use the redhat_config file:

bash$ cp redhat_config .config

These config files specify a bare-bones EPIA system using a C3 processor. You should have a look at the configuration using make menuconfig. Make sure that the processor is set correctly. If you have a board in your PCI slot you will need to configure the kernel to support the board. When you are satisfied with your kernel save it and do the normal kernel build procedure:

bash$ make dep
bash$ make bzImage
bash$ make modules
bash$ su
Password:
bash# make modules_install
bash# make install

Make install will build a new initrd and add a new boot entry to /boot/grub/grub.conf. So now reboot your system and remember that this kernel tree is experimental. Did you make those backups?

12.3. Building XFree86 from Source

Read Thomas Hellstrm's excellent instructions.