Configuring Kernels

The first thing is to find the source code. This is easy, look in /usr/src/linux. On my systems this is a link to /usr/src/linux-2.2.14 or something like that. I find a link like this a good way to deal with new source RPMS, just be sure to remove the link when you deposit the new source tree, and then set it up again later.

If you have a brand new source tree, you may want to do this:

	cd /usr/src/linux
	make mrproper
Be warned that this is quite drastic. The intent is to remove any object files or evidence of prior ownership and get this ready to go out the door. I have found that if I have built a non-smp kernel, and then want to build an smp kernel, I need to start clean in this way.

If you kave previously done a "make config" you will loose your precious .config file and so you would be wise to stash it away somewhere first. Something like:

	mv .config ZZZ
	make mrproper
	mv ZZZ .config

The next thing is to configure your kernel. You have your choice of the following:

	make config
	make xconfig
	...
One caveat at this point, as the final message says when you exit make xconfig (I clearly prefer xconfig to config), take a look at the top level Makefile. I never bothered to do this until I began building smp kernels that wanted to use modules shipped by Red Hat. In particular consider changing:
EXTRAVERSION = -3
to
EXTRAVERSION = -3smp
This will (I think) cause your kernel to go and find the proper set of modules. This doesn't seem to get set automagically.

At this juncture, I should recommend that you look at the file /usr/src/linux/README which does a very nice job covering all of this. What I am doing is augmenting (and replicating) that file to cover gaps in my understanding and knowledge. And while I am digressing, may I mention that I long for (I pine for) the days of BSD unix where I could configure a kernel by using my beloved and most favorite editor, modifying one line in an ascii file and then two commands later have a kernel to boot ...

Now, let us suppose you have waded through several hundred questions about hardware you have never even heard of (and in my case you have heard of a lot of hardware!!). You say to yourself, there must be a better way!! It seems that there is, here is what I find seems to work. On the Red Hat systems I have at least, there is a directory /usr/src/linux/configs that holds various config files. You can pick one of these and copy it to /usr/src/linux/.config. If you then do a make dep; make bzImage, bad things happen. What you must do next is to do a make xconfig and then just hit the button "save and exit". Then do the make dep; make bzImage. It is not clear what you have to do if you take an editor and fiddle with this config file (it is pretty obvious how to fiddle). Stay tuned, more on this will be forthcoming.

If you are the curious sort, there is a lot to be learned (or admired, or feared) if you just look around under /usr/src/linux. The way the Makefiles are arranged. The terrifying things that go on in the maze of include files. Amazing gcc inline assembly and some really dazzling C preprocessor macros. Worth a look at least.