配置环境:

Ubuntu 12.10+ Bochs 2.6+ NASM

安装NASM:

sudo aptitude install nasm

bochs2.6下载地址:http://sourceforge.net/projects/bochs/

安装bochs2.6:

sudo apt-get install build-essential xorg-dev libgtk2.0-dev

//没有先安装这些,在安装bochs2.6时会报错

进入到bochs文件夹里面运行下列命令:
$ ./configure --enable-debugger --enable-disasm
$ make
$ sudo make install

安装Bochs时,出现错误”install: cannot stat `./bochsdbg': No such file or directory“

          Solution:将源文件中bochs的文件夹名称改为bochsdbg即可。

至此所有环境配置完成

以最简单的Hello OS的boot为例

;%define    _BOOT_DEBUG_
%ifdef _BOOT_DEBUG_
    org 0100h
%else
    org 07c00h
%endif

    mov ax, cs
    mov ds, ax
    mov es, ax
    call    DispStr
    jmp $
DispStr:
    mov ax, BootMessage
    mov bp, ax
    mov cx, 16
    mov ax, 01301h
    mov bx, 000ch
    mov dl, 0
    int 10h
    ret
BootMessage: db "Hello, OS world"
times 510-($-$$) db 0
dw 0xaa55

运行nasm -o boot.bin boot.asm

创建a.img:

在Terminal中输入bximage根据提示建立一个a.img

往a.img中写boot.bin:

dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc

建立bochsrc文件:

#display_library: sdl
#display_library: sdl
romimage: file=/usr/share/bochs/BIOS-bochs-latest
megs: 32
vgaromimage: file=/usr/share/vgabios/vgabios.bin
floppya: 1_44=Tinix.img, status=inserted

boot: a

mouse: enabled=0

运行下列命令:bochs -q -f bochsrc

Linux中配置bochs

一些实用的调试命令:

Linux中配置bochs

 

转载于:https://www.cnblogs.com/starlitnext/archive/2013/03/28/2986139.html

相关文章:

  • 2021-08-30
  • 2021-12-23
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-02-17
  • 2021-08-04
  • 2022-12-23
猜你喜欢
  • 2021-05-20
  • 2021-11-29
  • 2021-04-20
  • 2021-10-14
  • 2021-12-10
相关资源
相似解决方案