首页 > 学院 > 开发设计 > 正文

bochs调试内核的前期准备

2019-11-06 08:30:06
字体:
来源:转载
供稿:网友

用bochs调试启动初期的内核

制作启动iso

其实这个很简单,只要在内核源代码树下执行 make isoimage就可以了。 但是需要记住一点,把ldlinux.c32也拷贝过去。这个是在 IOSLINUX 提到的。 对于5.00版本以上的,就要把ldlinux.32拷贝过去。否则就会在启动中报找不到这个文件。

所以相应的把编译稍稍改变一下。

diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefileindex be8e688..72510fe 100644--- a/arch/x86/boot/Makefile+++ b/arch/x86/boot/Makefile@@ -115,7 +115,7 @@ $(obj)/comPRessed/vmlinux: FORCE FDARGS = # Set this if you want an initrd included with the # bzdisk/fdimage/isoimage kernel-FDINITRD =+FDINITRD = /boot/initrd.img-4.7.0+ image_cmdline = default linux $(FDARGS) $(if $(FDINITRD),initrd=initrd.img,)@@ -174,11 +174,12 @@ isoimage: $(obj)/bzImage if [ -f '$(FDINITRD)' ] ; then / cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; / fi mkisofs -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat / -no-emul-boot -boot-load-size 4 -boot-info-table / $(obj)/isoimage isohybrid $(obj)/image.iso 2>/dev/null || true rm -rf $(obj)/isoimage bzlilo: $(obj)/bzImage if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi

改动了两个地方: 添加了initrd。 看到这么一个补丁patch。

bochs配置文件

################################################################ Configuration file for Bochs###############################################################debugger_log: debugger.log# how much memory the emulated machine will havemegs: 512# filename of ROM imagesromimage: file=/usr/share/bochs/BIOS-bochs-latestvgaromimage: file=/usr/share/vgabios/vgabios.bin# what disk images will be usedata0-master: type=disk, path="fedora.img", mode=flat, cylinders=20317, heads=16, spt=63ata0-slave: type=cdrom, path="image.iso", status=inserted# choose the boot disk.#boot: cboot: cdrom# where do we send log messages?log: bochsout.txt# disable the mousemouse: enabled=0# enable key mapping, using US layout as default.#keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-us.map

0x7c00的断点

好了,这里就和普通的调试一样了。

具体的调试,会在另一篇文章中细说。


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表