Ubuntu Bochs boot.asm 测试

简介: /********************************************************************* * Ubuntu Bochs boot.asm 测试 * 说明: * 本文仅仅是在Ubuntu下通过Bochs验证《自己动手编写操作系统》中的 * Boot Sector(引导区)的汇编代码,算是撘一个测试环境。
/*********************************************************************
 *                   Ubuntu Bochs boot.asm 测试
 * 说明:
 *     本文仅仅是在Ubuntu下通过Bochs验证《自己动手编写操作系统》中的
 * Boot Sector(引导区)的汇编代码,算是撘一个测试环境。
 *
 *                                   2016-7-22 深圳 南山平山村 曾剑锋
 ********************************************************************/

一、参考文档:
    1. ubuntu下bochs安装使用
        http://blog.csdn.net/xnwyd/article/details/7421703
    2. bochs安装一系列问题 
        http://blog.chinaunix.net/uid-23817499-id-3418083.html
    3. 自己动手写操作系统之1:bochs初步使用
        http://blog.csdn.net/zhaodedong/article/details/51082128

二、测试目录文件:
    aplex@aplex:~/os/system$ ls
    a.img  bochsout.txt  boot.asm  boot.bin

三、cat boot.asm
        org 07c00h
        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

四、cat ~/.bochsrc
    ###############################################################
    # Configuration file for Bochs
    ###############################################################
    
    # how much memory the emulated machine will have
    megs: 32
    
    # filename of ROM images
    romimage: file=/usr/share/bochs/BIOS-bochs-latest
    vgaromimage: file=/usr/share/vgabios/vgabios.bin
    
    # what disk images will be used
    floppya: 1_44=a.img, status=inserted
    
    # choose the boot disk.
    boot: floppy
    
    # where do we send log messages?
    log: bochsout.txt
    
    # disable the mouse
    mouse: enabled=0
    
    # enable key mapping, using US layout as default.
    #keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-us.map
    
    display_library: sdl

五、命令运行流程:
    aplex@aplex:~/os/system$ ls
    a.img  bochsout.txt  boot.asm  boot.bin
    aplex@aplex:~/os/system$ nasm boot.asm -o boot.bin 
    aplex@aplex:~/os/system$ bximage 
    ========================================================================
                                    bximage
                      Disk Image Creation Tool for Bochs
            $Id: bximage.c,v 1.34 2009/04/14 09:45:22 sshwarts Exp $
    ========================================================================
    
    Do you want to create a floppy disk image or a hard disk image?
    Please type hd or fd. [hd] fd
    
    Choose the size of floppy disk image to create, in megabytes.
    Please type 0.16, 0.18, 0.32, 0.36, 0.72, 1.2, 1.44, 1.68, 1.72, or 2.88.
     [1.44] 1.44
    I will create a floppy image with
      cyl=80
      heads=2
      sectors per track=18
      total sectors=2880
      total bytes=1474560
    
    What should I name the image?
    [a.img] 
    
    The disk image 'a.img' already exists.  Are you sure you want to replace it?
    Please type yes or no. [no] yes
    
    Writing: [] Done.
    
    I wrote 1474560 bytes to a.img.
    
    The following line should appear in your bochsrc:
      floppya: image="a.img", status=inserted
    aplex@aplex:~/os/system$ dd if=boot.bin of=a.img
    记录了1+0 的读入
    记录了1+0 的写出
    512字节(512 B)已复制,0.00040927 秒,1.3 MB/秒
    aplex@aplex:~/os/system$ bochs
    ========================================================================
                           Bochs x86 Emulator 2.4.6
                 Build from CVS snapshot, on February 22, 2011
                       Compiled at Jun  8 2013, 05:16:04
    ========================================================================
    00000000000i[     ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins'
    00000000000i[     ] BXSHARE not set. using compile time default '/usr/share/bochs'
    00000000000i[     ] reading configuration from /home/aplex/.bochsrc
    00000000000i[     ] lt_dlhandle is 0x378ba30
    00000000000i[PLGIN] loaded plugin libbx_sdl.so
    00000000000i[     ] installing sdl module as the Bochs GUI
    00000000000i[     ] using log file bochsout.txt
    aplex@aplex:~/os/system$ 

六、效果图:

目录
相关文章
|
4月前
|
Ubuntu 测试技术 Linux
dpdk测试环境搭建(vmware下ubuntu环境参考上文汇总流程)
dpdk测试环境搭建(vmware下ubuntu环境参考上文汇总流程)
104 0
|
4月前
|
Ubuntu 数据库 数据安全/隐私保护
百度搜索:蓝易云【ubuntu中编译安装opensips并测试】
以上是在Ubuntu中编译安装OpenSIPS并进行测试的基本步骤。请注意,这是一个简化的指南,实际操作中可能会有一些特定的配置和调整。建议参考OpenSIPS官方文档或其他详细教程以获得更全面和准确的信息。
53 1
|
7月前
|
Ubuntu 编译器 网络安全
RK3568开发笔记(七):在宿主机ubuntu上搭建Qt交叉编译开发环境,编译一个Demo,目标板运行Demo测试
在之前的博文中已经搭建好了一个比较完善的ubuntu宿主机,都很完善了但是发现没有Qt交叉编译开发环境,所以还需要搭建一套Qt交叉编译开发环境。
|
11月前
|
Ubuntu 编译器 Linux
Linux驱动开发笔记(三):基于ubuntu的helloworld驱动源码编写、makefile编写以及驱动编译加载流程测试
前面学习了驱动的基础框架,上一篇编译了gcc7.3.0,那么为了方便很好的熟悉流程,本篇,将使用ubuntu18.04,直接编译ubuntu18.04的驱动,然后做好本篇文章的相关实战测试。
|
Ubuntu 测试技术 数据安全/隐私保护
Ubuntu搭建简单SIP服务器并使用sipdroid测试
Ubuntu搭建简单SIP服务器并使用sipdroid测试
527 0
|
机器学习/深度学习 并行计算 Ubuntu
计算机视觉-图像处理入门(一):linux(ubuntu)配置Openface+测试
计算机视觉-图像处理入门(一):linux(ubuntu)配置Openface+测试
465 0
计算机视觉-图像处理入门(一):linux(ubuntu)配置Openface+测试
|
Ubuntu Linux
Linux驱动开发: Ubuntu(PC机)系统上编译驱动并加载测试
Linux驱动开发: Ubuntu(PC机)系统上编译驱动并加载测试
554 0
|
Ubuntu Shell 开发工具
在Ubuntu下跑通wujian100_open仿真测试
使用Ubuntu系统,下载wujian100_open项目代码、T-Head Tools,跑通仿真测试