ããªãŒãœãããŠã§ã¢ã®éåžžã®åé¡ã§ãªããã°ããã®åé¡ã®ãã¹ãŠã¯éåžžã«ããžãã£ãã§ããGRUBãã©ã³ãã®éçºã¯æ°å¹ŽéGRUB2ãæ¯æããŠå®å šã«åæ¢ãããXenéçºã³ãã¥ããã£ã¯ä»åŸæ°å¹Žéã®GRUBã®çŸåšã®ããŒãžã§ã³ã«åºã¥ããŠå€æããŸãPVããŒãããŒããŒã®äº€ææºåãã§ããŠããŸããã PV-GRUBèªäœã¯ãäžè¬ã«å ¬åŒã®Xenãã£ã¹ããªãã¥ãŒã·ã§ã³ã®äžéšã§ãããDebianããã³Ubuntuãªããžããªã®å°ãªããšã察å¿ããããã±ãŒãžããæ¢ã«é€å€ãããŠããŸãããå©äŸ¿æ§ã«æ £ããŠãããŠãŒã¶ãŒã«ã¯ïŒDebian ïŒ GRUB 0.97ãåããããã±ãŒãžã¯åŒãç¶ãã¢ã¯ã»ã¹å¯èœã§æ©èœçã§ãããæ¢åã®æ©èœã«å¯ŸããŠäŸåé¢ä¿ããããŸã èŠæ ã¯ãããŸããã
ããã§ã¯ãããããç·æ¥ã®åé¡ã«å¯Ÿããæãåãå ¥ãããã解決çã説æããããšããŸã-è¶ èªç¶çãªåªåã¯å¿ èŠãªããã ã PV-GRUBãšããã䜿çšããããã«å¿ èŠãªDomUã®æ§æãç¬ç«ããŠæ§ç¯ããããšã§ãã
ã»ãšãã©åŸæ¥ã®ããŒãããŒããŒã®Xenæºä»®æ³ç°å¢ã®å®è£ ã®è©³çŽ°ãç解ããããšã«èå³ãããå ŽåãXen 3.3ã§ç»å Žããã¹ã¿ããã¡ã€ã³æ©èœã«é¢ããè³æãããã«æããããšãé©åã§ãã ç°¡åãªçŽ¹ä»ãXen.orgããã°ã«ãããŸãïŒ Xen 3.3æ©èœïŒã¹ã¿ããã¡ã€ã³ ã Xen 3.3æ©èœïŒHVMããã€ã¹ã¢ãã«ãã¡ã€ã³ ïŒã æ®ãã¯ãã¬ãŒã³ããŒã·ã§ã³ ïŒ PDF ïŒãåç §ãã Xen Summit North Americaã§çºè¡šãããã¬ããŒããã¹ã¿ããã¡ã€ã³ïŒDom0å解ãžã®äžæ©ããèãããšã§ãã
ããŒãããŒããŒããã«ãããã«ã¯ãXenãœãŒã¹ã³ãŒããå¿ èŠã§ãã ãã¹ãã·ã¹ãã ã§æ¢ã«äœ¿çšãããŠããããŒãžã§ã³ã䜿çšããããšããå§ãããŸãã Debian GNU / Linux "Wheezy"ã䜿çšããŠãããããç§ã«ãšã£ãŠã¯Xen 4.1.4ã«ãªããŸãã æå°éã®éçºãããïŒgcc + binutils + makeïŒã䜿çšããŠãä»»æã®ã·ã¹ãã ã§ãã«ãã§ããŸãã Xenã®å ¬åŒãµã€ãïŒ Xen 4.1ã·ãªãŒãº ã Xen 4.2ã·ãªãŒãº ïŒããããœãŒã¹ä»ãã®tarballãããŠã³ããŒãããŠè§£åããŸãã
$ wget http://bits.xensource.com/oss-xen/release/4.1.4/xen-4.1.4.tar.gz $ tar xzf xen-4.1.4.tar.gz
stubdom
ãã£ã¬ã¯ããªã«ç§»åããŸãã ããŒãããŒããŒãã«ããå®è¡ããŸãã
$ã°ã©ããäœã
ã·ã¹ãã ã¢ãŒããã¯ãã£ãšã¯ç°ãªãã¢ãŒããã¯ãã£çšã®ããŒãããŒããŒãæ§ç¯ããå¿ èŠãããå Žåã¯ãXEN_TARGET_ARCHå€æ°ã䜿çšããŠèšå®ã§ããŸãã
$ XEN_TARGET_ARCH = x86_32 make grub
ãã®ããã»ã¹ã¯ãããã€ãã®èœãšãç©Žããªããã°å®äºããŸããã ãã®ã³ã³ããŒãã³ãã®ã¢ã»ã³ããªã¯ãååšããªããã¹ã«ããã€ãã®ããããŒãã¡ã€ã«ãå«ãŸãããšããäžè¬çãªãšã©ãŒã§åæ¢ããŸãã
xc_core.cããã€ã³ã¯ã«ãŒãããããã¡ã€ã«ïŒ69ïŒ0ïŒ xc_core.hïŒ26ïŒ35ïŒèŽåœçãšã©ãŒïŒxen / libelf / elfstructs.hïŒãã®ãããªãã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªã¯ãããŸãã ã³ã³ãã€ã«ã¯çµäºããŸããã
ç¯äººãæ¢ããŠããŸãïŒ
$ find .. -type f -name xc_core.h ../tools/libxc/xc_core.h
ãã®äžã®æååã眮ãæããŸã
#include "xen/libelf/elfstructs.h"
ã«
#include "xen/elfstructs.h"
make grub
å床å®è¡
make grub
ãšãããã«ããã€ããç¶ããŸãã
xc_dom.hïŒ17:31ïŒèŽåœçãšã©ãŒïŒxen / libelf / libelf.hïŒãã®ãããªãã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªã¯ãããŸãã xc_hvm_build.cïŒ34ïŒ31ïŒèŽåœçãªãšã©ãŒïŒxen / libelf / libelf.hïŒãã®ãããªãã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªã¯ãããŸãã ../../xen/common/libelf/libelf-private.h:70:31ïŒèŽåœçãªãšã©ãŒïŒxen / libelf / libelf.hïŒãã®ãããªãã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªã¯ãããŸãã
ãã¹ãŠã¯äº€æã«ãã£ãŠæ±ºå®ãããŸã
#include <xen/libelf/libelf.h>
ã«
#include <xen/libelf.h>
ããã§ãã¢ã»ã³ããªãæ£åžžã«å®äºããã¯ãã§ãã 衚瀺ãããå¯èœæ§ã®ããåºåã®æåŸã®è¡ã¯æ¬¡ã®ãšããã§ãã
gzip -f -9 -c /home/user/xen-4.1.4/stubdom/mini-os-x86_64-grub/mini-os> /home/user/xen-4.1.4/stubdom/mini-os-x86_64 -grub / mini-os.gz make [1]ïŒãã£ã¬ã¯ã㪠`/home/user/xen-4.1.4/extras/mini-os 'ãé¢ãã
ãã§ã«å§çž®ããã
mini-os-x86_64-grub/mini-os.gz
ã¯ããããããããã
pv-grub-x86_64.gz
ïŒãŸãã¯
pv-grub-x86_32.gz
ã§ãã«ããããŠããå Žåã¯
pv-grub-x86_32.gz
x86_32.gzïŒã«ååãå€æŽãã
/usr/lib/xen-4.1/boot
æå±ããDom0ã®
/usr/lib/xen-4.1/boot
ïŒ xen-utils-4.1ãã€ã³ã¹ããŒã«ãããDebianã§æå¹ã
hvmloader
ã
hvmloader
ã«
hvmloader
ïŒã
ããŒãããŒããŒã®äœ¿çšã«çŽæ¥åãæ¿ããåã«ãã²ã¹ãã·ã¹ãã ã®æºåæé ãå®è¡ããå¿ èŠããããŸãã
å€ãGRUBã¯Ext4ã®ãããªææ°ã®ãã¡ã€ã«ã·ã¹ãã ãšçŽæ¥å奜çã§ã¯ãªãããšã«æ³šæããŠãã ããã ãããã£ãŠãæåã«ã«ãŒãã«ã€ã¡ãŒãžãinitrdãããã³GRUBæ§æãã¡ã€ã«ããã¹ãããã»ã¯ã·ã§ã³ïŒããã©ã«ãã§ã¯ãã¹ãŠã
/boot
ãã£ã¬ã¯ããªã«æ ŒçŽãããŠããïŒãããŒãããŒããŒããèªã¿åãçšã«ã¢ã¯ã»ã¹ã§ããããšã確èªããå¿ èŠããããŸãã ããã§èª¬æããã¯ãšã¹ããå®äºããéçšã§ãç§ã¯ãã§ã«çæãèžãã§ããŸãïŒExt4ãšExt2ã®çè«çã«ã¯åŸæ¹äºææ§ãååšããŸãããç¹ã«Ext4ã»ã¯ã·ã§ã³ãäœæãããšãã«ããã«ã€ããŠèããªãã£ãå Žåããã®äºææ§ãå®å šã«æé€ããå€ãã®ç°ãªãæ¡åŒµæ©èœïŒæ©èœïŒããããŸãã
/boot
äžã«å¥ã®ããŒãã£ã·ã§ã³ãäœæããåã«ãç¹å¥ãªå¿ èŠã¯ãããŸããã§ããã ä»ã解決çã¯ãExt2ã§ãã©ãŒãããããããåè¿°ã®éå§ããªããã£ããã€ã¯ãããŒãã£ã·ã§ã³ïŒçŸåšã®ã³ã³ãã³ã
/boot
ããã®2åã®ããªã¥ãŒã ã§ååã ãšæããŸãïŒã«è»¢éããããšã§ãã ãŸããå¿ èŠã«å¿ããŠ
/boot
ããŒãã£ã·ã§ã³ãè¿œå ããæ®ãã®ããŒãã£ã·ã§ã³ã®ãããã¯ããã€ã¹åãå€æŽããŠãDomUã®
/etc/fstab
ç·šéããããšãå¿ããªã
/etc/fstab
ãã ããã ä»®æ³ãã·ã³èªäœã®ãã£ã¹ã¯æ§æã«ãåãããšãåœãŠã¯ãŸããŸãã
mount -t ext2
䜿çšãããšãæ¢åã®ããŒãã£ã·ã§ã³ãExt2ãšã®äžäœäºææ§ã¢ãŒãã§ã®
mount -t ext2
ã©ã®ããã«é©ããŠããããç°¡åã«ç¢ºèªã§ããŸãã
ä»®æ³ãã·ã³èªäœã«ãå€ãããŒãžã§ã³ã®GRUBïŒDebianã®grub-legacyããã±ãŒãžãŸãã¯Ubuntuã®æããã£ã¹ããããgrub-legacy-ec2 ïŒãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã ããŒãã£ã·ã§ã³ã®ããŒãã»ã¯ã¿ãŒã«GRUBãã€ã³ã¹ããŒã«ããããšã«é¢ããåãåããã«ã¯åŠå®çãªåçãå¿ èŠã§ããããã¯æå³ããããŸããã
ã€ã³ã¹ããŒã«åŸãGRUBèšå®ãä¿åãããã£ã¬ã¯ããªãååšããæžã蟌ã¿å¯èœã§ããããšã確èªããŠãã ããã
update-grub
ãå®è¡
update-grub
ãšãããŒãããŒããŒã¡ãã¥ãŒãã¡ã€ã«ãäœæãããã·ã¹ãã ã«ã€ã³ã¹ããŒã«ãããŠããã«ãŒãã«ãããŒããªã¹ãã«è¿œå ãããŸãã
$ mkdir / boot / grub $ update-grub GRUBã€ã³ã¹ããŒã«ãã£ã¬ã¯ããªãæ€çŽ¢ããŠããŸã...èŠã€ãããŸããïŒ/ boot / grub ããã€ã¹ããããŒãããŠBIOSãã©ã€ããæšæž¬ããŸãã ããã«ã¯æéããããå ŽåããããŸãã ããã©ã«ããã¡ã€ã«ãæ€çŽ¢ããŠããŸã... / boot / grub / defaultãã¡ã€ã«ãçæããããã©ã«ãã®ããŒããšã³ããªã0ã«èšå®ããŸã GRUBã€ã³ã¹ããŒã«ãã£ã¬ã¯ããªãæ€çŽ¢ããŠããŸã...èŠã€ãããŸããïŒ/ boot / grub æ¢åã®GRUB menu.lstãã¡ã€ã«ã®ãã¹ã... /boot/grub/menu.lstã®çæ ã¹ãã©ãã·ã¥ç»åãæ€çŽ¢ããŠããŸã...èŠã€ãããŸãããã¹ãããããŠããŸã... èŠã€ãã£ãã«ãŒãã«ïŒ/vmlinuz-3.2.0-4-amd64 /boot/grub/menu.lstã®æŽæ°...å®äº
äœæããã
/boot/grub/menu.lst
èŠãŠãã ããïŒ
ã¿ã€ãã«Debian GNU / Linuxãã«ãŒãã«3.2.0-4-amd64 ã«ãŒãïŒ/ dev / xvda1ïŒ ã«ãŒãã«/vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro initrd /initrd.img-3.2.0-4-amd64 ã¿ã€ãã«Debian GNU / Linuxãã«ãŒãã«3.2.0-4-amd64ïŒã·ã³ã°ã«ãŠãŒã¶ãŒã¢ãŒãïŒ ã«ãŒãïŒ/ dev / xvda1ïŒ ã«ãŒãã«/vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro single initrd /initrd.img-3.2.0-4-amd64
ããã§ã¯ãã³ã³ãã£ã®ã¥ã¬ãŒã¿ãŒã
root
ãªãã·ã§ã³ã誀ã£ãŠå ¥åãããã£ã¹ã¯ãšããŒãã£ã·ã§ã³ã®ããããããGRUBæå®ã®ä»£ããã«ãããã¯ããã€ã¹ã®ãã¡ã€ã«åã䜿çšããŠããããšãå°è±¡çã§ãã ãããã®ã¡ãã¥ãŒé ç®ãéžæãããšãGRUBã¯ééã£ããªãã·ã§ã³å€ãåçŽã«èªããŸãã
ç¶æ³ãä¿®æ£ããããã«ãçæããã
/boot/grub/menu.lst
å°ãå€æŽããŸããããŒãããã£ã¹ã¯ãã®ã·ãªã¢ã«çªå·ãæ瀺çã«ç€ºã
groot
ãªãã·ã§ã³ãè¿œå ãããã®åŸ
/boot
ãšããŠããŠã³ããã
/boot
ïŒæºä»®æ³ç°å¢ã«ã¯ããŒãã£ã·ã§ã³ããŒãã«ãæã€æ¬æ Œçãªãã£ã¹ã¯ããªãããïŒïŒ
groot =ïŒhd0ïŒ
æéãç¡é§ã«ããªãããã«ãããŠã³ããŒããéå§ããåã«ããã«ã¿ã€ã ã¢ãŠããæžããããšãã§ããŸãã
##ã¿ã€ã ã¢ãŠãç§ ïŒæ¢å®ã®ãšã³ããªãèªåçã«èµ·åããåã«ãç§åäœã§ã¿ã€ã ã¢ãŠããèšå®ããŸã ïŒïŒéåžžãæåã«å®çŸ©ããããšã³ããªïŒã ã¿ã€ã ã¢ãŠã1
groot
å€ã
update-grub
èšå®ãžã§ãã¬ãŒã¿ãŒã«ãã£ãŠæ£ããèªèãããããã«ããã¡ã€ã«
/boot/grub/device.map
ãè¿œå ã§äœæããŸããããã§ãèšåãããããŒãããŒãã£ã·ã§ã³ã«é¢ããå¯äžã®è¡ãå ¥åããŸãã
ïŒhd0ïŒ/ dev / xvda1
ããã§ã
update-grub
ãæ£ããã¡ãã¥ãŒãã¡ã€ã«ãçæããã¯ãã§ããã¡ã€ã³ã«ãŒãã«ã®ããŒãžã§ã³ãæŽæ°ããããè¿œå ããå Žåã§ãããã®æäœæ§ã¯åœ±é¿ãåããŸããã
ã¿ã€ãã«Debian GNU / Linuxãã«ãŒãã«3.2.0-4-amd64 ã«ãŒãïŒhd0ïŒ ã«ãŒãã«/vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro initrd /initrd.img-3.2.0-4-amd64 ã¿ã€ãã«Debian GNU / Linuxãã«ãŒãã«3.2.0-4-amd64ïŒã·ã³ã°ã«ãŠãŒã¶ãŒã¢ãŒãïŒ ã«ãŒãïŒhd0ïŒ ã«ãŒãã«/vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro single initrd /initrd.img-3.2.0-4-amd64
extra
ãªãã·ã§ã³ã䜿çšããŠä»®æ³ãã·ã³æ§æã§çŽæ¥èšå®ãããè¿œå ãã©ã¡ãŒã¿ãŒãã«ãŒãã«ã«æž¡ãå¿ èŠãããå Žåãåã
/boot/grub/menu.lst
kopt
ãå€æŽããããšã§ãããå®è¡ã§ããŸãã
æåŸã®ã³ãŒããšããŠãDomUã®èµ·åããã»ã¹ãåæ§æããŸããããŒãããŒããŒã®ãã¡ã€ã«åã¯
kernel
ãªãã·ã§ã³ã§æå®ããå¿ èŠããããŸãã ããŒãããŒããŒã€ã¡ãŒãžãããã©ã«ããã£ã¬ã¯ããªïŒ
hvmloader
ãšåãå ŽæïŒã«ããå Žåããã«ãã¹ã¯ãªãã·ã§ã³ã§ãã
extra
ãªãã·ã§ã³ã¯ãGRUBã¡ãã¥ãŒãã¡ã€ã«ãžã®ã»ã¯ã·ã§ã³ãšãã¹ãæå®ããŸãã
ã«ãŒãã«= 'pv-grub-x86_64.gz' extra = 'ïŒhd0ïŒ/grub/menu.lst'
å€ã
ramdisk
ããã³
root
ãªãã·ã§ã³ã¯ç Žæ£ããå¿ èŠããããŸãã
æ°ããæ§æãå®å šã«æ©èœããããšã確èªããã«ã¯ãDomUã®æåã®èµ·åã¯ãã³ã³ãœãŒã«ãžã®èªåæ¥ç¶ã¢ãŒãïŒ
xm start -c
ïŒã§å®è¡ããå¿ èŠããããŸãã ãã¹ãŠãæ£ããå®è¡ããããšãGRUBã¡ãã¥ãŒãšãã«ãŒãããŒãã£ã·ã§ã³ãããŠã³ãããåŸç¶ã®ã«ãŒãã«ããŒãããã»ã¹ã衚瀺ãããŸãã
泚 ïŒããŸããŸãªãã£ã¹ããªãã¥ãŒã·ã§ã³ã®Xenããã±ãŒãžã«PV-GRUBããªãçç±ãšããŠæãå¯èœæ§ãé«ãã®ã¯ãxen-usersã¡ãŒãªã³ã°ãªã¹ãã§çºè¡šãããŠããŸã ã
Gentoo Xen ebuildã¯ããã«ãããã»ã¹äžã«portage ebuildã·ã¹ãã ãšåãå ¥ããããªã/äºææ§ã®ãªãå€éšããã±ãŒãžãããŠã³ããŒããããããã¹ã¿ããã ã®ãã«ãããµããŒãããŠããŸãããããããåæ§ã®çç±ã§Debianããã±ãŒãžã«å«ãŸããŠããªãå¯èœæ§ããããŸãã