标签:style blog color os linux for
第一章
写一个小的引导程序 代码:
1 org 07c00h 2 mov ax,cs 3 mov ds,ax 4 mov es,ax 5 call DispStr 6 jmp $ 7 DispStr: 8 mov ax,BootMessage 9 mov bp,ax 10 mov cx,16 11 mov ax,01301h 12 mov bx,000ch 13 mov dl,0 14 int 10h 15 ret 16 BootMessage: db "Hello, OS World!" 17 times 510-($-$$) db 0 18 dw 0xaa55
用NASM编译
nasm boot.asm -o boot.bin
安装 bochs
安装环境 :
sudo apt-get install build-essential xorg-dev libgtk2.0-dev
在官网下载最新版本 然后安装
./configure --enable-debugger --enable-disasm
make
sudo make install
make的时候提示
/usr/bin/ld: gui/libgui.a(gtk_enh_dbg_osdep.o): undefined reference to symbol ‘pthread_create@@GLIBC_2.1‘ //lib/i386-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [bochs] 错误 1
解决方法
在makefile的libs中添加如下内容 :
-lz -lrt -lm -lpthread
利用bximage生成虚拟软盘,将引导扇区写入虚拟软盘:
dd if=boot.bin of=a.img bs=512 conv=notrunc
配置 bochs 然后启动
############################################################### # Configuration file for Bochs ############################################################### # how much memory the emulated machine will have megs: 32 # filename of ROM images romimage: file=/usr/local/share/bochs/BIOS-bochs-latest vgaromimage: file=/usr/local/share/bochs/VGABIOS-lgpl-latest # 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/local/share/bochs/keymaps/sdl-pc-us.map
在新版bochs中无dump_cpu命令。
标签:style blog color os linux for
原文地址:http://www.cnblogs.com/Cnforce/p/3818287.html