[kwlug-disc] One distro, another kernel?

Chris Frey cdfrey at foursquare.net
Mon Apr 12 12:55:03 EDT 2010

On Mon, Apr 12, 2010 at 12:17:12PM -0400, Richard Weait wrote:
> How wrong is this?
> Could one, for example, run Ubuntu on a Centos kernel?
> If one installed Ubuntu with an Ubuntu kernel, then decided to test
> operating Ubuntu from a Centos kernel, how would one install it.  What
> would one expect to break?  If it worked, how would one expect to
> maintain it?

I usually like the birds-eye view to start with, so here are my thoughts.

There are 3 things to tackle:

	- the kernel config
	- the distro-specific patches
	- the system dependencies

The kernel config seems easy, but it may be harder to extract than you
may expect.  Since distros often build many kernels for many systems from
one source tree, they have abstracted the config process so that platform
specific parts are often squirrelled away in interesting places.

Just capturing the .config file for the kernel you want might be an
interesting challenge.

The distro-specific patches are also applied differently per distro.
I forget exactly how it's done, but I think Debian style uses a patch
management system, while RPM applies the patches through its own
mechanism.  Again, there may be some reverse engineering to do.

And the system dependencies are things like your initrd settings matching.
Probably not as big an issue.

So, considering all that, I suspect the easiest way to run a Ubuntu
kernel on Centos, would be to look for the command to *prepare* the
Ubuntu kernel tree, for *only* the platform you need, but not build it.
This should apply all the patches and create the .config for you.
Then take a snapshot of that, and store it in your favourite git repo. :-)
Then move it over to Centos and build, perhaps with a skeleton spec file
that does no patching of its own.

Each time a new kernel comes out, do the same process.  You'll probably need
a small chroot Ubuntu system on your Centos box, so you have the tools
to do a preliminary build.

I'm sure there are git repos of Ubuntu kernels and Centos kernels, but
these would likely be in pre-configured form.  The config is important,
and often needs distro tools to extract.  I once tracked down odd USB
behaviour this way, and the config was why I could not reproduce it on
my system.

Good luck, and hopefully there are cleaner suggestions coming! :-)

- Chris

More information about the kwlug-disc mailing list