11.04 Folding kernel + pciehp disabled + BFS + VM

Biffa

Limp Gawd
Joined
Jan 7, 2011
Messages
226
Intro

OK, so the guys on these forums have provided amazing and helpful info with the Ubuntu Desktop Installation Guide for F@H , SR-2 Optimization Thread and lately the I hate Linux thread :)

I've been folding for a while now and have mainly been a windows folder, dabbling in VMWare images for bigadv, but my SR-2 has been jealous watching the linux folders get all the points so I tried a few times to get it working, but as the machine doubles as my VM Server for domain/web/mail duties I needed it to work in Linux as well.

But I couldn't get all the tweaks such as BFS to work AND have Virtual machines as well, because there was an incompatability between the method in the guide of getting the BFS kernel and the required "bits" that let VMware or VirtualBox run.

I had another problem with Linux 10.10 gave me huge numbers of pciehp (hotplug) errors in the Linux log files, a couple every second, which a) filled up the log files alarmingly, b) kept hitting the hard disk (not what you want when folding bigadv) and c) was hitting the cpu enough for me to notice a folding hit.

So the only way to get all the things I wanted was to compile my own kernel, which I had never done before.

Compiling a custom kernel with BFS (-ck)

So I looked all over for info on compiling kernels and there are loads of tutorials out there, most of which work, but after trial and error these steps seemed to work best, and after a few test runs making just plain cfs kernels without the pciehp stuff I worked out how to add the bfs stuff in.

Bear in mind this is for 11.04 Ubuntu desktop I haven't tried it any other version.

Compiling the kernel

Updated for 2.6.39.x kernel which improves performance over 2.6.38.x


1. Install these packages:

Code:
sudo apt-get install kernel-wedge kernel-package libncurses5-dev

2. Run this command
Code:
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)

3. Create your source directory
Code:
mkdir ~/src
cd ~/src

4. Download the Kernel source
Code:
apt-get source linux-image-$(uname -r)
Note above is the best way but if you can't get the source this way (I couldn't) then follow the steps below:

4a. Download Kernel (alternative method)
Code:
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.1.tar.bz2

4b. Unzip Kernel
Code:
tar -xpjf linux-2.6.39.1.tar.bz2

5. Download the BFS patch
Code:
wget http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.39/2.6.39-ck2/patch-2.6.39-ck2.bz2

6. Patch the source
You need to know where you downloaded the patch file above, for me it was in /home/username/src
Code:
cd linux-2.6.39.1
bzip2 -cd [I]/path/to_where_you_downloaded[/I]/patch-2.6.39-ck2.bz2 | patch -p1


7. Configure your Kernel

It's a good idea to use the configuration of your current working kernel as a basis for your new kernel. Therefore we copy the existing configuration

Code:
cp /boot/config-`uname -r` ./.config

Code:
make menuconfig

Which brings up the kernel configuration menu. Go to:


Load an Alternate Configuration File


and choose .config (which contains the configuration of your current working kernel) as the configuration file

OK here is where you can disable the pciehp drivers to prevent the error filling up your log files if you have it, if not you can skip this bit. But its a text mode setup screen and the drivers are in:

Bus options (PCI etc.) --->
<*> PCI Express Hotplug driver


You want to exclude that feature by scrolling down to it and pressing <N> the star should then dissapear from between the anglebrackets. Then exit out and save any changes.

You can if you feel brave, remove any unnecessary drivers or modules, but BEWARE you can break your kernel removing the wrong thing. :eek:

8. Speed up the build
To make compiling faster you can tell it to use more cores, general rule, concurrency level = number of processor cores + 1 so for the SR-2 its 2 x 6 + 1 = 13 any other cpu you make the call
Code:
export CONCURRENCY_LEVEL=13
(note I use 13 and can compile the kernel in under 10 minutes) :)

9. Clean up temp files from a previous compile attempt (skip if necessary)
Code:
make-kpkg clean

10. Compile your Kernel
You can change -sr2 to anything you wish I use -sr2 for obvious reasons :)

Code:
time fakeroot make-kpkg --initrd --append-to-version=[B][COLOR="Cyan"]-sr2[/COLOR][/B] kernel-image kernel-headers

9. Install your Kernel
Again change -sr2 to whatever you chose
Code:
cd ~/src
sudo dpkg -i linux-headers-2.6.39.1-ck2[B][COLOR="Cyan"]-sr2[/COLOR][/B]_2.6.39.1-ck2[COLOR="Cyan"]-sr2[/COLOR]-10.00.Custom_amd64.deb
sudo dpkg -i linux-image-2.6.39.1-ck2[B][COLOR="Cyan"]-sr2[/COLOR][/B]_2.6.39.1-ck2[COLOR="Cyan"]-sr2[/COLOR]-10.00.Custom_amd64.deb

10. Rebooting and choosing kernels
Ok now your kernel is set to be default when you next reboot, hopefully if all went well you won't have any problems and you can check after you reboot with:
Code:
uname -a
to see if your using the new kernel.

However there may be a time when you want to change back for some reason. You can do this two ways, you can hold down left shift while booting up to get to the GRUB boot menu, and choose a different kernel or you can install a nice GUI util called "Startup manager" which is available in Synaptic Package Manager if you search for "startupmanager" this lets you set the default kernel when booting.

So last thing is reboot and see how you go! :)

Hope this helps some people, it was a steep learning curve for me hopefully less painful for you now.
 
Last edited:
Nice guide! I think you actually want the 2.6.39 kernel though. The 2.6.38 has some issues with spawning kworker daemons from what I have seen.

FYI, I am almost convinced that you can disable something in the SR-2 bios to prevent the pciehpd errors. I just have never been able to figure out what.
 
very nice guide, ill have to give it more of a look, wish i had real reason for it though :D
 
Nice guide! I think you actually want the 2.6.39 kernel though. The 2.6.38 has some issues with spawning kworker daemons from what I have seen.

FYI, I am almost convinced that you can disable something in the SR-2 bios to prevent the pciehpd errors. I just have never been able to figure out what.

Re kernel, no idea I think thats the one my 11.04 ended up with after all the patching during the initial install. I haven't had any problems with .38 and tbh I don't even know what I'd be looking for if I did :D

And yes me to on the SR-2 bios, but its the downtime trying to find it and then it probably disables something else! :p

But its not like I'm going to be hot plugging anything in anyway so its best of out of the kernel imho, same with a bunch of other drivers I removed when I was building the config like isdn scsi etc, I guess thats the beauty of building it yourself. I'd love to be able to work out just exactly what you need for the SR-2 and exclude everything else from the config before doing a make so its clean as a whistle.
 
awesome guide. if I get some spare time I'm going to give this a whirl. For now, it's bookmarked.

Thanks Biffa for fighting this battle with me!
 
no worries jebo :) Maybe I'll get a G4 quad system to keep this lot honest :D

Been playing with my ubuntu, bit sad I know but now it looks like a Mac :p
 
UPDATE:

To use the 2.6.39 kernel + BFS, replace steps 3-6 with this:
Code:
mkdir ~/src
cd ~/src
apt-get source linux-image-$(uname -r)
cd linux-2.6.39
wget http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.39/2.6.39-ck2/patch-2.6.39-ck2.bz2
bzip2 -cd patch-2.6.39-ck2.bz2 | patch -p1
The BFS patch needs to match the kernel version. This is actually the release candidate patch, but it seems to work fine with the 2.6.39-0 kernel that is currently available. I am seeing MUCH more consistant frame times on the 2 SR-2s that I updated today.

I also added a link to this post from my install guide. Thanks again Biffa!
 
Ugh. Ok now I need to figure out if its worth making the switch.
 
Unless your performance is degrading significantly, I wouldn't. I had one SR-2 doing ~130K ppd and one that was dipping under 100K ppd, when they both should do 160K+. Now they are back up where they should be.
 
UPDATE:

To use the 2.6.39 kernel + BFS, replace steps 3-6 with this:
Code:
mkdir ~/src
cd ~/src
apt-get source linux-image-$(uname -r)
cd linux-2.6.39
wget http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.39/2.6.39-ck2/patch-2.6.39-ck2.bz2
bzip2 -cd patch-2.6.39-ck2.bz2 | patch -p1
The BFS patch needs to match the kernel version. This is actually the release candidate patch, but it seems to work fine with the 2.6.39-0 kernel that is currently available. I am seeing MUCH more consistant frame times on the 2 SR-2s that I updated today.

I also added a link to this post from my install guide. Thanks again Biffa!

Only problem I have is that apt-source linux-image-$(uname -r) didn't work for me for some reason. I had to wget it from kernel.org.

Just tried again and still not working, even if I specify linux-image-2.6.39 :(
 
Only problem I have is that apt-source linux-image-$(uname -r) didn't work for me for some reason. I had to wget it from kernel.org.

Just tried again and still not working, even if I specify linux-image-2.6.39 :(

Odd...I just did exactly this twice last Friday and the source pulled in without issue. The only thing i really changed from your guide was the version of the BFS patch.
 
I've put both methods in just in case someone has a wierd setup like me :)
 
Back
Top