Kernel Patches and Patchsets

From ArchWiki
Revision as of 14:45, 5 July 2010 by Quarkup (talk | contribs)
Jump to: navigation, search

Merge-arrows-2.pngThis article or section is a candidate for merging with kernels.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Kernel Patches and Patchsets#)

Using patches and patchsets

The number of posts on the forums about kernel patches and patchsets has been steadily increasing, prompting the drafting of this document which aims to be a definitive guide. It seems it would also be useful to reduce the need for every wiki to include a kernel patch howto!

There are lots of reasons to patch your kernel, the major ones are for performance or support for non-mainline features such as reiser4 file system support. Other reasons might include fun and to see how it is done and what the improvements are.

However, it is important to note that the best way to increase the speed of your system is to first tailor your kernel to your system, especially the architecture and processor type. For this reason using pre-packaged versions of custom kernels with generic architecture settings is not recommended or really worth it. A further benefit is that you can reduce the size of your kernel (and therefore build time) by not including support for things you don't have or use. For example, I always start with the stock kernel config when a new kernel version is released and I remove support for things like bluetooth, video4linux, 1000Mbit ethernet, etc. Stuff I know I won't use before I build my next kernel! However, this page is not about customizing your kernel config but I would recommend that as a first step to be combined with a patchset later.

PLEASE NOTE - most patchsets have a disclaimer attached to them - this is for good reason!

This document attempts to cover:

  • How to install the patched kernels
  • What the patchsets do and where to get them

How to install

This is very easy if you have used abs and makepkg before, and easiest with the latest kernels. If you haven't built any custom packages yet you may like to leave this till after you have some experience. See also: Arch Build System and Creating Packages

If you haven't actually patched or customized a kernel before it is not that hard and there are many PKGBUILDS on the forum for individual patchsets. However, I would advise you to start from scratch with a bit of research on the benefits of each patchset rather than jumping on the nearest bandwagon! This way you'll learn much more about what you are doing rather than just choosing a kernel at startup and wondering what it actually does.

The following wiki pages have also been written to aid the process of building a kernel with ABS:

  • Custom Kernel Compilation with ABS - this has been written especially to account for the variables used when patching the latest kernel versions, using the standard kernel versioning variables - a special patch version is also available

See also:

NOTE on compile times - please add to this!

You might be wondering how long it takes to build a kernel. As I already said that depends on the size (i.e. what drivers are included) but also on your hardware (CPU, RAM) and (ironically) which kernel you are already running!

Compiling with ccache support speeds up the compilation time. Also compiling gcc before kernel compilation or compiling the kernel using an optimized kernel will speed up the build process.

DibbleTheWrecker
approx 1h - P3M 1Ghz
Mith
approx 20min - AMD AthlonXP2200+
RedShift
approx <10 min - AMD Athlon64 3500+/ 1 GB RAM
approx 50 min - Pentium III 1 Ghz / 512 MB RAM
approx 30 min - Dual Pentium III 866 Mhz / 1 GB RAM
Me (iphitus?)
approx 15 min - AMD AthlonXP2000+ / 512 MB RAM
hellwoofa
approx 15 min (1st run) / 6 min (2nd) - AMD AthlonXP3000+ / 512 MB RAM and ccache
Bavardage
approx 30 min - Intel CoreDuo T2050 @ 1.60GHz (with -j 4 makeflags)
EVRAMP
45min - Intel Celeron 2.4GHz / 512MB RAM
Tj
35 Minutes - Intel Pentium M 1.8GHz/512MB RAM (compiled only neccesay drivers and modules, heavily monolithic result).

Major patchsets

First of all it is important to note that patchsets are developed by a variety of people. Some of these people are actually involved in the production of the linux kernel and others are hobbyists - this should be considered to reflect a level of reliability and stability!

It is also worth noting that some patchsets are built on the back of other patchsets (which may or may not be reflected in the title of the patch). Patchsets (and kernel updates) can be released very frequently and often it is not worth keeping up with ALL of them so don't go crazy, unless you make it your hobby!

You can search google for more sets - remember to use quotes "-nitro" for example otherwise google will deliberately NOT show the results you want!

Could people please add their experiences and comments about different patchsets below esp. re: stability (crashes), reliability (fixes) and performance.

NOTE - this section is for information only - clearly no guarantees of stability or reliability are implied by inclusion on this page.

-ck

These are patches designed to improve system responsiveness with specific emphasis on the desktop, but suitable to any workload. The patches are created and maintained by Con Kolivas, his site is at http://members.optusnet.com.au/ckolivas/kernel/. Con maintains a full set but also provides the patches broken down so you can add only those you prefer.

The -ck patches can be found at http://ck.kolivas.org/patches/2.6/

-rt

This patchset is maintained by a small group of core developers, led by Ingo Molnar. This patch allows nearly all of the kernel to be preempted, with the exception of a few very small regions of code ("raw_spinlock critical regions"). This is done by replacing most kernel spinlocks with mutexes that support priority inheritance, as well as moving all interrupt and software interrupts to kernel threads.

It further incorporates high resolution timers - a patch set, which is independently maintained.

[as said from the Real-Time Linux Wiki]

patch at http://www.kernel.org/pub/linux/kernel/projects/rt/

-grsecurity

Grsecurity is a security focused patchset. It adds numerous security related features such as Role-Based Access Control and utilizes features of the PaX project. It can be used on a desktop but a public server would receive the greatest benefit. Some applications are incompatible with the additional security measures implemented by this patchset. If this occurs, consider using a lower security level.

The -grsecurity patches can be found at http://grsecurity.net

- Tiny-Patches

The goal of Linux Tiny is to reduce its memory and disk footprint, as well as to add features to aid working on small systems. Target users are developers of embedded system and users of small or legacy machines such as 386s.

and maybe also ricers ;-)

Patch releases against the mainstream Linux kernel have been discontinued. The developers chose to focus on a few patches and spend their time trying to get them merged into the mainline kernel.

-fallen

A newer patchset, aimed at providing most of the patches that -beyond had. It has the -ck patchset, fbsplash, reiser4, suspend2, latest 2.6.x.y patch, ACPI DSDT, squashfs, and Genpatches.

http://www.fallendusk.org/linux_patches/fallen/

Discontinued (last released for 2.6.22).

-viper

"The main goal of this patchset is pretty much to offer the latest features, decrease latencies, decrease overhead, and improve interactivity. The only difference is experimental versions of everything."

Note that the creator and maintainer of this patchset passed away July 2007: http://forums.gentoo.org/viewtopic-t-572071.html

Individual patches

These are patches which can be simply included in any build of a vanilla kernel or incorporated (probably with some major tweaking) into another patchset. I have included some common ones for starters.

Reiser4

Reiser4FShowto - http://www.namesys.com

Gensplash/fbsplash

Gensplash - http://dev.gentoo.org/~spock/projects/