Wednesday, June 4, 2008

Make a bootable USB disk with FreeDOS and VirtualBox

I was working on a friend's computer which needed a BIOS update. In it's infinite wisdom, the manufacturer provided update files which consume more space than can fit on a conventional 1.44MB floppy. Furthermore, the computer is a laptop without a floppy drive, like most laptops these days. How did I solve this problem? I'll skip all of the horrible, gory details of the 500 things that I tried that did not work, including the several dozen attempts at making either a USB bootable HDD or getting my 512MB USB key fob to work. The last approach I tried was to use a FreeDOS boot disk and copy it to the flash device: zcat /usr/share/dosbootdisk/floppy.gz > /dev/sdb This worked, but the "floppy" still only appeared to be 1.44MB. I tried a few things to enlarge it but eventually gave up. Riding this partial success, I took a different approach. I acquired from the FreeDOS project the smallest (about 8MB) bootable ISO, and using VirtualBox (the OSE edition) I created a virtual machine with a 200MB hard disk, and configured it to boot the ISO. After booting, I used the ISO to partition and format the virtual hard disk and perform a basic installation. Then I shut the virtual machine down. Then I used *vditool* to convert the virtual hard disk from the .vdi format to one suitable for using with dd: vditool copydd .VirtualBox/VDI//NewHardDisk1.vdi freedos_usb.img As root, I copied the freedos_usb.img file to /dev/sdb: cat freedos_usb.img > /dev/sdb; sync; sync; sync I ejected and re-inserted the USB key fob which caused it to be mounted under /media/NewDisk or some such, and I simply copied the BIOS updating files to a new bios/ subdirectory. After ejecting the device, I inserted it into the other machine and turned it on. Pressing F12 lets me choose another boot device, and the 'USB-HDD' showed up, as it had done before. This time, however, it booted perfectly and I was able to update the BIOS quite easily. The BIOS update did not resolve the issue I was having, but I learned quite a bit and will save this image somewhere, I'm sure it will come in handy again someday. In short:
  1. obtain FreeDOS bootable ISO (the small 8MB image is just fine)
  2. use VirtualBox (you could probably use other emulation software, of course) to create a machine with a virtual hard drive, anything from 5MB to a few hundred MB.
  3. boot the FreeDOS ISO, partition and install FreeDOS to the new virtual hard drive
  4. convert the virtual hard drive to a suitable format for 'dd'
  5. copy the image to a USB key fob, and force it to be rescanned (eject and re-insert it)
  6. copy the additional contents you desire to the newly mounted DOS partition
  7. eject and use the key fob
On a side note, why should I have to go to acer-europe to get a BIOS update? Are the consumer protection laws in the EU that much better than in the US?

2 comments:

Christopher Morris said...

This is an excellent idea.

I have (had) a very similar problem. Basically I just needed a bootable USB flash drive so that I could install some driver software...

I've been down the road of having tried 500 different ways to make a bootable flash drive. None of them worked (or more accurately -- can not be done due to my lack of access to OS images and or a big-enough flash drive.)

I stumbled across your post and thought, "Of course! That's brilliant. Why didn't I think about that?" (Note: I too am a middle aged IT expert. No, I'm not bragging about 'expert' -- but I've really been around the block a few thousand times and I generally know what I'm doing.)

Thanks so much for taking time to document your journey.

Jon said...

I moderate all comments via the blogger platform. I haven't received any spam, yet.