VIA S3 Chrome9 HC Linux Display Driver Source Code Compiling Instructions June 11, 2007 Copyright (C) 2002-2007 VIA Technologies, INC. 1. Summary This document describes how to compile the VIA Chrome9 HC family Linux display driver source code on Debian Linux 4.0, Fedora Core Linux 5/6,and Mandriva Linux 2007.0. This software package supports 2D, 3D, TV-Out, V4L, hardware video mpeg and hardware video overlay. Other distributions only support 2D, TV-Out, hardware video mpeg and hardware video overlay. The information and the source code files are provided "AS IS" without guarantee of any kind. 2. Set up environment (kernel 2.6.x) (1) Xorg SDK RPM/DEB package (Debian4/FC5/FC6/MDV2007.0) Debian Linux 4.0: xorg-dev (deb) Fedora Core Linux 5.0: xorg-x11-server-sdk-1.0.1-8.i386.rpm Fedora Core Linux 6.0: xorg-x11-server-sdk-1.1.1-47.fc6.i386.rpm Mandriva Linux 2007.0: libxorg-x11-devel-7.1.0-6mdv2007.0.i586.rpm (2) VIA Chrome9 HC family display driver version: 4.1.0079. The driver source code comprises files in three directories as described below: via (Header files, 2D XServer and V4L driver source files) VIA-VMILIB (MPEG dynamic-link object code) 3D (VIA DRM/AGP source files and 3D DRI dynamic-link object codes for default Debian Linux 4.0, Fedora Linux Core 5/6, and Mandriva Linux 2007.0) Utility (VIA/S3G TV display utility) 3. Prepare kernel source for VIA display driver (DRM) or rebuild kernel (AGP). *The sample is default kernel in Fedora Core Linux 5. # rpm -ivh kernel-2.6.15-1.2054_FC5.src.rpm # cd /usr/src/redhat/SPECS/ # rpmbuild -bp kernel-2.6.spec --target=i686 # mv /usr/src/redhat/BUILD/kernel-2.6.15/linux-2.6.15.i686 /usr/src/ # ln -sf /usr/src/linux-2.6.15.i686 /usr/src/linux *The sample is default kernel in Fedora Core Linux 6. # rpm -ivh kernel-2.6.18-1.2798.fc6.src.rpm # cd /usr/src/redhat/SPECS/ # rpmbuild -bp kernel-2.6.spec # mv /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386 /usr/src/ # ln -sf /usr/src/linux-2.6.18.i386 /usr/src/linux *The sample is default kernel in Debian Linux 4.0. # cd /usr/src/ # tar jxvf kernel-source-2.6.18.tar.bz2 # cd kernel-source-2.6.18 # cp /boot/config-2.6.18-4-486 .config Note: Depending on your system used, it may take 10 or 15 minutes to finish. Note: Mandriva Linux 2007.0 will have the kernel source tree in /usr/src/ folder when installing the kernel source rpm package "kernel-source-2.6.17.5mdv-1-1mdv2007.0". 4. Modify the "Makefile" file for syncing to the kernel version users used. # vi /usr/src/linux/Makefile (make sure the "EXTRAVERSION" value in Makefile is the same as OS kernel version "#uname -r". e.g. "EXTRAVERSION=-1.2054_FC5" in FC5, "EXTRAVERSION=-1.2798.fc6" in FC6, "EXTRAVERSION=-5mdv" in MDV2007.0 and "EXTRAVERSION=-4-486" in Debian4) # make modules_prepare (configure the run time settings of kernel source by this command in /usr/src/linux folder) 5. Use a script to build VT3336-3364XORG40079 driver and select the "79" version and CPU type to build. The driver binary will be created in default /VT3336-3364XORG40079 folder. # tar zxvf VT3336-3364XORG40079-kernel-src_[date].tgz # cd VT3336-3364XORG40079-kernel-src_[date]/src # ./makedriver drm (Other distributions only build 2D/MPEG driver) 6. If users want to enable AGP feature (higher performance) for CN896, K8M890, P4M900 and VN896 IGPs, users need to rebuild kernel source with VIA's agpgart patch in Fedora Core Linux 5/6. The "makedriver" script had copied some new AGP files to the kernel source tree. If users skip this step, the VIA driver will use the PCI feature to work. *The sample is default kernel in Fedora Core Linux 5. # cd /boot/ # cp vmlinuz-2.6.15-1.2054_FC5 vmlinuz-2.6.15-1.2054_FC5.orig # cp System.map-2.6.15-1.2054_FC5 System.map-2.6.15-1.2054_FC5.orig # cp initrd-2.6.15-1.2054_FC5.img initrd-2.6.15-1.2054_FC5.orig.img # cd /usr/src/linux # make; make modules_install # cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.15-1.2054_FC5 # cp Systme.map /boot/System.map-2.6.15-1.2054_FC5 # cd /boot/ # mkinitrd initrd-2.6.15-1.2054_FC5.img 2.6.15-1.2054_FC5 *The sample is default kernel in Fedora Core Linux 6. # cd /boot/ # cp vmlinuz-2.6.18-1.2798.fc6 vmlinuz-2.6.18-1.2798.fc6.orig # cp System.map-2.6.18-1.2798.fc6 System.map-2.6.18-1.2798.fc6.orig # cp initrd-2.6.18-1.2798.img initrd-2.6.18-1.2798.fc6.orig.img # cd /usr/src/linux # make; make modules_install # cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.18-1.2798.fc6 # cp Systme.map /boot/System.map-2.6.18-1.2798.fc6 # cd /boot/ # mkinitrd initrd-2.6.18-1.2798.fc6.img 2.6.18-1.2798.fc6 Note: Depending on your system used, it may take 1 or 2 hours to finish. Note: Make sure users' IDE(DMA) feature can work properly in VT8237A/VT8237S/VT8251/CX700(M/M2)/VX700(M/M2) chips. If not, please patch the PIDE driver before rebuild the kernel. Note: In Debian Linux 4.0, and Mandriva Linux 2007, because of the module mode drivers "via-agp.ko" amd "amd64-agp.ko" users don't rebuild the whole kernel source. The "makedriver" script will create a new "via-agp.ko" and "amd64-agp.ko" drivers automatically. Reboot OS and adopt this new kernel image to boot. Use the "dmesg" command in X Window terminal to check agpgart module support with CN896/K8M890/P4M900/VN896. # dmesg | grep agpgart agpgart: Detected VIA chipset: K8M890. agpgart: AGP aperture is 128M @ 0x80000000 agpgart: Found an AGP3.5 compliant device at 0000:00:00.0. apggart: X tried to set rate=x12. Setting to AGP3 x8 mode. agpgart: Putting AGP V3 device at 0000:00:00.0 into 8x mode agpgart: Putting AGP V3 device at 0000:01:00.0 into 8x mode 8. Confirm the existence of "via_drv.so", "libddmpeg.so", "via_v4l_drv.ko", "drm.ko", "uma.ko", "uma_dri.so", "libGL.so.1.2", "libOGL.so", and "Utility". Use a script "vinstall" to setup those drivers and VIA/S3G TV display utility. # ./vinstall (select 1. VMI-ONLY path or 2. V4L path) Use the command "lsmod" to check whether the modules are successfully loaded. If users see the "uma" and "via_v4l_drv" modules, then the V4L driver path is successfully loaded. If users select VMI-ONLY driver path, there is only one "uma" module. Note: There is the "via-agp.ko" and "amd64-agp.ko" drivers in Debian Linux 4.0, and Mandriva Linux 2007.0. It will replace the OS default via-agp or amd64-agp driver. Note: VMI-ONLY path is a non-kernel dependency way to enable the VIA 2D/3D/ HW MPEG/TV features. Note: Other distributions will only create two binary codes (via_drv.so and libddmpeg.so) Note: Please disable the AIGLX feature on Debian 4.0 Linux, Fedora Core 6 Linux and Mandriva 2007.0 Linux for the AIGLX error in the /var/log/Xorg.0.log file. Add some lines to the /etc/X11/xorg.conf as follows: Section "ServerFlags" Option "AIGLX" "off" EndSection Appendix: Fedora Core Linux 5.0 dependency packages: bash-3.1-6.2 bison-2.1-1.2.1 cpp-4.1.0-3 expat-1.95.8-8.2 flex-2.5.4a-37.4 fontconfig-devel-2.3.94-1 freetype-devel-2.1.10-5.2.1 gcc-4.1.0-3 glibc-devel-2.4-4 kernel-2.6.15-1.2054_FC5.src.rpm libstdc++4.1.0-3 libpng-devel-1.2.8-2.2.1 ncurses-devel-5.5-19 pam-devel-0.99.3.0-2 rpm-4.4.2-15.2 rpm-build-4.4.2-15.2 xorg-x11-server-sdk-1.0.1-8 zlib-devel-1.2.3-1.2.1 Fedora Core Linux 6.0 dependency packages: bash-3.1-16.1 bison-2.3-2.1 cpp-4.1.1-30 expat-1.95.8-8.2.1 flex-2.5.4a-41.fc6 fontconfig-devel-2.4.1-3.fc6 freetype-devel-2.2.1-10.fc6 gcc-4.1.1-30 glibc-devel-2.5-3 kernel-2.6.18-1.2798.fc6.src.rpm libstdc++4.1.1-30 libpng-devel-1.2.10-7 ncurses-devel-5.5-24.20060715 pam-devel-0.99.6.2-3.fc6 rpm-4.4.2-32 rpm-build-4.4.2-32 unifdef-1.171-5.fc6 xorg-x11-server-sdk-1.1.1-47.fc6 zlib-devel-1.2.3-3 Debian Linux 4.0 dependency packages (deb): autoconf (>2.53) automake1.9 (>1.6) autotools-dev build-essential bash cpp-4.1 freeglut3 gcc-4.1-base gcc-4.1 linux-headers-2.6.18-4-486 linux-kbuild-2.6.18 linux-source-2.6.18 libdrm-dev libgl1-mesa-dev libncurse5 libnucrse5-dev libtool m4 mesa-common-dev mesa-utils xorg-dev (includes some dependency packages) xserver-xorg-dev (includes some dependency packages) Mandriva Linux 2007.0 dependency packages: bash-3.1-7mdv2007.0 gcc-cpp-4.1.1-3mdk libexpat0-1.95.8-3mdk fontconfig-devel-2.4.1-3.fc6 libfontconfig1-devel-2.4.1-1mdv2007.0 gcc-4.1.1-3mdk glibc-devel-2.4-4mdk glibc-static-devel-2.4-4mdk (static libm.a library) kernel-source-2.6.17.5mdv-1-1mdv2007.0 libmesagl1-devel-6.5-17mdv2007.0 libstdc++6-4.1.1-3mdk libpng3-devel-1.2.12-2mdv2007.0 libxxf86vm1-devel-1.0.1-2mdv2007.0 mesa-demos-6.5-17mdv2007.0 (GLX demo) libncurses5-devel-5.5-1.20051029.4mdv2007.0 libpam0-0.99.6.0-3mdv2007.0 libxvmc1-devel-1.0.2-2mdv2007.0 rpm-4.4.6-10mdv2007.0 rpm-build-4.4.6-10mdv2007.0 libxorg-x11-devel-7.1.0-6mdv2007.0 zlib1-devel-1.2.3-2mdv2007.0 Note: After installing OS, using command "rpm -qa | grep gcc" (rpm base) or "dpkg -l | grep gcc" (deb base) to verify the following packages have been installed on the system. Note: There is a convenient GUI package manager "Synaptic Package Manager" in Debian 4.0 (update "/etc/apt/sources.list" file and ebable LAN feature). Please click the "Reload Package Information" in the tool then install and update any package we need above.