Saturday, September 23, 2006

Compiling the vt1211.ko Kernel Module

I basically followed the directions from VIA, except I used the latest patch file for kernel 2.6.17 available at Lars Ekman's website: http://hem.bredband.net/ekmlar/vt1211.html instead of the one VIA provides in their VIA FC5 Hardware Monitor Application Notes (www.viaarena.com). The patch file is designed to patch the whole kernel tree (only a small part, but you need the whole thing). If you have 2.6.17-1.2174_FC5, the module I compiled is already available on Lars Ekman's website.


Below is a copy & paste of the instructions from VIA, available on VIA Arena, with annotations made where I remember their instructions didn't work. Fill in the mentioned kernel name with your kernel. If I ever have to do this again, I'll make my own instructions.


I got the corresponding kernel source package from YUM instead of downloading the RPM. The package is called kernel-devel. This puts files in /usr/src/redhat. Note that when you're done, you can use YUM to again remove this package. I had to do a few things to get rpmbuild installed and working (I remember it needed a few software packages from YUM), but then I could make it through the first few lines.



#rpm –ivh kernel-2.6.15-1.2054_FC5.src.rpm
#cd /usr/src/redhat/SPECS
#rpmbuild –bp –-target=i686 kernel-2.6.spec
#cd /usr/src/redhat/BUILD


Then they want you to move the kernel source tree to /usr/src/{name of kernel} and then apply the patch.



You can find the kernel source directory in path
/usr/src/redhat/BUILD/kernel-2.6.15/linux-2.6.15.i686. Move the
kernel source directory to path /usr/src/kernels and patch
the os default kernel.
#cd /usr/src/redhat/BUILD/kernel-2.6.15
#mv linux-2.6.15.i686 /usr/src/linux-2.6.15-1.2054_FC5
#cp vt1211_FC5.patch /usr/src
#cd /usr/src
#patch –p0


Now you have the new kernel tree, and you need to compile the kernel with the vt1211 source as a module to get the vt1211.ko.



Select needed item and rebuild the patched kernel
Edit the Makefile in directory linux-2.6.15-1.2054_FC5.Find the string
“EXTRAVERSION = -prep” and modify it to “EXTRAVERSION = -1.2054_FC5”.
#cd linux-2.6.15-1.2054_FC5
#cp /boot/config-2.6.15-1.2054_FC5 .config
#make menuconfig
Device Drivers ---> Hardware Monitoring support --->
[M] Hardware Monitoring support
[M] VT1211
After set the kernel item completely and save it, we can rebuild the kernel
source. When the compiling module procedure is completed, you can find
the “vt1211.ko” module to path
/lib/modules/2.6.15-1.2054_FC5/kernel/drivers/hwmon
#make
#cp linux-2.6.15-1.2054_FC5/drivers/hwmon/vt1211.ko
/lib/modules/2.6.15-1.2054_FC5/kernel/drivers/hwmon
#depmod -a


The GUI menuconfig didn't work for me. If you run make config, you can do the same thing in text mode. If you just run make, I think it will ask you if you want Kernel/Module whenever not specified by the .config file you copied from your boot folder. Make sure you select Module (type the letter 'm') for the vt1211 objects. Then, about six hours later, it'll finally make it through all the source and you'll get your .ko file. Copy it out of there and into your /lib/modules tree and then run depmod as in the instructions above.


When you're done, you can go back to the /usr/src/{linux kernel name} and run make clean, or you can remove that whole directory if you no longer need it. You can also remove the kernel-devel package, rpmbuild, etc.

Update

Linux kernel 2.6.21 now includes an even better version of the vt1211 module! This kernel is the default on RedHat Fedora 7 Linux. Finally time to upgrade my server installation.


No comments: