
I've looked around the internet a lot and mostly didn't find any working solution apart from trying to make an image/virtualDisk from a raw physical disk (USB). I was basically experimenting with writing simple bootloaders in assembly language, and wanted to rapidly test and make changes to the code without rebooting my system again and again to try booting. The obvious solution is to use a Virtualization tool like VMWare or xVM VirtualBox by Sun (the latter is free), but the trouble is that neither of them support booting from pen-drives and I have long forgotten the existence of floppy drives, and have thus no way of directly writing to a disk and virtual booting straight-away, without creating an new image of the disk each time I make changes to it. So I decided to write to my USB pen-drive directly and try booting from it. It works when I boot the entire computer with it, but VMWare and VirtualBox do not have the option of booting from a USB device.
So messing around xVM VirtualBox 2.0.2 36488 for Windows yesterday, I was pretty surprised to find my USB Pen-Drive listed under the field of Floppies! That is,
a) Create a new Virtual "Machine"
b) Click on the "Floppy" link in the main screen (right panel)
c) Enable "Mount Floppy Drive", and from the drop-down list in "Host Floppy Device", select your USB drive's Drive Letter (haven't tried it in Linux, I guess you'll have to select the correct device like /dev/sdxx)
That's it. Try starting the Virtual Machine now.
Its quite wierd, and I'm still wondering why my USB drive gets listed under floppy, but it works for me! Neither VMWare Workstation, nor xVM VirtualBox permit booting directly from the USB otherwise.
Cheers
Shashank
17 comments:
Great!
I think this method id so good that
we should spread it around our friends
Heh.. thanks! This page now turns up as the first result in a Google search for "boot from USB xVM" (http://www.google.co.in/search?hl=en&hs=iIn&q=boot+from+USB+xVM&btnG=Search) so I guess people who'd be searching for a solution to this problem would reach this destination straight away. :-)
BTW, a comment to this post on my official Sun blog points out that this method doesn't work in the Linux version of xVM. It certainly works in the Windows version, but I'm still looking for a solution in the Linux version of xVM Virtualbox.
Cheers and thanks for the feedback.
Shashank
well shashank you can try Qemu . I use Qemu fulltime , and mostly whenever i want to boot from a Live CD or for reviewing Linux distros ....... Qemu allows you to boot from anything which is a file ( and most of the devices are represented as "special files") ...
And the Assembly language based bootloader ?? , ... any clues to the actual work ??
Yeah thanks man, I just recently downloaded Qemu, yet to try it out. Heard good things about it!
Booting from USB devices is pretty high on my wish-list of features for the Virtual "BIOS" that xVM and VMWare provide.
As for bootloaders in Assembly, its pretty straight-forward making code bootable. Making sophisticated multi-stage bootloaders like GRUB, or even LILO is quite a feat. But making a bootable assembly code that loads your main program written in "C" (which could be your self-written kernel!) is a simple affair.. just about 30 lines of assembly.
Check out: http://hem.passagen.se/danma/nboot.htm
ya i have gone through assembly code based bootstrapping before , ... indeed the best source i have found is the Linux kernel V1.0 source code ( yes the first ever stable release )..... it is easy to understand and elegant !
Hey Shashank
That really great, but i cant get it to work :(
I just get "boot error".
Im trying to boot into Ubuntu from my usb drive. The drive boots fine through the computers BIOS but not through xVMs BIOS. Any thoughts on what the problem could be?
cheers
@hypersonic:
Sorry for the late reply. Are you sure you've mounted the pen drive into the "Floppy" device?
I tried Puppy Linux on my Pen Drive and it seems to be working alright. I don't have any images of Ubuntu with me presently, though I'll try to make one from within Ubuntu onto my Pen drive to check it out.
Cheers
Shashank
@hypersonic:
Oh and BTW, did you try emulating your PenDrive with Qemu? I have a feeling it would work flawlessly there. :-)
~Shashank
Thank you Shashank for the article. Unfortunately this solution didn’t work for me either :-( It throws the error “Boot error” and it stays there.
One thing to note is that when I get the “Boot error” message, I see a significant raise in CPU utilization on the host OS (Windows XP) for the VirtualBox process.
The flash drive is indeed bootable and boots just fine. It’s a pain though to have to restart the computer whenever I make changes to it (trying to make a multi bootable utility flash disk for troubleshooting purposes).
@Tony: Could you tell me the version of xVM that you are using? Have you tried it with the latest xVM version?
Shashank
Hey Shashank,
Sorry for the late reply :(
Good point! I'm testing v2.1.2 of xVM for Windows. I'll try the 2.1.4 which I see is tha latest one.
Thanks! Will post news asap.
I've just tried this with 2.1.4 on three known-working syslinux on FAT16 keys with the same result: Boot error. Selected as Floppy device.
Use case is very similar, I'm making frequent edits to several environments and keeping a device tied up just with reboots is frustrating.
Still, for those who DO have it working, bonus!
Thanks a lot, this was a godsend. Also thanks for the link to the bootstrapper tutorial.
OK I get that "Boot error" error.
i get the boot error also, i tried with your version, and newest and still the same thing :'(
I got around the problem by creating a grub ISO image. See my post http://kunaalblogs.blogspot.com/ (sorry for the shameless plug!)
Post a Comment