linux初探

首页

应用服务器

Linux技巧

中文文档

Linux初级

服务器源代码

命令详解

Linux技术应用

Linux安全应用

Linux业界新闻

UniX技术文章

Linux编程与内核

Linux数据库

Linux服务器

Linux安装指导

Linux论坛

首页>>Linux编程与内核>>

热门文章

·C/C++中多维数组指针作为函数
·教你如何使用 C++Builder 制
·C++ Builder中保持控件的位置
·C++Builder中动态更改自定义
·拓展网页技术之C++在网页设计
·C++Builder创建基于Internet
·C++Builder在WIN2000环境下编
·用C++ Builder为计算机增加启
·C++/VC++ 语言编程的疑难问题
·C/C++语言void及void指针深层

推荐文章

在SuSE10.0下安装qemu


1. 编译qemu
用SuSE10.0自带的gcc-4.0.2编译qemu会出现下面的问题
# cd /usr/local/qemu-0.9.0
# ./configure
WARNING: "gcc" looks like gcc 4.x
Looking for gcc 3.x
gcc 3.x not found!
QEMU is known to have problems when compiled with gcc 4.x
It is recommended that you use gcc 3.x to build QEMU
To use this compiler anyway, configure with --disable-gcc-check
因此可以先装一个gcc-3.4.6
# which gcc
/usr/local/bin
# gcc --version
gcc (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# cd /usr/local/qemu-0.9.0
# ./configure; make; make install

2. 编译kqemu
如果你还用gcc-3.4.6编译kqemu,在插入模块时会出现下面的问题
# modprobe kqemu
FATAL: Error inserting kqemu (/lib/modules/2.6.13-15-smp/misc/kqemu.ko): Invalid module format
因此在编译kqemu时要用系统自带的gcc-4.0.2
# which gcc
/usr/bin/gcc
# gcc --version
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# cd /usr/local/qemu-0.9.0/kqemu-1.3.0pre11
# ./configure; make; make install
# modprobe kqemu
# lsmod | grep kqemu
kqemu 128548 0
# modinfo kqemu
filename: /lib/modules/2.6.13-15-smp/misc/kqemu.ko
license: GPL
vermagic: 2.6.13-15-smp SMP 586 REGPARM gcc-4.0
depends:
parm: major:int

3. 网络设置
# qemu -cdrom slax-5.1.8.1.iso
用slax启动盘启动后,slax会得到一个10.0.2.15的ip,你的SuSE10.0会默认为10.0.2.2,域名服务器的ip是10.0.2.3。你可以通过ssh连接到SuSE10.0上
# ssh 10.0.2.2
如果虚拟的是windows,在地址栏中键入
\\10.0.2.2
就可以通过samba和SuSE10.0交换文件了

4. 磁盘操作
# qemu-img create win.img 10G
# qemu -hda win.img -cdrom TomatoWinXP_SP2_v3_0.iso -boot d -m 384
下面介绍通过回环设备将image文件挂载到本地,和本地文件系统直接交互。

# losetup /dev/loop0 win.img
# fdisk /dev/loop0

The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): x

Expert command (m for help): p

Disk /dev/loop0: 255 heads, 63 sectors, 2610 cylinders

Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID
1 80 1 1 0 254 63 568 63 9140922 0b
2 00 0 0 0 0 0 0 0 0 00
3 00 0 0 0 0 0 0 0 0 00
4 00 0 0 0 0 0 0 0 0 00

Expert command (m for help): q

# losetup -o 32256 /dev/loop1 win.img
# mount -t vfat /dev/loop1 win
# cd win
# ls
Documents and Settings autoexec.bat config.sys io.sys ntldr
Program Files boot.ini found.000 msdos.sys pagefile.sys
Recycled bootfont.bin hiberfil.sys ntdetect.com windows

32256是用start*512算出来的,在本例中start=63
拷贝完文件后最后别忘了进行清理
# losetup -a
/dev/loop0: [0302]:241 (win.img)
/dev/loop1: [0302]:241 (win.img) offset=32256
# umount win
# losetup -d /dev/loop0
# losetup -d /dev/loop1

上面的操作在赵炯老师的《Linux内核完全注释》电子版中有更详细的讲解

相关文章:

·PHP执行root命令
·linux进程介绍之fork vs vfork
·请大虾帮忙解释一下
·Linux学习之GCC从这开始
·LINUX学习之一 GCC学习参数详解
·第一个简单的shell工具
·java 类型提升的约定
·在开源Java下生存
·Linux底层开发之四书五经

Copyright@2005 www.linuxGoo.com All Right Reserved