しょんぼり技術メモ

まいにちがしょんぼり

Xen 3.4.1をソースからインストール


※不十分な部分があったので書き直しました。CentOS 5.4にXen3.4.2をソースからインストール - しょんぼり技術メモ




http://www.xen.org/products/xen_source.html からソースを落として展開。

$ wget http://bits.xensource.com/oss-xen/release/3.4.1/xen-3.4.1.tar.gz
$ tar zxf xen-3.4.1.tar.gz
$ cd xen-3.4.1

READMEには

3. For the very first build, or if you want to destroy existing
   .configs and build trees, perform the following steps:

    # make world
    # make install

とあるので、おとなしく従う。

# make world -j8
# make install -j8

以下のファイルが/bootに作られる。

System.map-2.6.18.8-xen
config-2.6.18.8-xen
vmlinuz-2.6.18.8-xen
xen-3.4.1.gz
xen-3.4.gz -> xen-3.4.1.gz
xen-3.gz -> xen-3.4.1.gz
xen.gz -> xen-3.4.1.gz
xen-syms-3.4.1

READMEに書いてあるとおり、initrdを作成する。ただし、バージョンがちょっと違うので修正する。
また、"No module dm-mem-cache found for kernel ..."のようなエラーが出るので、"--without-dmraid"を付ける。

   Depending on your config, you may need to use 'mkinitrd' to create
   an initial ram disk, just like a native system e.g.
    # depmod 2.6.18-xen
    # mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod initrd-2.6.18-xen.img 2.6.18-xen

実際に実行するコマンドはこんな感じ。

# depmod 2.6.18.8-xen
# mkinitrd -v -f --with=aacraid --with=sd_mod --with=scsi_mod --without-dmraid /boot/initrd-2.6.18.8-xen-3.4.1 2.6.18.8-xen

grubの設定ファイルを書き換える。

title CentOS with Xen3.4.1
        root (hd0,0)
        kernel /xen-3.4.1.gz console=vga
        module /vmlinuz-2.6.18.8-xen ro root=LABEL=/
        module /initrd-2.6.18.8-xen-3.4.1

再起動して、Xen3.4.1のカーネルを選択すればOK。

xm infoコマンドで確認する。

# xm info
host                   : 
release                : 2.6.18.8-xen
version                : #1 SMP Thu Oct 22 15:47:35 JST 2009
machine                : i686
nr_cpus                : 4
nr_nodes               : 1
cores_per_socket       : 4
threads_per_core       : 1
cpu_mhz                : 2400
hw_caps                : bfebfbff:20100000:00000000:00000140:0000e3bd:00000000:00000001:00000000
virt_caps              : hvm
total_memory           : 4094
free_memory            : 129
node_to_cpu            : node0:0-3
node_to_memory         : node0:129
xen_major              : 3 ←
xen_minor              : 4 ←
xen_extra              : .1 ←
xen_caps               : xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p
xen_scheduler          : credit
xen_pagesize           : 4096
platform_params        : virt_start=0xf5800000
xen_changeset          : unavailable
cc_compiler            : gcc バージョン 4.1.2 20080704 (Red Hat 4.1.2-44)
cc_compile_by          : root
cc_compile_domain      : 
cc_compile_date        : Thu Oct 22 15:51:46 JST 2009
xend_config_format     : 4