A.2. Managing Your Patches with quiltKernel development using patch and diff generally works quite well. But after a while, most people grow tired of it and look for a different way to work that does not involve so much tedious patching and merging. Luckily, a few kernel developers came up with a program called quilt that handles the process of manipulating a number of patches made against an external source tree much easier. The idea for quilt came from a set of scripts written by Andrew Morton that he used to first maintain the memory management subsystem and then later the entire development kernel tree. His scripts were tied very tightly to his workflow, but the ideas behind them were very powerful. Andreas Gruenbacher took those ideas and created the quilt tool. The basic idea behind quilt is that you work with a pristine source tree and add a bunch of patches on top of it. You can push and pop different patches off of the source tree, and maintain this list of patches in a simple manner.
The file patches/patch1 will contain a patch with the changes that you have just made: $ cat patches/patch1 Index: linux-2.6.19/Makefile =================================================================== --- linux-2.6.19.orig/Makefile +++ linux-2.6.19/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 19 -EXTRAVERSION = +EXTRAVERSION = -dirty NAME=Crazed Snow-Weasel # *DOCUMENTATION* You can continue on, working with this single patch, or create a new one to go on top of this patch. As an example, if three different patches had been created, patch1, patch2, and patch3, they will be applied one on top of one another. To see the list of patches that are currently applied: $ quilt series -v + patches/patch1 + patches/patch2 = patches/patch3 This output shows that all three patches are applied, and that the current one is patch3. If a new kernel version is released, and you wish to port your changes to the new version, quilt can handle this easily with the following steps:
quilt also has options that will automatically email out all of the patches in the series to a group of people or a mailing list, delete specific patches in the middle of the series, go up or down the series of patches until a specific patch is found, and many more powerful options. If you want to do any kind of kernel development, quilt is strongly recommended, even for tracking a few patches, instead of using the more difficult diff and patch method. It is much simpler and will save you much time and effort. On a personal note, I cannot recommend this tool enough, as I use it everyday to manage hundreds of patches in different development trees. It is also used by numerous Linux distributions to maintain their kernel packages and has an involved and responsive development community. |