0

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

Ageis
  • 2,221
  • 4
  • 22
  • 34

2 Answers2

1

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.

Rup
  • 33,765
  • 9
  • 83
  • 112
  • How do I know if my bios has it's USB device support exposed as an API? My motherboard is an Asus M4A88TD-V Evo with USB3 support. It's an American Megatrends Inc based motherboard as I get the AMI logo when I disable Asus's custom logo. In the usb section within the bios I found the following line Module version@ 2.24.5-13.4. Although developing my own is harder, it's more native and the footprint ( in terms of parts used I.E no grub) is smaller. Plus I do like a challenge. – Ageis Jul 19 '10 at 21:38
  • Yes, I meant you'd probably have to write grub code to interface with whatever USB device you're intending to use and feed that into the boot logic. USB BIOS API: I've never heard of one, and AFAIK there's no standard API, but I'd be surprised if the BIOS contained USB code for keyboards etc and this wasn't exposed somehow even in an undocumented way. I wouldn't know where to start looking if it's not on Google sorry. – Rup Jul 20 '10 at 00:50
0

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.

Michael Madsen
  • 54,231
  • 8
  • 72
  • 83