Isaku Yamahata | 98c99d7 | 2008-05-28 17:13:53 +0900 | [diff] [blame] | 1 | Recipe for getting/building/running Xen/ia64 with pv_ops |
| 2 | -------------------------------------------------------- |
| 3 | |
| 4 | This recipe describes how to get xen-ia64 source and build it, |
| 5 | and run domU with pv_ops. |
| 6 | |
| 7 | ============ |
| 8 | Requirements |
| 9 | ============ |
| 10 | |
| 11 | - python |
| 12 | - mercurial |
| 13 | it (aka "hg") is an open-source source code |
| 14 | management software. See the below. |
| 15 | http://www.selenic.com/mercurial/wiki/ |
| 16 | - git |
| 17 | - bridge-utils |
| 18 | |
| 19 | ================================= |
| 20 | Getting and Building Xen and Dom0 |
| 21 | ================================= |
| 22 | |
| 23 | My environment is; |
| 24 | Machine : Tiger4 |
| 25 | Domain0 OS : RHEL5 |
| 26 | DomainU OS : RHEL5 |
| 27 | |
| 28 | 1. Download source |
| 29 | # hg clone http://xenbits.xensource.com/ext/ia64/xen-unstable.hg |
| 30 | # cd xen-unstable.hg |
| 31 | # hg clone http://xenbits.xensource.com/ext/ia64/linux-2.6.18-xen.hg |
| 32 | |
| 33 | 2. # make world |
| 34 | |
| 35 | 3. # make install-tools |
| 36 | |
| 37 | 4. copy kernels and xen |
| 38 | # cp xen/xen.gz /boot/efi/efi/redhat/ |
| 39 | # cp build-linux-2.6.18-xen_ia64/vmlinux.gz \ |
| 40 | /boot/efi/efi/redhat/vmlinuz-2.6.18.8-xen |
| 41 | |
| 42 | 5. make initrd for Dom0/DomU |
| 43 | # make -C linux-2.6.18-xen.hg ARCH=ia64 modules_install \ |
| 44 | O=$(/bin/pwd)/build-linux-2.6.18-xen_ia64 |
| 45 | # mkinitrd -f /boot/efi/efi/redhat/initrd-2.6.18.8-xen.img \ |
| 46 | 2.6.18.8-xen --builtin mptspi --builtin mptbase \ |
| 47 | --builtin mptscsih --builtin uhci-hcd --builtin ohci-hcd \ |
| 48 | --builtin ehci-hcd |
| 49 | |
| 50 | ================================ |
| 51 | Making a disk image for guest OS |
| 52 | ================================ |
| 53 | |
| 54 | 1. make file |
| 55 | # dd if=/dev/zero of=/root/rhel5.img bs=1M seek=4096 count=0 |
| 56 | # mke2fs -F -j /root/rhel5.img |
| 57 | # mount -o loop /root/rhel5.img /mnt |
| 58 | # cp -ax /{dev,var,etc,usr,bin,sbin,lib} /mnt |
| 59 | # mkdir /mnt/{root,proc,sys,home,tmp} |
| 60 | |
| 61 | Note: You may miss some device files. If so, please create them |
| 62 | with mknod. Or you can use tar instead of cp. |
| 63 | |
| 64 | 2. modify DomU's fstab |
| 65 | # vi /mnt/etc/fstab |
| 66 | /dev/xvda1 / ext3 defaults 1 1 |
| 67 | none /dev/pts devpts gid=5,mode=620 0 0 |
| 68 | none /dev/shm tmpfs defaults 0 0 |
| 69 | none /proc proc defaults 0 0 |
| 70 | none /sys sysfs defaults 0 0 |
| 71 | |
| 72 | 3. modify inittab |
| 73 | set runlevel to 3 to avoid X trying to start |
| 74 | # vi /mnt/etc/inittab |
| 75 | id:3:initdefault: |
| 76 | Start a getty on the hvc0 console |
| 77 | X0:2345:respawn:/sbin/mingetty hvc0 |
| 78 | tty1-6 mingetty can be commented out |
| 79 | |
| 80 | 4. add hvc0 into /etc/securetty |
| 81 | # vi /mnt/etc/securetty (add hvc0) |
| 82 | |
| 83 | 5. umount |
| 84 | # umount /mnt |
| 85 | |
| 86 | FYI, virt-manager can also make a disk image for guest OS. |
| 87 | It's GUI tools and easy to make it. |
| 88 | |
| 89 | ================== |
| 90 | Boot Xen & Domain0 |
| 91 | ================== |
| 92 | |
| 93 | 1. replace elilo |
| 94 | elilo of RHEL5 can boot Xen and Dom0. |
| 95 | If you use old elilo (e.g RHEL4), please download from the below |
| 96 | http://elilo.sourceforge.net/cgi-bin/blosxom |
| 97 | and copy into /boot/efi/efi/redhat/ |
| 98 | # cp elilo-3.6-ia64.efi /boot/efi/efi/redhat/elilo.efi |
| 99 | |
| 100 | 2. modify elilo.conf (like the below) |
| 101 | # vi /boot/efi/efi/redhat/elilo.conf |
| 102 | prompt |
| 103 | timeout=20 |
| 104 | default=xen |
| 105 | relocatable |
| 106 | |
| 107 | image=vmlinuz-2.6.18.8-xen |
| 108 | label=xen |
| 109 | vmm=xen.gz |
| 110 | initrd=initrd-2.6.18.8-xen.img |
| 111 | read-only |
| 112 | append=" -- rhgb root=/dev/sda2" |
| 113 | |
| 114 | The append options before "--" are for xen hypervisor, |
| 115 | the options after "--" are for dom0. |
| 116 | |
| 117 | FYI, your machine may need console options like |
| 118 | "com1=19200,8n1 console=vga,com1". For example, |
| 119 | append="com1=19200,8n1 console=vga,com1 -- rhgb console=tty0 \ |
| 120 | console=ttyS0 root=/dev/sda2" |
| 121 | |
| 122 | ===================================== |
| 123 | Getting and Building domU with pv_ops |
| 124 | ===================================== |
| 125 | |
| 126 | 1. get pv_ops tree |
| 127 | # git clone http://people.valinux.co.jp/~yamahata/xen-ia64/linux-2.6-xen-ia64.git/ |
| 128 | |
| 129 | 2. git branch (if necessary) |
| 130 | # cd linux-2.6-xen-ia64/ |
| 131 | # git checkout -b your_branch origin/xen-ia64-domu-minimal-2008may19 |
| 132 | (Note: The current branch is xen-ia64-domu-minimal-2008may19. |
| 133 | But you would find the new branch. You can see with |
| 134 | "git branch -r" to get the branch lists. |
| 135 | http://people.valinux.co.jp/~yamahata/xen-ia64/for_eagl/linux-2.6-ia64-pv-ops.git/ |
| 136 | is also available. The tree is based on |
| 137 | git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 test) |
| 138 | |
| 139 | |
| 140 | 3. copy .config for pv_ops of domU |
| 141 | # cp arch/ia64/configs/xen_domu_wip_defconfig .config |
| 142 | |
| 143 | 4. make kernel with pv_ops |
| 144 | # make oldconfig |
| 145 | # make |
| 146 | |
| 147 | 5. install the kernel and initrd |
| 148 | # cp vmlinux.gz /boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU |
| 149 | # make modules_install |
| 150 | # mkinitrd -f /boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img \ |
| 151 | 2.6.26-rc3xen-ia64-08941-g1b12161 --builtin mptspi \ |
| 152 | --builtin mptbase --builtin mptscsih --builtin uhci-hcd \ |
| 153 | --builtin ohci-hcd --builtin ehci-hcd |
| 154 | |
| 155 | ======================== |
| 156 | Boot DomainU with pv_ops |
| 157 | ======================== |
| 158 | |
| 159 | 1. make config of DomU |
| 160 | # vi /etc/xen/rhel5 |
| 161 | kernel = "/boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU" |
| 162 | ramdisk = "/boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img" |
| 163 | vcpus = 1 |
| 164 | memory = 512 |
| 165 | name = "rhel5" |
| 166 | disk = [ 'file:/root/rhel5.img,xvda1,w' ] |
| 167 | root = "/dev/xvda1 ro" |
| 168 | extra= "rhgb console=hvc0" |
| 169 | |
| 170 | 2. After boot xen and dom0, start xend |
| 171 | # /etc/init.d/xend start |
| 172 | ( In the debugging case, # XEND_DEBUG=1 xend trace_start ) |
| 173 | |
| 174 | 3. start domU |
| 175 | # xm create -c rhel5 |
| 176 | |
| 177 | ========= |
| 178 | Reference |
| 179 | ========= |
| 180 | - Wiki of Xen/IA64 upstream merge |
| 181 | http://wiki.xensource.com/xenwiki/XenIA64/UpstreamMerge |
| 182 | |
| 183 | Written by Akio Takebe <takebe_akio@jp.fujitsu.com> on 28 May 2008 |