开发内核并在虚拟机中对其进行测试 [英] Developing kernels and testing them in virtual machines

查看:99
本文介绍了开发内核并在虚拟机中对其进行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢编程方面的挑战,编写内核似乎是编程方面的挑战.

I like programming challenges, and writing a kernel seems a programming challenge.

不幸的是,内核特别难以测试,因为它们基本上是操作系统的核心,因此不能轻易地在操作系统之上运行.

Unfortunately, kernels are particularly hard to test because they are basically the core of operating systems and so they can't be easily ran on top of an operating system.

但是,我知道可以模拟计算机硬件的称为虚拟机的应用程序.

However, I know about applications called Virtual Machines that can emulate computer hardware.

使用虚拟机开发和测试内核(C + Assembly)的最简单/最佳方法是什么?

What is the easiest/best way to develop and test kernels(C+Assembly) using Virtual Machines?

推荐答案

虽然BOCHS可以更好地让您知道您的宠物OS出现什么严重错误时,但是它非常好!当事情变得模糊时,我使用VirtualPC进行通用测试和BOCHS.

While BOCHS seems to be better at letting you know when something goes horribly wrong with your pet OS... it is very slooooow! I use VirtualPC for general purpose testing and BOCHS when things get murky.

此外,您很有可能每2分钟启动一次操作系统,因此采用某种自动化的方式来构建启动映像会很有帮助&关闭Virtual PC.

Also, you will more than likely be booting the OS every 2 minutes, so it helps to have some sort of automated way to build a boot image & fire off the Virtual PC.

我用所有必要的东西构建了GRUB引导软盘映像,以使其从根目录启动Kernel.Bin.我使用批处理文件将此文件复制到虚拟项目目录,请使用 FAT图像生成器将我的内核复制到映像.然后,只需启动VirtualPC项目.哇!

I built a GRUB boot floppy image with all the necessary stuff to get it to boot the Kernel.Bin from the root. I use a batch file to copy this file to the virtual project directory, use FAT Image Generator to copy my kernel to the image. Then just launch the VirtualPC project. Vola!

批处理文件摘录:

Excerpt from my batch file:

COPY Images\Base.vfd Images\Boot.vfd /Y
fat_imgen.exe modify Images\Boot.vfd -f Source\Bin\KERNEL.BIN
COPY Images\Boot.vfd Emulators\VirtualPC\ /Y
START Emulators\VirtualPC\MyOS.vmc

最后一个建议:将VirtualPC进程优先级设置为低-请相信我! 我很乐意交换一些代码!

One last suggestion: Set the VirtualPC process priority to low - trust me on this one! I'd be happy to exchange some code!

工具: DGJPP,NASM,GRUB.
代码: osdev.org,osdever.net

Tools: DGJPP, NASM, GRUB.
Code: osdev.org, osdever.net

这篇关于开发内核并在虚拟机中对其进行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆