[CentOS-docs] Notes on HowTos/Custom Kernel

Tue Sep 30 15:16:17 UTC 2008
Filipe Brandenburger <filbranden at gmail.com>


Today I built a custom kernel in CentOS 5 following the instructions
on this page:

It's excellent, but I have some remarks I would add:

1. %define buildid .your_identifier

In the commented line, there is a space after the % sign. You have to
manually remove this space. I think someone was bit by this a short
while ago. I think making this explicit on the Wiki would help, since
it's not something obvious that is trivial to see and it leads to
problems long after that.

2. Section "Configuring your kernel"

You actually only have to do the instructions in that section if you
want to reconfigure the kernel, but it's not explicitly said so
anywhere. For instance, in my case, I only wanted to add a new patch,
so I could use the default configuration (at least I believe I could),
so there was no need to copy the configurations there, then running
make menuconfig, then copying the configurations back, etc. I think
this could be made explicit too.

3. How to build based on the CentOS Plus kernel?

In my case, I actually wanted to build a custom kernel based on the
CentOS Plus kernel, because I wanted XFS support. I just wanted to
apply a small patch that adds hardware support for a specific adapter.
I could follow the instructions to create a kernel based on the CentOS
Plus sources, but many parts of it were not in the CentOS Plus
specfile. For example, "with_debug" is already set to 0. The block
that starts with "#if a rhel kernel, apply the rhel config options" is
not present either, I believe it was already stripped when the CentOS
Plus kernel was initially built. I also used Patch400000:, since the
latest patch in the CentOS Plus kernel is Patch99999:, so to be safe I
included it later.

4. echo "%_topdir %(echo $HOME)/rpmbuild" > .rpmmacros in "I need the
Kernel Source"

This is a really small one, but the command above will expand $HOME
when you actually run the "echo", I believe what you wanted was the
command with single quotes, since that will expand the echo every time
the "rpm" command is run. Otherwise, if you wanted to put the actual
home directory there, you could have just used echo "%_topdir
$HOME/rpmbuild" since that would have the same effect without using a
shell escape from RPM.

Well, as I said, the document is excellent in itself, these are very
minor items that I believe could be improved.

I volunteer to change the documents to reflect these, in that case, I
only need write permission to the Wiki pages. My wiki username is