博客
关于我
Minimum operating system with QEMU, but no debug
阅读量:579 次
发布时间:2019-03-10

本文共 2991 字,大约阅读时间需要 9 分钟。

1.Envirment:

(see appendix Envriment create)

2.source

; 文件名 boot.asm org 7c00h                     ; BIOS读入MBR后,从0x7c00h处开始执行 ; 下面部分和10h有关中断,10h中断用来显示字符mov ax, csmov es, axmov ax, msgmov bp, ax                    ; ES:BP表示显示字符串的地址mov cx, msgLen                ; CX存字符长度mov ax, 1301h                 ; AH=13h表示向TTY显示字符,AL=01h表示显示方式(字符串是否包含显示属性,01h表示不包含)mov bx, 000fh                 ; BH=00h表示页号,BL=0fh表示颜色mov dl, 0                     ; 列int 10h  msg: db "hello world, welcome to OS!"msgLen: equ $ - msg           ; 字符串长度times 510 - ($ - $$) db 0     ; 填充剩余部分dw 0aa55h                     ; 魔数,必须有这两个字节BIOS才确认是MBR

3.Compile

If till not install nasm, should install first.

nasm install on ubuntu

1.Download source code:

2.tar zxvf nasm-2.10.07.tar.gz

进入刚解压的目录

然后执行命令:./configure

make

sudo make install

NOTE: Using "apt install nasm" to install is failled.

nasm usage

If only want to run without debugging, only input bellow:

# nasm boot.asm -o boot.bin

If want gdb can regcnise the format, should do more, convert it into ELF file format.

# nasm -f elf -g boot.asm -o boot.o

# gcc -c boot.o -o boot

If the gcc is bit32, should install some lib, as bellow:

sudo apt-get install g++-multilib libc6-dev-i386

then

# gcc boot.o -o boot -m32

 

4.Command line Debug

NOTE: Must copy the linux 0.11 project to windows disk, cannot in samba server, or not can't debug.

QEMU version: Download latest version from official site.

Input command:

"C:\Program Files\qemu\qemu-system-x86_64.exe" boot.bin"C:\Program Files\qemu\qemu-system-x86_64.exe" -m 16M -boot a -fda boot.bin -s -S

-s              wait gdb connection to port 1234

'-S' means freeze CPU at startup (Can be remove to run directly), so you can debug step byt step.

After input the command, the linux 0.11 would be running succe

 

Open other cmd windows, then input:

F:\Linux-0.11-master>gdb Image

(gdb) target remote localhost:1234

(gdb) b *0x7c00

(gdb)c

(gdb)x /16b 0x7df0 //观察0x7DFE和0x7DFF的值是否为0x55,0xAA

(gdb)

Then you would see the linux 0.11 is running successfully.

Can using "Ctrl+C" to stop running.

 

Appendix 1 Envriment create

1.VM-Envriment:windown 7, vmware(ubuntu-18.04.1-live-server-amd64.iso), SecureCRT(ssh remote ubuntu), samba-server(see appendix samba-server create).

2.Destnation-machine: QEMU(download from official site),

3.Debug-method: TDMGCC(Using its GDB in command line debug).

 

Appendix 2 samba-server create

1 首先确认网络可以相互ping通。

2 终端输入:apt-get install samba

3 先备份 smb.conf 编辑配置,终端输入:

cd /etc/samba/  

ls

cp smb.conf smb.conf-201x-xx-xx

4 nano /etc/samba/smb.conf 编辑配置文件

  1. 找到[homes]browseable = no, 把no 改成 yes, 因为只有这样,windows下才能通 过“计算机”看到“homes”共享目录。----至此,您已经能看到samba共享的目录了。
  2. 当然,以方便调试为目的,所以我们不需要共享homes文件,而是要共享整个根目录。 所以在[homes]这一段下加入一段,不要在[homes]这一段改,否则出错,一定要在下面加,如下:

[all]

comment = /

path = /

read only = no

接着在终端输入:testparm 此命令不但能检查参数是否正确,还能使配置立即生效, 不需要重启。

5 还要创建用户,不然只能看到有共享却无法登录。在终端输入:

smbpasswd -a root 然后就会提示输入密码,其实这个名字可以任意,这里用root是为 了方便记忆,因为我会用最高权限。----到这一步,你就可以登录到samba共享文件里 了。

6 (可以不要这一步)重启samba,终端输入: /etc/init.d/samba restart

 

 

 

 

 

你可能感兴趣的文章
MySQL“被动”性能优化汇总
查看>>
MySQL、HBase 和 Elasticsearch:特点与区别详解
查看>>
MySQL、Redis高频面试题汇总
查看>>
MYSQL、SQL Server、Oracle数据库排序空值null问题及其解决办法
查看>>
mysql一个字段为空时使用另一个字段排序
查看>>
MySQL一个表A中多个字段关联了表B的ID,如何关联查询?
查看>>
MYSQL一直显示正在启动
查看>>
MySQL一站到底!华为首发MySQL进阶宝典,基础+优化+源码+架构+实战五飞
查看>>
MySQL万字总结!超详细!
查看>>
Mysql下载以及安装(新手入门,超详细)
查看>>
MySQL不会性能调优?看看这份清华架构师编写的MySQL性能优化手册吧
查看>>
MySQL不同字符集及排序规则详解:业务场景下的最佳选
查看>>
Mysql不同官方版本对比
查看>>
MySQL与Informix数据库中的同义表创建:深入解析与比较
查看>>
mysql与mem_细说 MySQL 之 MEM_ROOT
查看>>
MySQL与Oracle的数据迁移注意事项,另附转换工具链接
查看>>
mysql丢失更新问题
查看>>
MySQL两千万数据优化&迁移
查看>>
MySql中 delimiter 详解
查看>>
MYSQL中 find_in_set() 函数用法详解
查看>>