CML2: A New, Easier Kernel Configuration System

by Eric S. Raymond

A new approach to Linux kernel configuration is in beta test now. I have written a replacement configuration system called CML2 that is smaller, simpler and more powerful than the existing tools, which people have started calling CML1. CML2 can use logical rules about relationships between features to make the user's configuration task easier by showing only the questions he or she actually needs to answer.

Like the existing CML1 system, the rules CML2 knows and the questions it asks are not wired into the configurator itself, but rather are separated out into declaration files written in a special-purpose language that human beings can read and edit. But where CML1's language grew by accretion over time and has become an ugly, lumpish thing that not even its maintainers love, CML2 has been freshly designed with all of CML1's history to learn from.

Sometimes one feature requires another; for example, parallel printer support requires parallel port support. In CML1, this meant the question for the second (ancestor) feature had to come before the first (dependent) feature. But in CML2, features can be chosen in either order; CML2 uses its dependency rules to automatically deduce when ancestor features should be set.

In fact, CML2 is built around a constraint language and has a theorem prover embedded in it; it resembles the kind of AI program called an “expert system”, and can do many kinds of deduction that make the configuration task easier. Ultimately, I aim to make the kernel configuration rulebase rich enough so that even Linux newbies can build kernels without fuss.

Remarkably, all this capability fits in less than 6,000 lines of code. Rather than being written in CML1's unwieldy mix of C, shell, Tcl/Tk and Perl, CML2 is written entirely in Python. I credit this choice with enabling me to go from concept to a production-ready system in just four months of part-time work, much of it done on airplanes and in hotel rooms during my heavy schedule of traveling to spread the word about Open Source.

The CML2 project has been blessed by the maintainers of CML1, who have long realized the older project had lived past its time. It has not yet been accepted into the Linux kernel tree, but many kernel developers are helping with the beta test and the chances of adoption sometime in the 2.5.x series look good.

Ultimately, I have visions of applying CML2 to other problems—hardware configuration, say, or intelligent builds of Linux distributions. You can find out more about CML2 on the Project Page, http://www.catb.org/~esr/kbuild/.