Home page of this blog

Thursday, June 23, 2011

Custom kernel ubuntu amd64 packages optimized for core2 and above

This package is created in Ubuntu 11.04 and should install fine in all versions of Ubuntu Linux 11.04 (as well 10.10) and Linux Mint 11 (as well Mint 10) (should as well in debian squeeze but not sure about dkms)

The build is for 64bit core2 and above processors

The following are the configuration settings

  1. Kernel Timer Frequency set to 1000 HZ
  2. Processor is selected as CORE2
  3. main Makefile modified to use -Ofast of gcc 4.6
    see below for the changes
    HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -Ofast -fomit-frame-pointer


    KBUILD_CFLAGS   += -Os
    KBUILD_CFLAGS   += -Ofast

  4. Makefile and Makefile_32 modified to reflect march settings and mtune settings to core2 (new arch of gcc 4.6)
  5. Scheduled autogroup enabled
  6. Transparent hugepage support enabled
  7. Copied kernel source to /usr/src and built from /usr/src folder 
  8. Used enterprise linux kernel config as the base config and the kernel mostly seems to have no kernel debug prints because of it. Hence it runs considerably faster than stock Ubuntu kernel (well we can feel it) (I extracted the srpm to recreate the el6 config, the el6 srpm can be downloaded from http://ftp.redhat.com/redhat/linux/enterprise/6Workstation/en/os/SRPMS/kernel-2.6.32-131.0.15.el6.src.rpm)

How to install

To install

sudo dpkg -i linux-image- linux-headers-

followed by (these steps update-initramfs and update-grub are not required for mint10 or maverick, these were required when using Ubuntu Lucid)

sudo update-initramfs -c -k

and final step of

sudo update-grub

before rebooting.

To test reboot into the newly installed kernel from grub

How to build yourself

follow my blog on how to build kernel in ten steps at

Kernel Source

I downloaded the kernel source tarball from kernel.org


Dropbox Download Links



ebeb774d9b1037e9c1aee2da37f4a3f077a59fa7ae4fb8b546eeed725a5e3791  CONFIG-CORE2SWIFT
34f226618e52b4adebc27cec189042ab7504e4e77bd1c89ea11445e41da27096  Readme.odt
9144b147265d423cffbf115c4627b3e717eb1a3c761d1f7d66bda5ec9aa03e5b  Readme.pdf
cdcd06167cd6a2a88f5a58c4d2f3eda597d278116dbf6632b0ed8264d8112041  linux-headers-
c99827ddd927d65dd30704f3bf8168f4032917012ffe5dff666a3c25eb7ddce9  linux-image-


d02d52d124f4e876f4805cc36d55cf3d  CONFIG-CORE2SWIFT
6eadb25e6ea652445a7c8c6721407b87  Readme.odt
4c769e74062a2a185840a464ee36af2a  Readme.pdf
fdec875cc4b03278668126b73f109015  linux-headers-
a12b39f6de8e2f2448b9e6c9e7413d56  linux-image-


  1. Hey, just wanted to say thank you for putting this up so quickly. I was able to install it and test drive it for a few days now, but got caught up with the daily grind and didn't have a chance to come back and comment on it.

    This is definitely one of the snappier kernels I've tried here. My only complaint, is that for some reason there is the following config:


    This happened in one other 2.6.38.x kernels I tried. This is the EXTREMELY loud and annoying PCBeep that occurs on every shut down or restart. My audio works fine, but this is the internal pc speaker beep. Because it's hard-wired in the kernel config and not a module, I can't disable it. It's quite frustrating and I really wish this was not even a kernel config option. The pcspkr module is blacklisted by default now, and is currently blacklisted now here, but the ear piercing beep remains.

    More info:
    I: Bus=0001 Vendor=111d Product=76b2 Version=0001
    N: Name="HDA Digital PCBeep"
    P: Phys=card0/codec#0/beep0
    S: Sysfs=/devices/pci0000:00/0000:00:1b.0/input/input13
    U: Uniq=
    H: Handlers=kbd event13
    B: PROP=0
    B: EV=40001
    B: SND=6

    Here's the comment I made about this back in March: http://duopetalflower.blogspot.com/2011/03/custom-kernel-26381-ubuntu-amd64.html?showComment=1301496063363#c3230551967507403923

    Same deal, but it's event13 this time vs event10

    "HDA Digital PCBeep" does not show up in my list of input devices, and I do not get this beeping with the plain vanilla/Ubuntu 2.6.38 or 2.6.39 kernels

    I also still received the symlink errors:
    Hmm. There is a symbolic link /lib/modules/

    However, I can not read it: No such file or directory
    Therefore, I am deleting /lib/modules/

    Hmm. The package shipped with a symbolic link /lib/modules/
    However, I can not read the target: No such file or directory
    Therefore, I am deleting /lib/modules/

    This time though, the broken symlink is pointing to:

    Seems like some important stuff in there, but the kernel appears to be working fine without it. *shrugs*

    Thanks again. :)

  2. Thanks for the kernel config which sets the PC beep, I will try to disable and rebuild it.

    Also I will check why the symbolic errors are coming. Sorry, have to goto work, may take this weekend or I need to burn midnight oil

  3. I don't think it's a good idea to use -Ofast flag since it enables -ffast-math and using this flag is a bit riski.

    According to documentation:
    This option causes the preprocessor macro __FAST_MATH__ to be defined.

    This option should never be turned on by any -O option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications for math functions.

  4. Ok what do you suggest? I guess it is ok to stay with -O2 then

  5. If you want to be on the safe side, then you should stick to -O2, for experimenting it's ok to use -Ofast.
    On the other hand it would be nice to know the real difference when using -Ofast flag. Maybe you could run phoronix-test-suite or some other benchmarking tool with different kernels (one with -Ofast and another with -O2).

  6. Yeah, Maybe I can try that over weekend

  7. For a casual user like me, I am happily running -Ofast compiled kernel from the moment I built with that flag, could be more than 15 days atleast I guess, but yeah it would be good to be with -O2 for safety. The following are the ones I would follow to be really safe with linux

    1. Choose Debian Stable or Ubuntu LTS or RedHat Enterprise Linux
    2. Would stick to the default kernel coming with the stable distro and never play with defaults
    3. Would use virtualization for every other developers itch or testing (I have seen Fedora kernels were built from Red Hat Enterprise Linux running Xen from some config files while I was playing with Fedora)
    4. Would not invest on newly released hardware as it would have problems with drivers (like new nvidia cards or new processors or SSD's or ...)
    5. Would stay with proven GCC version rather than using just released GCC
    6. Would install all security updates immediatly
    7. Would use obscure protocols so that no one can hack

    Or to summarize if I want to feel safe I would stick to all stable versions.

    But no for just using firefox/chromium, watch movies, play songs, play games, compile, test programs... which is what I am doing ...