bochs 开启调试选项

来源:互联网 发布:自己怎么注册淘宝店铺 编辑:程序博客网 时间:2024/06/08 06:25
安装
从http://bochs.sourceforge.net/下载
./configure --with-all-libs --enable-vbe --enable-debugger
make
make install
#需要声卡加--enable-sb16,需要网卡加--enable-ne2000,
#64位机使用--enable-x86-64,mmx和sse, smp默认不支持

用SLS Linux  测试
下载SLS Linux    从http://bochs.sourceforge.net/cgi-bin/topper.pl?name=Disk+Images&url=http://sourceforge.net/project/showfiles.phpqmrkgroup_ideq12580amppackage_ideq27799
把SLS Linux 解压缩到一个文件夹

在终端下进到SLS Linux 所在的目录:sls-0.99pl
然后运行bochs
出现问题:
========================================================================
                        Bochs x86 Emulator 2.3
              Build from CVS snapshot on August 27, 2006
========================================================================
00000000000i[     ] reading configuration from bochsrc
00000000000i[     ] WARNING: syntax has changed, please use 'vgaromimage: file=...' now
00000000000e[     ] bochsrc: unknown parameter for parport1 ignored.
00000000000e[     ] bochsrc: floppy_command_delay is DEPRECATED (now using hardware timing).
00000000000e[     ] bochsrc: ips directive is DEPRECATED (use cpu directive parameter 'ips').
------------------------------
Bochs Configuration: Main Menu
------------------------------

This is the Bochs Configuration Interface, where you can describe the
machine that you want to simulate.  Bochs has already searched for a
configuration file (typically called bochsrc.txt) and loaded it if it
could be found.  When you are satisfied with the configuration, go
ahead and start the simulation.

You can also start bochs with the -q option to skip these menus.

1. Restore factory default configuration
2. Read options from...
3. Edit options
4. Save options to...
5. Begin simulation
6. Quit now

Please choose one: [5]
00000000000i[     ] installing x module as the Bochs GUI
00000000000i[     ] using log file bochsout.txt
========================================================================
Event type: PANIC
Device: [MEM0 ]
Message: ROM: couldn't open ROM image file '/usr/local/share/bochs/bios/BIOS-bochs-latest'.

A PANIC has occurred.  Do you want to:
  cont       - continue execution
  alwayscont - continue execution, and don't ask again.
               This affects only PANIC events from device [MEM0 ]
  die        - stop execution now
  abort      - dump core
Choose one of the actions above: [die]
========================================================================
Bochs is exiting with the following message:
[MEM0 ] ROM: couldn't open ROM image file '/usr/local/share/bochs/bios/BIOS-bochs-latest'.
========================================================================


修改几个地方就可以了:
romimage: file=$BXSHARE/bios/BIOS-bochs-latest, address=0xf0000
修改为:romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
vgaromimage: $BXSHARE/bios/VGABIOS-elpin-2.40
修改为:vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest

在出现的界面login:输入root
就进入系统
表示bochs的安装成功


创建image文件
dd if=/dev/zero of=hdc.img bs=512 count=524160

Bochs 配置文件 bochsrc.bxrc。在 ata0-master 一行下加
入我们的硬盘 Image 文件的配置参数行:
ata0-slave:type=disk, path=hdc.img, cylinders=520, heads=16, spt=63
此处有些不明白,创建的hdc.img是否在/dev/zero路径?path=hdc.img?


     利用 fdisk 命令在 hdc.img 文件中建立 1 个分区。下面是建立第 1 个分区的命令序列。建立另外 3 个
     分区的过程与此相仿。由于 SLS Linux 默认建立的分区类型是支持 MINIX2.0 文件系统的 81 类型
     (Linux/MINIX)  ,因此需要使用 fdisk 的 t 命令把类型修改成 80(Old MINIX)类型。这里请注意,
     我们已经把 hdc.img 挂接成 SLS Linux 系统下的第 2 个硬盘。按照 Linux 0.11 对硬盘的命名规则,该
     硬盘整体的设备名应为/dev/hd5(参见表 14–3)             。但是从 Linux 0.95 版开始硬盘的命名规则已经修改
     成目前使用的规则,因此在 SLS Linux 下第 2 个硬盘整体的设备名称是/dev/hdb。
[/]# fdisk /dev/hdb
Command (m for help): n
Command action
    e   extended
    p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-520): 1
Last cylinder or +size or +sizeM or +sizeK (1-520): +63M
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): L
  0 Empty              8 AIX            75  PC/IX           b8 BSDI swap
  1 DOS 12-bit FAT     9 AIX bootable   80  Old MINIX       c7 Syrinx
  2 XENIX root         a OPUS           81  Linux/MINIX     db CP/M
  3 XENIX user       40 Venix           82  Linux swap      e1 DOS access
  4 DOS 16-bit <32M 51 Novell?          83  Linux extfs     e3 DOS R/O
  5 Extended         52 Microport       93  Amoeba          f2 DOS secondary
  6 DOS 16-bit >=32 63 GNU HURD         94  Amoeba BBT      ff BBT
  7 OS/2 HPFS        64 Novell          b7  BSDI fs
Hex code (type L to list codes): 80
Command (m for help): p
Disk /dev/hdb: 16 heads, 63 sectors, 520 cylinders
Units = cylinders of 1008 * 512 bytes
    Device Boot Begin    Start     End Blocks Id    System
/dev/hdb1            1       1     129 65015+ 80    Old MINIX
Command (m for help):w
The partition table has been altered.
Please reboot before doing anything else.
[/]#

接着重新启动:

    再次进入 SLS Linux 模拟系统后,我们使用 mkfs 命令在刚建立的第 1 个分区上创建 MINIX 文件系
    统。命令与信息如下所示。这里创建了具有 64000 个数据块的分区(一个数据块为 1KB 字节)        。
[/]# mkfs /dev/hdb1 64000
21333 inodes
64000 blocks
Firstdatazone=680 (680)
Zonesize=1024
Maxsize=268966912
[/]#
     至此,我们完成了在 hdc.img 文件的第 1 个分区中创建文件系统的工作。


现在可以开始加载硬盘上的文件系统了。执行下列命令,把新的文件系统加载到/mnt 目录上。
[/usr/root]# cd /
[/]# mount /dev/hd1 /mnt
[/]#

  在加载了硬盘分区上的文件系统之后,我们就可以把软盘上的根文件系统复制到硬盘上去了。请执
行以下命令:
[/]# cd /mnt
[/mnt]# for i in bin dev etc usr tmp
> do
> cp +recursive +verbose /$i $i
done

    此时软盘根文件系统上的所有文件就会被复制到硬盘上的文件系统中。在复制过程中会出现很多类
似下面的信息。
/usr/bin/mv -> usr/bin/mv
/usr/bin/rm -> usr/bin/rm
/usr/bin/rmdir -> usr/bin/rmdir
/usr/bin/tail -> usr/bin/tail
/usr/bin/more -> usr/bin/more
/usr/local -> usr/local
/usr/root -> usr/root
/usr/root/.bash_history -> usr/root/.bash_history
/usr/root/a.out -> usr/root/a.out
/usr/root/hello.c -> usr/root/hello.c
/tmp -> tmp
[/mnt]#
    现在说明你已经在硬盘上建立好了一个基本的根文件系统。你可以在新文件系统中随处查看一下。
然后卸载硬盘文件系统,并键入'logout'或'exit'退出 Linux 0.11 系统。此时会显示如下信息:


[/mnt]# cd /
[/]# umount /dev/hd1
[/]# logout

原创粉丝点击