USB 编程为 MBR 程序
我想知道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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该从/自定义 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.
非常怀疑您是否可以将其放入 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.