Quilt is a great tool to maintain patchsets.

For those new to quilt, let me brief you on how it works.

If you take something like the kernel sources, you would eventually need to apply patches to give it functionality that has not made it to the official tree. Examples like suspend2, xen, bootsplash, drivers and all that other kernel goodness floating around. Sometimes different patchsets need to be applied and different branches of the source tree will need to be maintained. When applying patches manually, no record of the patches is kept (apart from the actual changes themselves) so its difficult to say which patches have been applied. Reverting patches can be tricky if they’re order dependent.

Here’s how you would use quilt to simplify this madness.

Simply make a patches/ directory inside your kernel source tree, and dump all your patches in it. Create a patches/series file and list all your patches in the order that it should be applied. Once you’re done, back from the root of the kernel source tree, type ‘quilt push -a‘. If everything applies cleanly you’re good to go. To see which patches have been applied ‘quilt applied‘. To revert the last patch, ‘quilt pop‘. To revert everything ‘quilt pop -a‘. It’s really that simple. Quilt takes a stack oriented approach to patching which is extremely intuitive.

The patches can be kept elsewhere and symlinked from within the patches folder. That way you can maintain multiple kernel trees with different patchsets and a common repository with all your patches for easy maintenance.

Oh and updating a patch is a simple ‘quilt refresh‘.

Happy patchin’.

Messing with the Colonel

I’ve been reading Linux Kernel Development by Robert Love recently, and it’s exactly the book I’ve always been looking for. A number of kernel books have spent a long time in my wait queue gathering dust and becoming obsolete with every passing day. I’ve gazed longingly at the venerable Lion’s Book on many many occasions only to push it back in the queue because I felt I needed to finish another book first before I could move on to it.

I put an end to all the procrastination and dived into RML’s book and it was glorious. Seriously folks, five stars. It dives straight into the key aspects of the kernel with code commentary and examples. It doesn’t attempt to present all the details of the various interfaces and subsystems that it covers and leaves that as an excercise to the reader. Armed with something like LXR, this has never been easier.

Also, for those aspiring to mess around with the internals while at it, do check out UML (User Mode Linux) which is already in mainline 2.6 and excellent for creating sandboxes to play with.