我已经使用以下步骤成功编译了 XEN:
wget http://bits.xensource.com/oss-xen/release/4.4.1/xen-4.4.1.tar.gz
tar xzvf xen-4.4.1.tar.gz
cd ./xen-4.4.1
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
./configure
make -j4 dist-xen
make -j4 dist-tools
sudo su
make -j4 install-xen
make -j4 install-tools
echo "GRUB_CMDLINE_XEN_DEFAULT=\"dom0_mem=4096M,max:4096M dom0_max_vcpus=2 dom0_vcpus_pin=true\"" >> /etc/default/grub
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> ~/.bashrc
update-grub
echo "none /proc/xen xenfs defaults,nofail 0 0" >> /etc/fstab
echo "xen-evtchn" >> /etc/modules
echo "xen-privcmd" >> /etc/modules
update-rc.d xencommons defaults 19 18
update-rc.d xendomains defaults 21 20
update-rc.d xen-watchdog defaults 22 23
reboot
现在我的/boot
目录如下所示:
root@Debian-78-wheezy-64-minimal ~/workplace/backup_xen_boot # ls -la /boot/
total 37M
drwxr-xr-x 4 root root 4.0K Apr 22 14:27 .
drwxr-xr-x 24 root root 4.0K Apr 22 12:47 ..
-rw-r--r-- 1 root root 154K Apr 8 19:23 config-3.16.0-0.bpo.4-amd64
-rw-r--r-- 1 root root 127K Feb 22 06:16 config-3.2.0-4-amd64
drwxr-xr-x 4 root root 12K Apr 22 15:07 grub
-rw-r--r-- 1 root root 15M Apr 22 12:47 initrd.img-3.16.0-0.bpo.4-amd64
-rw-r--r-- 1 root root 11M Apr 22 12:38 initrd.img-3.2.0-4-amd64
drwx------ 2 root root 16K Apr 22 11:40 lost+found
-rw-r--r-- 1 root root 2.6M Apr 8 19:23 System.map-3.16.0-0.bpo.4-amd64
-rw-r--r-- 1 root root 2.1M Feb 22 06:16 System.map-3.2.0-4-amd64
-rw-r--r-- 1 root root 3.0M Apr 8 19:16 vmlinuz-3.16.0-0.bpo.4-amd64
-rw-r--r-- 1 root root 2.8M Feb 22 06:05 vmlinuz-3.2.0-4-amd64
-rw-r--r-- 1 root root 831K Apr 22 12:14 xen-4.4.1.gz
lrwxrwxrwx 1 root root 12 Apr 22 12:14 xen-4.4.gz -> xen-4.4.1.gz
lrwxrwxrwx 1 root root 12 Apr 22 12:14 xen-4.gz -> xen-4.4.1.gz
我不得不删除:xen.gz
这是指向的符号链接xen-4.4.1.gz
,也是xen-syms-4.4.1
(我认为这是调试符号,如果不是,请纠正我)由于我尝试时收到的警告update-grub
我的 grub2 配置如下:
root@Debian-78-wheezy-64-minimal ~/workplace/backup_xen_boot # grep "^menuentry" /boot/grub/grub.cfg | cut -d "'" -f2 | cat -n | awk '{$1=$1-1; print $0}'
0 Debian GNU/Linux, with Linux 3.16.0-0.bpo.4-amd64
1 Debian GNU/Linux, with Linux 3.16.0-0.bpo.4-amd64 (recovery mode)
2 Debian GNU/Linux, with Linux 3.2.0-4-amd64
3 Debian GNU/Linux, with Linux 3.2.0-4-amd64 (recovery mode)
4 Debian GNU/Linux, with Xen 4 and Linux 3.16.0-0.bpo.4-amd64
5 Debian GNU/Linux, with Xen 4 and Linux 3.16.0-0.bpo.4-amd64 (recovery mode)
6 Debian GNU/Linux, with Xen 4 and Linux 3.2.0-4-amd64
7 Debian GNU/Linux, with Xen 4 and Linux 3.2.0-4-amd64 (recovery mode)
8 Debian GNU/Linux, with Xen 4.4 and Linux 3.16.0-0.bpo.4-amd64
9 Debian GNU/Linux, with Xen 4.4 and Linux 3.16.0-0.bpo.4-amd64 (recovery mode)
10 Debian GNU/Linux, with Xen 4.4 and Linux 3.2.0-4-amd64
11 Debian GNU/Linux, with Xen 4.4 and Linux 3.2.0-4-amd64 (recovery mode)
12 Debian GNU/Linux, with Xen 4.4.1 and Linux 3.16.0-0.bpo.4-amd64
13 Debian GNU/Linux, with Xen 4.4.1 and Linux 3.16.0-0.bpo.4-amd64 (recovery mode)
14 Debian GNU/Linux, with Xen 4.4.1 and Linux 3.2.0-4-amd64
15 Debian GNU/Linux, with Xen 4.4.1 and Linux 3.2.0-4-amd64 (recovery mode)
root@Debian-78-wheezy-64-minimal ~/workplace/backup_xen_boot # grep GRUB_DEFAULT /etc/default/grub
GRUB_DEFAULT=12
当我设置并发出时,我能够引导到内核3.2.0-4-amd64
(这是我安装 XEN 并升级到 的内核3.16.0-0.bpo.4-amd64
)。但问题是,即使我已经设置了 ,我也无法引导到 XEN 内核。它总是像我已经设置了 一样引导内核。以下是我没有使用 XEN 内核的证据,即使我已经设置了:GRUB_DEFAULT=2
update-grub
GRUB_DEFAULT=12
3.16.0-0.bpo.4-amd64
GRUB_DEFAULT=0
GRUB_DEFAULT=12
root@Debian-78-wheezy-64-minimal ~/workplace/backup_xen_boot # xen-detect
Not running on Xen.
root@Debian-78-wheezy-64-minimal ~/workplace/backup_xen_boot # uname -a
Linux Debian-78-wheezy-64-minimal 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt7-1~bpo70+1 (2015-04-07) x86_64 GNU/Linux
编辑:
这也得到了满足(即使它与RedHat 上的 XEN):
在您着手构建 xen 之前,请确保您所需的内核将支持 dom0。grep XEN /boot/config-3.10* 如果您没有从 ^^ 返回至少 35 个条目,那么 Redhat 内核就不支持 dom0。
我还能尝试什么?
答案1
所有荣誉都归功于 freenode 上 #xen 频道的人员,特别是:PryMar56 和 deHakkelaar
当它不起作用时,情况就是这样的:
ls -la /etc/grub.d/
total 52K
-rwxr-xr-x 1 root root 6.6K Jun 8 2012 00_header
-rwxr-xr-x 1 root root 5.3K Jun 8 2012 05_debian_theme
-rwxr-xr-x 1 root root 5.9K Jan 20 2013 10_linux
-rwxr-xr-x 1 root root 6.2K Jun 8 2012 20_linux_xen
-rwxr-xr-x 1 root root 6.4K Apr 29 2013 30_os-prober
-rwxr-xr-x 1 root root 214 Jun 8 2012 40_custom
-rwxr-xr-x 1 root root 95 Jun 8 2012 41_custom
-rw-r--r-- 1 root root 483 Jun 8 2012 README
它的工作原理如下:
ls -la /etc/grub.d/
total 52K
-rwxr-xr-x 1 root root 6.6K Jun 8 2012 00_header
-rwxr-xr-x 1 root root 5.3K Jun 8 2012 05_debian_theme
-rwxr-xr-x 1 root root 6.2K Jun 8 2012 09_linux_xen
-rwxr-xr-x 1 root root 5.9K Jan 20 2013 10_linux
-rwxr-xr-x 1 root root 6.4K Apr 29 2013 30_os-prober
-rwxr-xr-x 1 root root 214 Jun 8 2012 40_custom
-rwxr-xr-x 1 root root 95 Jun 8 2012 41_custom
-rw-r--r-- 1 root root 483 Jun 8 2012 README
总结:xen 需要在内核之前启动,因此我这样做了:
(cd /etc/grub.d/;mv 20_linux_xen 09_linux_xen)
update-grub
我认为这是类似的东西