FreeDOS Flash Drive

From Gentoo Linux Wiki
Jump to: navigation, search

Almost every BIOS/firmware update needs DOS to work, this article aims to explain how to create a USB flash drive, used to boot on FreeDOS and run those medieval programs. (You will need to have a motherboard BIOS capable of booting from a USB device. Some may also need to enable this option from within their motherboard's BIOS setup screen as well.)

Contents

Requirements

There are several packages you'll need for this, sys-boot/syslinux, which provides various bootloaders (Syslinux, PXELinux, etc.), sys-boot/grub, The GNU GRUB 2 boot loader, sys-apps/util-linux which provides cfdisk(sys-apps/util-linux is part of @system, so you already have this) and last, sys-fs/dosfstools which provides the DOS filesystem tools(mkfs.vfat etc.).

Emerge these packages before continuing:

emerge -av sys-boot/syslinux sys-boot/grub sys-fs/dosfstools

Setup

Partitioning

First thing you need to do is create a partition, let's assume the USB flash drive is /dev/sdb:

cfdisk /dev/sdb

Remove everything, create a primary partition, set its type to 0E(W95 FAT16 (LBA)), mark it bootable, write the partition table and quit.

Formating

Now you can format the partition in FAT16, you can try FAT32 but FAT16 is recommended :

mkdosfs -F16 /dev/sdb1

FreeDOS

There is a nice image of FreeDOS with all you need, you just have to copy a file from it to the partition:

mount /dev/sdb1 /mnt/usb cd /mnt/usb wget http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/unofficial/balder/balder10.img

MBR

Next thing you need to do is make the USB flash drive boot on something, that would be GRUB. You will also need a file from Syslinux to boot FreeDOS.

cd /mnt/usb mkdir grub cp /lib/grub/<your-arch>/* grub/ cp /usr/share/syslinux/memdisk .

A nice configuration for GRUB :

File: /mnt/usb/grub/menu.lst
default=0
timeout=10
root=(hd0,0)
title FreeDOS
        kernel /memdisk
        initrd /balder10.img

And finally, you can install GRUB :

grub grub> device (hd5) /dev/sdb grub> root (hd5,0) grub> setup (hd5) grub> quit
Note: GRUB might give you two "... failed (this is not fatal)" warnings, just ignore them.

Last touch

Now you can copy your BIOS update/whatever to the USB flash drive (/mnt/usb).

Last step:

umount /dev/sdb1

That's it, you can boot on your USB flash drive. Once you are in FreeDOS, your flash drive will be c:\, enjoy...

External links

Old howto upon which this one is based

Alternate method on my blog: Add bootable DOS support to your USB stick

Personal tools