Tuesday, January 06, 2009

Bootable USB flash drive creation under Linux

There are three main ways to update BIOS on ASUS EeePC:
  1. Use biosupdate.pl script under Xandros OS (Add/Remove software using it too)
  2. Use EZ-Flash (Alt-F2 under BIOS itself)
  3. Use 'afudos' under DOS by bootable USB flash disk (drive)
The first method is risky. Do any BIOS updates under running operating system is dangerous. And you can't save the old BIOS into file before update. The second method is simple, but risky too. You must to have FAT16 USB flash drive, and based on my experience sometimes you can get 'Failed to flash!' or completely destroy file system on this drive. In addition you can't save the old BIOS too.

I prefer the third method as more professional way. You get full control of this process and can save old BIOS into file on this flash. For this you need to create the bootable USB flash drive. We'll use the Linux system to create this. There are many ways to create this. I give you here my own. Will use GRUB as boot manager for this flash.

Lets take USB flash disk >100Mb, but not too big below 4Gb.
First of all you must to create a partition, my usb flash drive is /dev/sdb :
# cfdisk /dev/sdb
Clear everything, create a primary partition, set its type to 0E (W95 FAT16 (LBA)), mark it bootable, write the partition table and quit.
Format the partition in FAT16, you may try FAT32 but FAT16 is recommended :
# mkdosfs -F16 /dev/sdb1
Download the FreeDOS images and unzip them if necessary. You can chose 'ODIN' or 'BALDER'. Depend of this edit menu.lst if necessary. You can get 'ODIN' from HERE or 'BALDER' from HERE as replacement of 'ODIN'.
Install 'syslinux' and get memdisk from there. And take menu.lst file from HERE for 'BULDER'.

Drop the files onto your flash in '/': balder10.img, memdisk; create '/boot/grub' folder and drop there these files from your GRUB host Linux system: stage1, stage2, menu.lst

And finally, you must install GRUB on your flash. Be careful with name of device, cause you can destroy your Linux host system by this. This is most dangerous commands:
# grub
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
Now you can copy your 'afudos' BIOS utility and ROMs to the USB flash drive.
Once you are in FreeDOS, your flash drive will be c:\, enjoy...
To test USB boot is possible via QEMU (see above).
Comments are welcome ☺

1 comment:

Unknown said...

everything seemed ok but turns out this way is only for installing… if the author could kindly provide us with a working solution to get it running from flash i would be grateful… not just installing through USB i want to install TO THE USB Flash Memory!
Linux Flash Drive