xen3.4.3源码编译
1. Xen Hypervisior安装
安装必备软件包
# yum groupinstall "Development Tools"
# yum install hmaccalc ncurses-devel zlib-devel openssl-devel python-devel \
bridge-utils libtool-ltdl iasl xorg-x11-drv-evdev xorg-x11-drv-fbdev \
xorg-x11-drv-i810-devel xorg-x11-drv-via-devel xorg-x11-proto-devel \
xorg-x11-server-sdk xorg-x11-xtrans-devel
下载xen源码:
tar zxvf xen-3.4.3.tar.gz
cd xen-3.4.3
使用make world可以一次性安装,但是脚本会自动下载一个Kernel,过程比较慢,执行下面的命令可以加快编译速度:
make xen
make tools
make stubdom
make install-xen
make install-tools
make install-stubdom
为了简单,直接执行:
make world
编译完成后,执行:make install,这样就完成了Xen Hypervisior安装。
编译完成后,发现/boot目录下多了下面的文件
vmlinuz-2.6.18.8-xen
xen-3.4.3.gz
config-2.6.18.8-xen
xen-3.4.gz
xen-3.gz
xen.gz
System.map-2.6.18.8-xen
2. 发现没有自动创建inird文件,手动创建
cd linux-2.6.18-xen.hg/
mkinitrd initrd-2.6.18.8-xen.img .
cp initrd-2.6.18.8-xen.img /boot/
grub配置:
title CentOS (2.6.18.8-xen-mybuild)
root (hd0,0)
kernel /boot/xen-3.4.3.gz
module /boot/vmlinuz-2.6.18.8-xen ro root=LABEL=/ rhgb quiet
module /boot/initrd-2.6.18.8-xen.img
xen-3.4.3.gz
config-2.6.18.8-xen
xen-3.4.gz
xen-3.gz
xen.gz
System.map-2.6.18.8-xen
2. 发现没有自动创建inird文件,手动创建
cd linux-2.6.18-xen.hg/
mkinitrd initrd-2.6.18.8-xen.img .
cp initrd-2.6.18.8-xen.img /boot/
grub配置:
title CentOS (2.6.18.8-xen-mybuild)
root (hd0,0)
kernel /boot/xen-3.4.3.gz
module /boot/vmlinuz-2.6.18.8-xen ro root=LABEL=/ rhgb quiet
module /boot/initrd-2.6.18.8-xen.img
3. 启动虚机,发现模块错误,无法启动,需要重新编译内核
cd xen-3.4.3/linux-2.6.18-xen.hg/
$ make menuconfig
Processor type and features --->
[*] Enable Xen compatible kernel
Networking support --->
Networking options --->
<*> 802.1d Ethernet Bridging
Device Drivers --->
XEN --->
[*] Privileged Guest (domain 0)
Backend driver support
Block-device backend driver
Block-device tap backend driver
Block-device tap backend driver 2
Network-device backend driver
PCI-device backend driver
SCSI backend driver
USB backend driver
<*> Block-device frontend driver
<*> Network-device frontend driver
SCSI frontend driver
USB frontend driver
<*> Framebuffer-device frontend driver
<*> Keyboard-device frontend driver
[*] Disable serial port drivers
<*> Export Xen attributes in sysfs
Xen version compatibility (3.3.0 and later) --->
3.3.0 and later
Processor type and features --->
[*] Enable Xen compatible kernel
Networking support --->
Networking options --->
<*> 802.1d Ethernet Bridging
Device Drivers --->
XEN --->
[*] Privileged Guest (domain 0)
Backend driver support
Block-device backend driver
Block-device tap backend driver
Block-device tap backend driver 2
Network-device backend driver
PCI-device backend driver
SCSI backend driver
USB backend driver
<*> Block-device frontend driver
<*> Network-device frontend driver
SCSI frontend driver
USB frontend driver
<*> Framebuffer-device frontend driver
<*> Keyboard-device frontend driver
[*] Disable serial port drivers
<*> Export Xen attributes in sysfs
Xen version compatibility (3.3.0 and later) --->
3.3.0 and later
$ make
$ make modules
# make modules_install
# make install
# depmod 2.6.18.8-xen
$ make modules
# make modules_install
# make install
# depmod 2.6.18.8-xen
# cd /boot
# mkinitrd -v -f --with=sd_mod --with=scsi_mod initrd-2.6.18.8-xen.img 2.6.18.8-xen
grub配置:
title CentOS (2.6.18.8-xen-mybuild)
root (hd0,0)
kernel /boot/xen-3.4.3.gz
module /boot/vmlinuz-2.6.18.8-xen ro root=LABEL=/ rhgb quiet
module /boot/initrd-2.6.18.8-xen.img
title CentOS (2.6.18.8-xen-mybuild)
root (hd0,0)
kernel /boot/xen-3.4.3.gz
module /boot/vmlinuz-2.6.18.8-xen ro root=LABEL=/ rhgb quiet
module /boot/initrd-2.6.18.8-xen.img
启动成功
通过yum安装xen3.4.3
yum install xen kernel-xen即可。
安装后的grub:
title CentOS (2.6.18-274.7.1.el5xen)
root (hd0,0)
kernel /boot/xen.gz-3.4.3
module /boot/vmlinuz-2.6.18-274.7.1.el5xen ro root=LABEL=/ rhgb quiet
module /boot/initrd-2.6.18-274.7.1.el5xen.img
root (hd0,0)
kernel /boot/xen.gz-3.4.3
module /boot/vmlinuz-2.6.18-274.7.1.el5xen ro root=LABEL=/ rhgb quiet
module /boot/initrd-2.6.18-274.7.1.el5xen.img
本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2012/01/18/2325952.html,如需转载请自行联系原作者