Configuration[edit | edit source]

Creating Custom FreeDOS Image[edit | edit source]

To create your own custom FreeDOS image file (such as creating your own BIOS update boot USB/PXE image):

  1. Get FreeDOS
  2. Get the FreeDOS sys-freedos-linux package
  3. Create an empty file of the desired size
  4. Create a msdos filesystem
  5. Load the FreeDOS boot sector image
  6. Copy the FreeDOS files into the image
  7. Copy any additional files to the image
  8. Unmount
## Download FreeDOS (the floppy image works) and mount it.
# wget fdboot.img
# mount fdboot.img freedos

## Create an file for the image. Eg. 10 MB
# dd if=/dev/zero of=freedos.img bs=1024 count=10240
10240+0 records in
10240+0 records out
10485760 bytes (10 MB) copied, 0.232655 s, 45.1 MB/s

## Make the MSDOS filesystem (vfat)
# mkfs.msdos freedos.img
mkfs.vfat 3.0.9 (31 Jan 2010)

## Load the boot sector to the image, requires nasm
# ./ --disk=freedos.img
DOS boot sector for freedos.img will be created by:
        nasm -o /dev/stdout -dISFAT16  ./bootsecs/boot.asm
Using FAT16. Partn offset 0, CHS *x64x32  Drive 0, (0x0, 0x29),
SerNo 5C9-916A, Strings '           ',  'FAT16   '.
Boot sector successfully updated.

## Mount and copy the FreeDOS system files over
# mount -o loop -t vfat freedos.img /mnt/freedos
# cp -r freedos/* /mnt/freedos

## Copy any other files over such as BIOS updates. Make any other changes 
# cp -r bios_update.exe /mnt/freedos
# vi /mnt/freedos/AUTOEXEC.BAT  # tweak any other settings as required
# vi /mnt/freedos/CONFIG.SYS  # tweak any other settings as required

## Unmount and deploy.
# umount /mnt/freedos

Boot FreeDOS[edit | edit source]

USB[edit | edit source]

Create a USB stick with an MBR.

# fdisk /dev/sdx
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (1-1999, default 1):
Last sector, +sectors or +size{K,M,G,T,P} (1-1999, default 1999):

Created a new partition 1 of type 'Linux' and of size 999.5 KiB.

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk test.bin: 1000 KiB, 1024000 bytes, 2000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xfbc1c6ca

Device     Boot Start   End Sectors   Size Id Type
/dev/sdx   *        1  1999    1999 999.5K  c W95 FAT32 (LBA)

## Install the MBR
# dd conv=notrunc if=/usr/share/syslinux/mbr.bin of=/dev/sdx

## Create the filesystem, use 'mkfs.vfat -F32' for drives larger than 4GB
# mkfs.vfat /dev/sdx1

... for the rest, see

PXE[edit | edit source]

With a custom FreeDOS image created as outlined above, you should be able to PXE boot the image using Syslinux's memdisk.

Assuming that you have all the PXE infrastructure set up (DHCP + TFTP + /tftpboot/pxelinux.cfg), add an entry in the pxelinux.cfg directory containing:

LABEL Dell-BIOS-Update
        MENU LABEL Dell-BIOS-Update
        kernel /images/Dell-BiosUpdate/memdisk
        append initrd=/images/Dell-BiosUpdate/freedos-bios.img

Use the memdisk binary from syslinux.

Dell BIOS updates seem to work only when himem and the emm386 are not loaded. With them loaded, the BIOS update will fail.

My settings for the following files are:




ECHO Welcome to FreeDOS (!

iPXE[edit | edit source]

iPXE enables a more flexible way to PXE boot into FreeDOS by allowing network boot over multiple protocols including http. This reduces the amount of infrastructure required (ie. no need for a dedicated dhcp and tftp server).

For more details, see the IPXE page.

I was able to boot FreeDOS using the following iPXE embedded script. Note the imgargs values; these are required for a successful boot.

dhcp || goto retry_dhcp

echo Booting FreeDOS BIOS Update

kernel tftp://${netX/next-server}/images/Dell9020-BiosUpdate/memdisk
initrd tftp://${netX/next-server}/images/Dell9020-BiosUpdate/freedos-9020-bios.img
imgargs memdisk raw
Boot from HTTP and other protocols
The previoius example uses tftp, but you can easily use http as well as any other supported protocols your iPXE ROM was compiled with.

See Also[edit | edit source]

Gentoo has a guide outlining how to create a custom FreeDOS environment image