哥使用Linux
分类: LINUX
2007-12-09 19:57:45
Creation of a Redhat RHEL Kernel 2.6.9-11 for Debian 3.1r0a Sarge
Did you ever want to have a Redhat kernel and drivers installed upon a Debian system? Here is how you can manage that easily.
Login as User "root" and run "cat /proc/version" - this will show the Kernel version you are running. This is the Debian kernel which will be replaced by a debianized Redhat kernel.
If you wish you can backup your current kernel to Floppy: I never did that :-) "mkboot /boot/vmlinuz-2.6.8" (substitute your kernel version).
To get started you'll need to install some packages:
apt-get install bzip2 docbook-utils gs kernel-package \ transfig fakeroot rpm libncurses5-dev
Now download the package kern2deb - currently you can find this here:
Install the package with :
dpkg -i kern2deb_1.2_all.deb
(There is an "intent to package" bug already filed on the Debian bug tracking system - - however the package is not yet included within Debian's archive.)
Now that you have th software you can start work on Debianizing your Redhat kernel.
Copy the Kernel sources from Redhat to the directory /usr/src, eg:
kernel-2.6.9-11.EL.src.rpm
(e.g. from ftp://ftp.redhat.com/pub/redhat/linux/updates/enterprise/4ES/en/os/SRPMS/)
Convert the kernel sources to Debian layout:
kern2deb -k -m a.aaaa@mymail.com -r no kernel-2.6.9-11.EL.src.rpm
This conversion takes some time. The mesage "No Packages found...." can be ignored since there is simply no corresponding Debian kernel-source Package (yet) available from Debian.org.
Copy a working configuration file from somewhere within the new tree:
cd kernel-source-2.6.9.redhat-2.6.9.redhat.11.el cp ../kernel-2.6.9-11.EL.dir/kernel-2.6.9-i686-smp.config .config
(The kernel configuration files for any installed Debian kernels will be available as /boot/config-*)
Now you can run "make oldconfig", or "make menuconfig" to configure the kernel.
Configure mkinitrd to only include needed modules (otherwise initrd.img gets too big and kernel will not start...I think because of a GRUB limitation or so...!)
edit /etc/mkinitrd/mkinitrd.conf and set MODULES=dep!
To build your configured kernel run "make-kpkg clean" and "make-kpkg -append-to-version=-rh11-0001-i686-smp -initrd buildpackage".
Answer "N" to the mkinitrd question regarding the needed patch.
"cd .." and "ls -la kernel*rh11*" should now show your Debianized RedHat kernel.
The kernel can be installed with:
dpkg -i kernel-image-2.6.9-rh11-0001-i686_i386.deb
(Change the name if you appended a different string to your package)
Boot your new kernel...good luck !
After a successful reboot and login a "cat /proc/version" should show your new kernel running.
I hope this helps somebody.
Alfred Madl
原文出自:
由于原文的作者的标题比较长,blog的标题长度受限制,所以我修改了下。这帖子我看了下,觉得不错,因为我的情况就是这样,既有RHEL的,也用Debian的服务器,如果把内核都能统一起来,那是相当不错的方法,先转贴留念,谢谢原作者!!!