如何以编程方式创建可启动 CD?

发布于 2024-07-11 01:28:10 字数 439 浏览 19 评论 0原文

我正在使用准系统教程作为我正在开发的操作系统的基础,它似乎是一个较旧的教程:它将内核编译为软盘映像,然后使用 GRUB 加载它。

基本上,我仍然想使用 GRUB,但我想让我的操作系统从 CD 运行。 主要原因是我实际上没有可用的真正软盘驱动器(我目前正在 VirtualBox 中进行测试),因此我无法在真实硬件上测试我的操作系统。

我一直在网上闲逛,我可以找到很多从软盘映像创建可启动 CD 的实用程序,但这些似乎都需要一个实际的软盘驱动器,而且这并不是我真正想要的。 我希望能够在理想情况下在制作步骤中最终获得一张可启动 CD,而不需要首先将映像放在软盘上,这似乎毫无意义。

我想回答这个问题的简单方法是:如何设置 GRUB 从 CD 读取内核映像? 我需要一个特殊的实用程序才能在 Windows 中执行此操作吗? (内核还不能自行编译,这不会很长一段时间)

谢谢!

I'm using a barebones tutorial as the basis for an OS I'm working on, and it seems to be an older tutorial: it has be compiling the kernel down to a floppy image, and then loading it with GRUB.

Basically, I still want to use GRUB, but I'd like to have my OS run from a CD instead. The main reason is that I don't actually have a real floppy drive available (I'm testing in VirtualBox currently) and I thus have no way to test my OS on real hardware.

I've been poking around on the net, and I can find lots of utilities that create a bootable CD from a floppy image, but these all seem to require an actual floppy drive, plus it's not really what I'm looking for. I'd like to be able to end up with a bootable CD during my make step ideally, without needing to first place the image on a floppy, which seems rather pointless.

I guess the easy way to answer this: How do I set up GRUB to read my kernel image from a CD? Will I need a special utility to do this from Windows? (The kernel can't compile itself yet, that's not for a looong while)

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

妳是的陽光 2024-07-18 01:28:10

我根据 OSdev 人员的一些建议,自己找到了适合我的项目的解决方案。 有一个名为 mkisofs 的实用程序(可以使用 cygwin dll 在 Windows 下运行),它获取一个目录,并将该目录制作成可以刻录到 CD 的 ISO 映像。 使用 -b 标志,您可以指定哪个文件应驻留在磁盘的引导扇区中。

解决方案就是将 GRUB 放在引导扇区中,并使用 GRUB 加载内核映像,我可以轻松地将其编译为非软盘形式。

I found the solution for my project on my own, with some advice from the folks over at OSdev. There is a utility called mkisofs (which can run under Windows using a cygwin dll) that takes a directory, and makes that directory into an ISO image that can be burned to a CD. Using the -b flag, you can specify which file should reside in the boot sector of the disk.

The solution is just to have GRUB in the bootsector, and use GRUB to load the kernel image, which I can compile out in non-floppy form easily.

满地尘埃落定 2024-07-18 01:28:10

据我所知,可启动 CD 与可启动软盘几乎相同。 您需要将引导加载程序(GRUB)放入引导扇区等,BIOS 将处理低级内容,直到您切换到保护模式。

您可能需要制作映像,然后将其添加到实际的物理磁盘。

以下是 El Torito 可启动 CD 规格:
http://www.phoenix.com /NR/rdonlyres/98D3219C-9CC9-4DF5-B496-A286D893E36A/0/specscdrom.pdf

编辑:测试内核的另一种方法是使用可启动的 USB 记忆棒。 同样,BIOS 将处理低级 USB 内容,直到您打开 A20 并跳转到保护模式。

AFAIK a bootable CD is pretty much the same as a bootable floppy. You need to put the boot loader (GRUB) into the boot sector etc., the BIOS will take care of the low level stuff until you switch to protected mode.

You will probably have to make your image and then dd it to the actual physical disk.

Here's the El Torito Bootable CD specification:
http://www.phoenix.com/NR/rdonlyres/98D3219C-9CC9-4DF5-B496-A286D893E36A/0/specscdrom.pdf

EDIT: An alternative way to test your kernel would be a bootable USB stick. Again, the BIOS will take care of the low level USB stuff until you turn on A20 and jump to protected mode.

抠脚大汉 2024-07-18 01:28:10

如果您有兴趣查看代码,那么 Moblin Image Creator 是可能是一个值得检查的好应用程序。 它是用 python 编写的,可以为 Moblin Linux 的实时配置和可安装配置创建不同类型的可启动映像(CD、USB 和 NAND)。

If you're interested in looking at code, then the Moblin Image Creator is probably a good application to check out. It's written in python and can create different types of bootable images (CD, USB and NAND) for both Live and installable configurations of Moblin Linux.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文