Posted in
Linux Server,
Virtual Machine Manager |
1 Comment | 10,651 views | 10/01/2011 11:48
Actually you can use Centos with Hyper-V Linux Integration Components. But if you upgrade your kernel, you should re-apply LIC again. So you can try applying new kernel with pre-compiled Hyper-V drivers. But as you know, if you apply custom kernels on Centos, your Centos will be no longer supported. So apply this with your own risk.
1
2
3
4
5
6
7
8
9
10
11
| yum update
yum upgrade kernel
yum install rpm-build redhat-rpm-config ncurses-devel unifdef
cd /home
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.tar.bz2
tar xjf linux-2.6.37.tar.bz2
ln -s linux-2.6.37 linux
cd /home/linux
make clean && make mrproper
cp /boot/config-`uname -r` ./.config
make menuconfig |
yum update
yum upgrade kernel
yum install rpm-build redhat-rpm-config ncurses-devel unifdef
cd /home
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.tar.bz2
tar xjf linux-2.6.37.tar.bz2
ln -s linux-2.6.37 linux
cd /home/linux
make clean && make mrproper
cp /boot/config-`uname -r` ./.config
make menuconfig
In the menuconfig, you should be careful about 3 things. If not, your new kernel may give kernel panic.
1) First, always enable this feature to eliminate boot failures.
General Setup -> Enable deprecated sysfs features to support old userspace too
2) Disable paravirtualized guest support to build rpm.
Processor type and features -> Paravirtualized guest support
3) Disable Virtualization feature.
Virtualization
Also you can append a version for Hyper-V.
General setup -> Local Version – append to kernel release
You can exit from menuconfig by saving the config. After that do:
nano /home/linux/scripts/package/mkspec |
nano /home/linux/scripts/package/mkspec
And append the following lines:
1
2
3
4
5
6
7
8
9
10
11
12
| echo "%post"
echo "if [ \`uname -i\` == \"x86_64\" -o \`uname -i\` == \"i386\" ]; then"
echo " if [ -f /etc/sysconfig/kernel ]; then"
echo " /bin/sed -i -e 's/^DEFAULTKERNEL=kernel-smp$/DEFAULTKERNEL=kernel/' /etc/sysconfig/kernel || exit \$?"
echo " fi"
echo "fi"
echo "/sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install "$KERNELRELEASE" || exit \$?"
echo ""
echo "%preun"
echo "/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove "$KERNELRELEASE" || exit \$?"
echo "" |
echo "%post"
echo "if [ \`uname -i\` == \"x86_64\" -o \`uname -i\` == \"i386\" ]; then"
echo " if [ -f /etc/sysconfig/kernel ]; then"
echo " /bin/sed -i -e 's/^DEFAULTKERNEL=kernel-smp$/DEFAULTKERNEL=kernel/' /etc/sysconfig/kernel || exit \$?"
echo " fi"
echo "fi"
echo "/sbin/new-kernel-pkg --package kernel --mkinitrd --depmod --install "$KERNELRELEASE" || exit \$?"
echo ""
echo "%preun"
echo "/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove "$KERNELRELEASE" || exit \$?"
echo ""
After the changes, you can go with making RPM:
1
2
| cd /home/linux
make CONFIG_DEBUG_SECTION_MISMATCH=y binrpm-pkg 2> make-err.log | tee make-out.log |
cd /home/linux
make CONFIG_DEBUG_SECTION_MISMATCH=y binrpm-pkg 2> make-err.log | tee make-out.log
You can find your RPMs in /usr/src/redhat directory.