How to create a bootable DOS disk (flash drive or image file) for BIOS update using DOSBox and FreeDOS on Linux

Amir Yalon

Cadet
Joined
Oct 12, 2016
Messages
9
I have seen others are using Rufus or Unetbootin to create bootable FreeDOS HD images and flash drives. However, Rufus is for Windows and Unetbootin is not in my Linux distribution’s official software channels, so I decided to embark on the adventure of pulling it off with what is available from the Linux distribution (apart from FreeDOS itself, which is not).

At the end, after following all the steps, the bootable BIOS update HD image will be the file named bios.img. On more recent version of the Supermicro BMC/IPMI firmware, the Virtual Media tool can load this file directly as a HD image. For systems that can’t use IPMI or that can only boot from a floppy disk, the image may be written to a physical flash drive: sudo dd if=bios.img of=/dev/sdX (substitute the correct flash drive device path).

Download and unzip FreeDOS floppy disk image

Code:
wget 'https://freedos.org/download/download/FD12FLOPPY.zip'
unzip FD12FLOPPY.zip FLOPPY.img


Create an empty drive image

Code:
bximage -mode=create -hd=20M -imgmode=flat -q bios.img


Note the C/H/S numbers and sector size (in the case of a 20M image as above, CHS=40/16/63, sector size = 512). Later, we will refer to sector size as Z.

In the absence of bximage, the following is equivalent (note the calculation of bs= is H⨯S⨯Z, and count= is C, although any combination of the multiples will yield the same final image size):

Code:
dd if=/dev/zero bs=516096 count=40 of=bios.img


Format the drive image with FreeDOS fdisk

Start DOSBox:

Code:
dosbox


Inside DOSBox:
  1. imgmount 2 bios.img -size 512,63,16,40 -t hdd -fs none (substitute -size Z,S,H,C)
  2. boot FLOPPY.img
  3. See FreeDOS boot up, choose English, then No, to get to a command shell prompt A:>.
  4. fdisk /auto /mbr

Exit DOSBox, since the changes don’t take effect immediately.

Write a bootable filesystem into the image

Start DOSBox:

Code:
dosbox


Inside DOSBox:

  1. imgmount 2 bios.img -size 512,63,16,40 -t hdd -fs none (substitute -size Z,S,H,C)
  2. boot FLOPPY.img
  3. See FreeDOS boot up, choose English, then No, to get to a command shell prompt A:>.
  4. format c: /s
  5. Type YES to confirm the format operation and choose a disk label.
  6. copy \fdsetup\bin\himemx.exe c:\

Exit DOSBox, since FreeDOS doesn’t have access to the host’s current working directory.

Copy the required files into the image

Extract BIOS update (substitute the correct ZIP filename):

Code:
unzip BIOS_V024.zip -d BIOSUPD/


Create a FreeDOS configuration for enabling high memory, in order to avoid the 30 - Error: Problem opening file for reading., that may fail some BIOS updates. (“Cargo culted” a little bit here, copying and adapting bits from the config file on the FreeDOS floppy image without fully understanding everything; there is scarce documentation on the FreeDOS wiki):

Code:
cat > BIOSUPD/fdconfig.sys <<EOF
dos=high,umb
device=\himemx.exe
shellhigh=\command.com /e:2048 /p=autoexec.bat
EOF

touch BIOSUPD/autoexec.bat


Start DOSBox with the directory, where BIOS update files were extracted, mounted as C::

Code:
dosbox BIOSUPD/


Inside DOSBox:

  1. imgmount d bios.img -size 512,63,16,40 (substitute -size Z,S,H,C)
  2. copy c:\*.* d:\

Exit DOSBox. The bios.img file is now ready to boot.
 
Last edited:
Top