RHEL5 Kernel HOWTO
This HOWTO will show you how to get a RHEL5-based openvz-sources kernel running on a Funtoo Linux system. Several steps are required including downgrading sys-fs/udev, emerging gcc-4.1.2 (which is required for building RHEL5 sources), and building and configuring the kernel. These steps are appropriate for getting any RHEL5-based 2.6.18 kernels built and running under Funtoo, not just openvz-sources.
Steps
1. Downgrade udev to a version compatible with kernels previous than 2.6.27:
echo ">=sys-fs/udev-147" >> /etc/portage/package.mask emerge -u udev
2. This will also require a downgrade of lvm2, if you are using it. Version 2.02.68 is a good one to use:
echo ">=sys-fs/lvm2-2.02.69 >> /etc/portage/package.mask emerge -u lvm2
3. Mask any openvz-sources version equal or newer than 2.6.27:
echo ">=sys-kernel/openvz-sources-2.6.27" >> /etc/portage/package.mask
4. openvz-sources-2.6.18* needs gcc-4.1*, so you must install it prior build your future downgraded kernel. If you have newer versions than gcc-4.1* then you must install this one. Also check your CFLAGS if you are using gcc-4.3* or later *AND* your make.conf CFLAGS has -march=native, due previous GCC versions doesn't allow it. Check [1] and put a correct -march directive in your CFLAGS. You also need to change CXXFLAGS in the same way, ie:
CFLAGS="-march=amd64" CXXFLAGS="-march=amd64" emerge =sys-devel/gcc-4.1.2
That may take a while, take a cup of your favourite beverage and wait until it is finished.
5. Switch to gcc-4.1* on your system:
localhost ~ # gcc-config -l [1] x86_64-pc-linux-gnu-4.1.2 [2] x86_64-pc-linux-gnu-4.4.3 * localhost ~ # gcc-config 1 * Switching native-compiler to x86_64-pc-linux-gnu-4.1.2... >>> Regenerating /etc/ld.so.cache... [ok] * If you intend to use the gcc from the new profile in an already * running shell, please remember to do: * # source /etc/profile localhost ~ # source /etc/profile localhost ~ # gcc --version gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.3) gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.3) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. localhost ~ #
6. Rebuild your sources:
cd /usr/src/linux make menuconfig [do your work] make cp arch/x86/boot/bzImage /boot/linux-2.6.18-openvz-028.068.9
7. Update /etc/boot.conf to point to your new kernel, ie:
vi /etc/boot.conf
[inside /etc/boot.conf now]
"Funtoo Linux" {
kernel linux-2.6.18-openvz-028.068.9
params root=/dev/sda3
}
8. Update grub's configuration file
boot-update
9. Reboot your computer and enjoy
reboot