| 论坛注册| 加入收藏 | 设为首页| RSS
Google
您当前的位置:首页 > Linux频道 > Linux入门与提高 > 安装与配置

在SuSE10.0下安装qemu

时间:2007-02-20 11:44:40  来源:Linux联盟收集整理  作者:
1. 编译qemuuESLinux联盟
用SuSE10.0自带的gcc-4.0.2编译qemu会出现下面的问题uESLinux联盟
# cd /usr/local/qemu-0.9.0uESLinux联盟
# ./configure uESLinux联盟
WARNING: "gcc" looks like gcc 4.xuESLinux联盟
Looking for gcc 3.xuESLinux联盟
gcc 3.x not found!uESLinux联盟
QEMU is known to have problems when compiled with gcc 4.xuESLinux联盟
It is recommended that you use gcc 3.x to build QEMUuESLinux联盟
To use this compiler anyway, configure with --disable-gcc-checkuESLinux联盟
因此可以先装一个gcc-3.4.6uESLinux联盟
# which gccuESLinux联盟
/usr/local/binuESLinux联盟
# gcc --versionuESLinux联盟
gcc (GCC) 3.4.6uESLinux联盟
Copyright (C) 2006 Free Software Foundation, Inc.uESLinux联盟
This is free software; see the source for copying conditions.  There is NOuESLinux联盟
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.uESLinux联盟
# cd /usr/local/qemu-0.9.0uESLinux联盟
# ./configure; make; make installuESLinux联盟
uESLinux联盟
2. 编译kqemuuESLinux联盟
如果你还用gcc-3.4.6编译kqemu,在插入模块时会出现下面的问题uESLinux联盟
# modprobe kqemuuESLinux联盟
FATAL: Error inserting kqemu (/lib/modules/2.6.13-15-smp/misc/kqemu.ko): Invalid module formatuESLinux联盟
因此在编译kqemu时要用系统自带的gcc-4.0.2uESLinux联盟
# which gccuESLinux联盟
/usr/bin/gccuESLinux联盟
# gcc --versionuESLinux联盟
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)uESLinux联盟
Copyright (C) 2005 Free Software Foundation, Inc.uESLinux联盟
This is free software; see the source for copying conditions.  There is NOuESLinux联盟
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.uESLinux联盟
# cd /usr/local/qemu-0.9.0/kqemu-1.3.0pre11uESLinux联盟
# ./configure; make; make installuESLinux联盟
# modprobe kqemuuESLinux联盟
# lsmod | grep  kqemuuESLinux联盟
kqemu                 128548  0uESLinux联盟
# modinfo kqemuuESLinux联盟
filename:       /lib/modules/2.6.13-15-smp/misc/kqemu.kouESLinux联盟
license:        GPLuESLinux联盟
vermagic:       2.6.13-15-smp SMP 586 REGPARM gcc-4.0uESLinux联盟
depends:uESLinux联盟
parm:           major:intuESLinux联盟
uESLinux联盟
3. 网络设置uESLinux联盟
# qemu -cdrom slax-5.1.8.1.isouESLinux联盟
用slax启动盘启动后,slax会得到一个10.0.2.15的ip,你的SuSE10.0会默认为10.0.2.2,域名服务器的ip是10.0.2.3。你可以通过ssh连接到SuSE10.0上uESLinux联盟
# ssh 10.0.2.2uESLinux联盟
如果虚拟的是windows,在地址栏中键入uESLinux联盟
\\10.0.2.2uESLinux联盟
就可以通过samba和SuSE10.0交换文件了uESLinux联盟
uESLinux联盟
4. 磁盘操作uESLinux联盟
# qemu-img create win.img 10GuESLinux联盟
# qemu -hda win.img -cdrom TomatoWinXP_SP2_v3_0.iso -boot d -m 384uESLinux联盟
下面介绍通过回环设备将image文件挂载到本地,和本地文件系统直接交互。uESLinux联盟
uESLinux联盟
# losetup /dev/loop0 win.imguESLinux联盟
# fdisk /dev/loop0uESLinux联盟
uESLinux联盟
The number of cylinders for this disk is set to 2610.uESLinux联盟
There is nothing wrong with that, but this is larger than 1024,uESLinux联盟
and could in certain setups cause problems with:uESLinux联盟
1) software that runs at boot time (e.g., old versions of LILO)uESLinux联盟
2) booting and partitioning software from other OSsuESLinux联盟
   (e.g., DOS FDISK, OS/2 FDISK)uESLinux联盟
uESLinux联盟
Command (m for help): xuESLinux联盟
uESLinux联盟
Expert command (m for help): puESLinux联盟
uESLinux联盟
Disk /dev/loop0: 255 heads, 63 sectors, 2610 cylindersuESLinux联盟
uESLinux联盟
Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size IDuESLinux联盟
 1 80   1   1    0 254  63  568         63    9140922 0buESLinux联盟
 2 00   0   0    0   0   0    0          0          0 00uESLinux联盟
 3 00   0   0    0   0   0    0          0          0 00uESLinux联盟
 4 00   0   0    0   0   0    0          0          0 00uESLinux联盟
uESLinux联盟
Expert command (m for help): quESLinux联盟
uESLinux联盟
# losetup -o 32256 /dev/loop1 win.imguESLinux联盟
# mount -t vfat /dev/loop1 winuESLinux联盟
# cd winuESLinux联盟
# lsuESLinux联盟
Documents and Settings  autoexec.bat  config.sys    io.sys        ntldruESLinux联盟
Program Files           boot.ini      found.000     msdos.sys     pagefile.sysuESLinux联盟
Recycled                bootfont.bin  hiberfil.sys  ntdetect.com  windowsuESLinux联盟
uESLinux联盟
32256是用start*512算出来的,在本例中start=63uESLinux联盟
拷贝完文件后最后别忘了进行清理uESLinux联盟
# losetup -auESLinux联盟
/dev/loop0: [0302]:241 (win.img)uESLinux联盟
/dev/loop1: [0302]:241 (win.img) offset=32256uESLinux联盟
# umount winuESLinux联盟
# losetup -d /dev/loop0uESLinux联盟
# losetup -d /dev/loop1uESLinux联盟
uESLinux联盟
上面的操作在赵炯老师的《Linux内核完全注释》电子版中有更详细的讲解
摘自:http://blog.chinaunix.net/u/23177/showart_248414.html
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目更新
栏目热门