Centos5.6-xen4.0.3内核编译
2011-08-15 13:04
405 查看
编译过程
安装编译过程所需库和工具
yum -y groupinstall "Development Libraries"yum -y groupinstall "Development Tools"
yum -y install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial glibc-devel
安装rpmforge库
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpmrpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm
rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm
yum check-update
安装mercurial和git
yum -y install mercurial git
编译xen
hg clone http://xenbits.xen.org/xen-4.0-testing.hgcd xen-4.0-testing.hg
make -j16 xen
make -j16 tools
make -j16 stubdom
编译pvops内核
make kernelsmake kernels时通常用的是自带的配置文件,少东西,我用官网给的2.6.32.43的配置文件重新编译:
make clean
cp -a .config .config-old wget -O .config http://pasik.reaktio.net/xen/kernel-config/config-2.6.32.43-pvops-dom0-xen-stable-x86_64
make oldconfig
make menuconfig
要修改一些内核配置,保证如下配置:
CONFIG_ATA=m
CONFIG_ATA_PIIX=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_OHCI_HCD=m
CONFIG_XEN_NETDEV_BACKEND=m
CONFIG_XEN_BLKDEV_BACKEND=m
CONFIG_XEN_BLKBACK_PAGEMAG=m
CONFIG_SYSFS_DEPRECATED_V2=m
CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
在menuconfig里把xen桥接选项改为*
重新编译:
make kernels
make -j16 dist
安装xen和新内核
make install-xenmake install-tools PYTHON_PREFIX_ARG=
cd build-*
make modules_install
make install
创建initrd.img文件
depmod 2.6.32.44mkinitrd -v -f /boot/initrd-2.6.32.44.img 2.6.32.44
修改grub
在新内核标题下修改: 形式如下:root (hd0,0) kernel /xen-4.0.gz module /vmlinuz-2.6.32.44 root=/dev/cciss/c0d0p1 ro module /initrd-2.6.32.44.img
别忘了修改默认启动项!
修改/etc/modprobe.conf
添加如下: install xen /sbin/modprobe xen-evtchn; /sbin/modprobe xen-netback; /sbin/modprobe xenfs; /sbin/modprobe xen-blkback; /bin/true
修改/etc/fstab
添加如下: none /proc/xen xenfs defaults 0 0
修改/etc/xen/xend-config.sxp
(xend-http-server yes)(xend-unix-server yes)
(xend-port 8000)
(xend-relocation-port 8002)
reboot
在启动xend服务之前手动加载 modprobe -l | grep xen 所列出模块。
使用vhd
在该版本xen中,要打两个补丁:diff -r a672af698bc3 tools/python/xen/util/blkif.py
--- a/tools/python/xen/util/blkif.py Fri Jul 09 12:35:58 2010 +0100
+++ b/tools/python/xen/util/blkif.py Sun Jul 11 12:13:34 2010 +0400
@@ -87,7 +87,10 @@
fn = "/dev/%s" %(fn,)
if typ in ("tap", "tap2"):
- (taptype, fn) = fn.split(":", 1)
+ if fn.count(":") == 1:
+ (taptype, fn) = fn.split(":", 1)
+ else:
+ (taptype, fn) = fn.split(":", 2)[1:3]
return (fn, taptype)
def blkdev_uname_to_file(uname):
diff -r 2c3495f3ca84 tools/python/xen/xend/XendBootloader.py --- a/tools/python/xen/xend/XendBootloader.py Fri Jun 04 10:50:55 2010 +0100 +++ b/tools/python/xen/xend/XendBootloader.py Sun Jun 06 23:48:50 2010 +0400 @@ -38,10 +38,15 @@ msg = "Bootloader isn't executable" log.error(msg) raise VmError(msg) - if not os.access(disk, os.R_OK): - msg = "Disk isn't accessible" - log.error(msg) - raise VmError(msg) + attempt = 0 + while True: + if not os.access(disk, os.R_OK) and attempt > 3: + msg = "Disk isn't accessible" + log.error(msg) + raise VmError(msg) + else: + break + attempt = attempt + 1 if os.uname()[0] == "NetBSD" and disk.startswith('/dev/'): disk = disk.replace("/dev/", "/dev/r")
之后,重新编译tools:
make tools
make install-tools PYTHON_PREFIX_ARG=
reboot
相关命令如下:
例:
创建:vhd-util create -n MyVHDFile -s 1024
快照:vhd-util snapshot -n MyVHDFile -p SomeRawFile -m ㎎为父映像。
在配置文件中:
disk = ['tap2:tapdisk:vhd:<VHD FILENAME>,xvda,w']
相关文章推荐
- centos+6.0源码安装xen4.1.1(xen成功安装,但是在重新编译内核时有点小问题)
- CentOS 5.6下将linux内核2.6.18升级到2.6.30,并编译动态加载linux下第一个模块
- centos7 源码编译php5.6和Apache2
- yum和编译两种方式升级or降级Centos内核 推荐
- CentOS 6.5源码编译安装MySQL 5.6
- CentOS 5.6(X64)下编译安装LNMP平台(Nginx1.0.4+PHP5.3.6+Mysql5.5.12)
- centos6.0编译安装xen-4.1+linux3.0
- CentOS RHEL 5.3 编译内核
- Centos5.6_X64使用yum快速搭建xen虚拟化环境
- android 4.0.3内核及SDK编译
- 基于CentOS的linux 2.6.20 内核编译
- centos内核编译选项参考
- VM安装CenOS5.6,CentOS安装xen,并用xen半虚拟化安装CentOS,(FTP方式)
- CentOs 6.5 上源码编译安装PHP5.6
- centos 6.5内核编译步骤及配置详解
- CentOS 6.4 编译安装 MySQL-5.6
- CentOS 6.9编译安装新版本内核
- centos6.6下编译安装mysql5.6之后启动失败:Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
- 高可用架构篇 MySQL源码编译安装(CentOS-6.6+MySQL-5.6)