一.Xen & Dom0 kernel 配置
1. 下载xen:
>hg clone http://xenbits.xensource.com/xen-unstable.hg xen-unstable
2. 选择某个changeset
>cd xen-unstable
>hg co 23000
3. 下载dom0 kernel
>git clone git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.gitlinux-2.6-pvops.git
4. 配置xen和dom0 kernel
>make linux-2.6-pvops-config 将产生build-linux-2.6-pvops_x86_64目录
5. 编译前的准备
diff -rd428fa67abaa tools/Makefile ---a/tools/Makefile Wed Mar 09 16:17:26 2011+0000 +++b/tools/Makefile Wed Oct 26 15:02:512011 +0800 @@ -90,9+90,6 @@ mkdir-p ioemu-dir; \ else\ if[ ! -d ioemu-remote ]; then \ - rm -rf ioemu-remoteioemu-remote.tmp; \ - mkdirioemu-remote.tmp; rmdir ioemu-remote.tmp; \ - $(GIT) clone$(CONFIG_QEMU) ioemu-remote.tmp; \ if[ "$(QEMU_TAG)" ]; then \ cdioemu-remote.tmp; \ $(GIT)branch -D dummy >/dev/null 2>&1 ||:; \ @@ -101,8+98,6 @@ fi; \ mvioemu-remote.tmp ioemu-remote; \ fi;\ - rm -f ioemu-dir; \ - ln -sf ioemu-remote ioemu-dir;\ fi set-e; \ $(absolutify_xen_root);\
>cd tools
>git clone http://xenbits.xensource.com/git-http/qemu-xen-unstable.git ioemu-remote
>ln –sf ioemu-remote ioemu-dir
>wget –c http://www.acpica.org/download/acpica-unix-20100121.tar.gz
>tar xvf acpica-unix-20100121.tar.gz
>cd acpica-unix-20100121
>cd compiler
>make
>cp iasl /usr/bin
6. 编译
>make xen –j10
KERNELS ?= linux-2.6-pvops
>make kernels –j10
>make tools –j10
7. 安装
>cd tools
>make install
>mkinitrd –v –f –with=ahci–with=aacraid –with=sd_mod –with=scsi_mod /boot/initrd-2.6.32.41.img 2.6.32.41
8. 配置GRUB
Titile XEN 4.1 root(hd0,0) kernel/boot/xen-4.1.0-rc7-pre.gz module/boot/vmlinuz-2.6.32.41 ro root=/dev/sda1 biosdevname=0 module/boot/initrd-2.6..32.41.img
二. PV Guest 配置
1. 下载domU kernel
>cd xen-unstable
> hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg linux-2.6.18-xen.hg
2. 配置kernel
>make linux-2.6-xenU-config
3. 编译domU kernel
KERNELS ?= linux-2.6-xenU
>make kernels –j10
>mkinitrd –v –f –with=ahci –with=aacraid–with=sd_mod –with=scsi_mod dist/install/boot/initrd-2.6.18.8-xenU.img 2.6.18.8-xenU
4. 安装HVM Guest
5. 安装PV Guest
>mount –t ext3 –o loop,offset=32256~/centos.img /mnt
>cpdist/install/boot/vmlinuz-2.6.18-xenU /mnt/boot
>cp dist/install/boot/System.map-2.6.18.8-xenU/mnt/boot
>cpdist/install/boot/initrd-2.6.18.8-xenU.img /mnt/boot
>cp /lib/modules/2.6.18.8-xenU/mnt/lib/modules/ -r
6. 修改Guest的grub
>vim /mnt/boot/grub/grub.conf
Title pv-kernel (2.6.18-xen) Root(hd0,0) Kernel/boot/vmlinuz-2.6.18.8-xenU console=xvc0 root=/dev/hda1 ro Initrd/boot/initrd-2.6.18.8-xenU.img
7. 配置console
#Run gettys in standard runlevels Co:2345:respawn:/sbin/agetty xvc0 9600vt100-nav
“xvc0”
补充:
7:2345:respawn:/sbin/mingetty hvc0
“hvc0”
>cd /mnt/dev
>mknod –m 660 console c 5 1
>mknod –m 660 null c 1 3
8. 写配置文件
>vim /etc/xen/mypv.conf
Bootloader = “/usr/bin/pygrub” Memory = 256 Name = “PV” Vcpus =1 Vif = [ ‘mac=00:16:3e:00:00:11, bridge=eth1’] //具体看xend建立的网桥名称 Disk = [ ‘file:/root/yewei/centos.img,had,w’]
9. 启动PV guest
>xm create /etc/xen/mypv.conf –c