2007年5月29日火曜日

kqemu

仮想化で使ったことが無かった qemu に挑戦。debian 使っているので、DebianでQEMUを高速化する(kqemuモジュール)がとっても参考になった。細かな話だけど module-assistant の部分はどこかの madwifi のコンパイル方法にもあったが
m-a a-i kqemu
かな。QEMUのサイトにあるlinux-0.2.img.bz2 (8 MB)でも良いけど。debian であれば qemu-make-debian-root なるものがあったり qemu-img もあるけど。その後 ここここを参照しつつ

# dd if=/dev/zero of=disk.img bs=1M seek=2047 count=1
# losetup /dev/loop0 disk.img
# cfdisk -s 63 -h 16 /dev/loop0
....(1つのパーティションで bootable に)
# losetup -o 32256 /dev/loop0 disk.img
# mkfs -t ext3 /dev/loop0
# losetup -d /dev/loop0
# mkdir rootfs
# mount -o offset=32256,loop disk.img rootfs
# debootstrap --arch amd64 etch rootfs http://ring.asahi-net.or.jp/archives/linux/debian/debian
....
# chroot rootfs /bin/bash
# apt-get install kernel-image-2.6-amd64-generic grub
....
# mkdir /boot/grub
# update-grub
# cp /usr/lib/grub/x86_64-pc/* .
# exit
# umount root
# exit
# /usr/sbin/grub --no-floppy
# grub --no-floppy
Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> device (hd0) disk.img
device (hd0) disk.img
grub> root (hd0,0)
root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /
Done.
grub> quit
quit
# qemu-system-x86_64 disk.img
おぉ...と思ったら slashdot に こんな 記事が。さて...

# 目的のための手段のための手段のための...が目的に

0 件のコメント: