安裝
從http://bochs.sourceforge.net/下載
./configure --with-all-libs --enable-vbe --enable-debugger
make
make install
#需要聲卡加--enable-sb16,需要網(wǎng)卡加--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
出現(xiàn)問題:
========================================================================
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
在出現(xiàn)的界面login:輸入root
就進入系統(tǒng)
表示bochs的安裝成功
創(chuàng)建image文件
dd if=/dev/zero of=hdc.img bs=512 count=524160
Bochs 配置文件 bochsrc.bxrc。在 ata0-master 一行下加
入我們的硬盤 Image 文件的配置參數(shù)行:
ata0-slave:type=disk, path=hdc.img, cylinders=520, heads=16, spt=63
此處有些不明白,創(chuàng)建的hdc.img是否在/dev/zero路徑?path=hdc.img?
利用 fdisk 命令在 hdc.img 文件中建立 1 個分區(qū)。下面是建立第 1 個分區(qū)的命令序列。建立另外 3 個
分區(qū)的過程與此相仿。由于 SLS Linux 默認建立的分區(qū)類型是支持 MINIX2.0 文件系統(tǒng)的 81 類型
(Linux/MINIX) ,因此需要使用 fdisk 的 t 命令把類型修改成 80(Old MINIX)類型。這里請注意,
我們已經(jīng)把 hdc.img 掛接成 SLS Linux 系統(tǒng)下的第 2 個硬盤。按照 Linux 0.11 對硬盤的命名規(guī)則,該
硬盤整體的設備名應為/dev/hd5(參見表 14–3) 。但是從 Linux 0.95 版開始硬盤的命名規(guī)則已經(jīng)修改
成目前使用的規(guī)則,因此在 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 模擬系統(tǒng)后,我們使用 mkfs 命令在剛建立的第 1 個分區(qū)上創(chuàng)建 MINIX 文件系
統(tǒng)。命令與信息如下所示。這里創(chuàng)建了具有 64000 個數(shù)據(jù)塊的分區(qū)(一個數(shù)據(jù)塊為 1KB 字節(jié)) 。
[/]# mkfs /dev/hdb1 64000
21333 inodes
64000 blocks
Firstdatazone=680 (680)
Zonesize=1024
Maxsize=268966912
[/]#
至此,我們完成了在 hdc.img 文件的第 1 個分區(qū)中創(chuàng)建文件系統(tǒng)的工作。
現(xiàn)在可以開始加載硬盤上的文件系統(tǒng)了。執(zhí)行下列命令,把新的文件系統(tǒng)加載到/mnt 目錄上。
[/usr/root]# cd /
[/]# mount /dev/hd1 /mnt
[/]#
在加載了硬盤分區(qū)上的文件系統(tǒng)之后,我們就可以把軟盤上的根文件系統(tǒng)復制到硬盤上去了。請執(zhí)
行以下命令:
[/]# cd /mnt
[/mnt]# for i in bin dev etc usr tmp
> do
> cp +recursive +verbose /$i $i
done
此時軟盤根文件系統(tǒng)上的所有文件就會被復制到硬盤上的文件系統(tǒng)中。在復制過程中會出現(xiàn)很多類
似下面的信息。
/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]#
現(xiàn)在說明你已經(jīng)在硬盤上建立好了一個基本的根文件系統(tǒng)。你可以在新文件系統(tǒng)中隨處查看一下。
然后卸載硬盤文件系統(tǒng),并鍵入'logout'或'exit'退出 Linux 0.11 系統(tǒng)。此時會顯示如下信息:
[/mnt]# cd /
[/]# umount /dev/hd1
[/]# logout?
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請
點擊舉報。