linux 0.11 内核调试学习的一点心得
时间:2010-06-11 来源:zhu_jingfei
linux内核完全剖析一书中讲了如何用bochs作为虚拟机运行Linux,感觉bochs运行效率不是很高,占用机器的CPU使用率比较高,单核通常是100%。感觉不是很爽。
后来尝试采用qemu作为虚拟机,进行学习内核。qemu运行效率比较高,并且自带gdbstub,方便内核调试。
具体两个配置文件对比如下,内核软盘镜像和文件系统镜像可以到oldlinux网站上下载。
-------------------------------bochs-----------------------------
###############################################################
# bochsrc.bxrc file for Tinix.
############################################################### #gdbstub: enabled=1, port=1234, text_base=0, data_base=0, bss_base=0 # how much memory the emulated machine will have
megs: 32 # filename of ROM images
romimage: file="D:\Program Files\Bochs-2.3.7\BIOS-bochs-latest"
vgaromimage: file="D:\Program Files\Bochs-2.3.7\VGABIOS-elpin-2.40" # what disk images will be used
floppya: 1_44=boot.img, status=inserted
floppyb: 1_44=rootimage-0.11.img, status=inserted # choose the boot disk.
boot: a # where do we send log messages?
log: bochsout.txt # disable the mouse, since Tinix is text only
mouse: enabled=0 # enable key mapping, using US layout as default.
keyboard_mapping: enabled=1, map="D:\Program Files\Bochs-2.3.7\keymaps\x11-pc-us.map" ---------------------------qemu-------------------------------- qemu.exe -L . -m 32 -fda Boot.img -fdb rootimage-0.11.img -boot a 注:由于文件系统是放置在软驱b中,所以按照linux 0.11的规定,boot.img中的第508和509个字节需要为0x021D,表示从floppy b加载文件系统。
# bochsrc.bxrc file for Tinix.
############################################################### #gdbstub: enabled=1, port=1234, text_base=0, data_base=0, bss_base=0 # how much memory the emulated machine will have
megs: 32 # filename of ROM images
romimage: file="D:\Program Files\Bochs-2.3.7\BIOS-bochs-latest"
vgaromimage: file="D:\Program Files\Bochs-2.3.7\VGABIOS-elpin-2.40" # what disk images will be used
floppya: 1_44=boot.img, status=inserted
floppyb: 1_44=rootimage-0.11.img, status=inserted # choose the boot disk.
boot: a # where do we send log messages?
log: bochsout.txt # disable the mouse, since Tinix is text only
mouse: enabled=0 # enable key mapping, using US layout as default.
keyboard_mapping: enabled=1, map="D:\Program Files\Bochs-2.3.7\keymaps\x11-pc-us.map" ---------------------------qemu-------------------------------- qemu.exe -L . -m 32 -fda Boot.img -fdb rootimage-0.11.img -boot a 注:由于文件系统是放置在软驱b中,所以按照linux 0.11的规定,boot.img中的第508和509个字节需要为0x021D,表示从floppy b加载文件系统。
相关阅读 更多 +