USB 编程为 MBR 程序

发布于 2024-09-10 15:35:43 字数 75 浏览 3 评论 0原文

我想知道MBR是否可以从USB端口读取数据?

我希望它根据从 USB 端口读取的值来加载 Windows 或 Linux

I was wondering if it's possible for the MBR to read data from the USB port?

I'm wanting it to load windows or linux depending on the value it's read from the usb port

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

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

发布评论

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

评论(2

机场等船 2024-09-17 15:35:43

您应该从/自定义 GRUB 开始。就目前情况而言,在 MBR 中,您的设备支持非常少,因此您要么必须编写自己的代码,要么尝试构建 BIOS 的 USB 设备支持(如果该支持作为 API 公开)。

GRUB 具有内置 OHCI 和 UHCI USB 驱动程序 http://grub.enbug.org/USBSupport 。我怀疑它会完全按照您想要的开箱即用的方式进行,但定制它会比从头开始更容易。

You should start with / customise GRUB. As it stands, in the MBR you have very little device support so you'll either have to code your own or try and build on your BIOS's USB device support if that's exposed as an API.

GRUB has built-in OHCI and UHCI USB drivers http://grub.enbug.org/USBSupport . I doubt it'll do exactly what you want out-of-the-box but it'll be easier to customise that rather than start from scratch.

仅此而已 2024-09-17 15:35:43

非常怀疑您是否可以将其放入 512 字节 MBR 本身,但没有技术原因不能这样做 - 您只需要引导一个可以读取该值的迷你操作系统,然后充当一条链加载程序来启动正确操作系统的引导加载程序:GRUB 和 Vista 引导加载程序都能够链式加载到另一个,因此您没有理由不能执行相同的操作。

话虽如此,但笔者认为,迷你操作系统很可能带来的麻烦大于它的价值。定制现有的引导加载程序(例如 GRUB)可能是您最好的选择。

It's highly doubtful that you can fit it into the 512-byte MBR itself, but there's no technical reason it can't be done otherwise - you just need to bootstrap a mini-OS which can read the value, and then act as a chain loader to start the boot loader of the right OS: both GRUB and the Vista bootloader is capable of chain loading to the other, so there's no reason you couldn't do the same.

Having said that, writing said mini-OS could very well prove to be more trouble than it's worth. Customizing an existing bootloader like GRUB is probably your best bet.

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