I wanted to use GRUB to boot FreeDOS.  (I wanted to use it so that I could
dual-boot FreeDOS and RTEMS, but others may have different reasons.)  It is
a relatively short procedure so I thought I would contribute it to the
mailing list in case others might be interested. I installed FreeDOS in a
VirtualBox virtual machine, but the procedure should work on other
virtual or physical machines. The FreeDOS fdisk does not leave enough space
before the first partition to install GRUB, so I used a Linux SystemRescue
CD (system-rescue.org) to partition the (virtual) disk.  This CD has all of
the tools necessary to partition the drive, format the disk and install
GRUB.

1) In VirtualBox create a new 64-bit Linux machine with a 500 MB vdi-type
drive (FreeDOS.vdi).  Configure the machine to boot off of the SystemRescue
CD image.  (I had to give the machine 2 GB of memory to boot the CD.  The
default 512 MB would not allow the machine to boot.)

2) Boot the new machine and create a new maximum size primary partition on
the virtual drive (/dev/sda).  Change the partition type to 0x0E (a Win95
LBA mapped partition).I use Linux fdisk (enter "fdisk /dev/sda") to do
this, but you can use any of the other disk partitioning tools on the CD
(gparted is a graphical partitioning tool).

3)  Format the new partition by entering "mkfs.msdos   /dev/sda1" (You can
alternately format the partition as part of the FreeDOS installation.)

4) Halt the Linux machine.  (Choose the "Power off the machine" option.)

5) Create a new FreeDOS virtual machine.  Choose to use an existing virtual
hard disk and attach the FreeDOS.vdi disk.  Boot the machine from the
FreeDOS live image.  Choose the "Install to Harddisk" option from the boot
menu.  Install FreeDOS.  You should be able to boot off the harddisk into
FreeDOS at this point.

6) Halt the FreeDOS virtual machine.

7) As part of the installation the FreeDOS master boot loader is
installed.  We need to rewrite this with GRUB, so restart the Linux machine.

8) Mount the new partition using "mount   /dev/sda1   /mnt"

9) Install Grub by entering "grub-install  --boot-directory=/mnt/boot
 /dev/sda"

10) Create a file named "grub.cfg" in the /mnt/boot/grub directory with the
following contents:
menuentry "FreeDOS" {
  insmod chain
  set root=(hd0,1)
  chainloader +1
}

11) Halt the Linux machine.

You should now be able to boot the FreeDOS machine off of the hard disk.
You should see the GRUB boot menu first now.  You can modify the GRUB menu
by editting the grub.cfg file in the C:\boot\grub directory.  You can
delete the Linx machine, but do not delete the files associated with the
machine or you will lose your FreeDOS drive.  You can move the FreeDOS.vdi
file if you want but you will need to play around with the VirtualBox Media
Manager to make it available to FreeDOS after the move.

Tony Richardson
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to