Booting DOS and W98SE from Grub2

Last modified: Sat Dec 14 15:54:32 EST 2019

First, you're going to need a different bootloader to actually boot DOS or W98SE.  You might use the one that came with the OS.  Personally, I like to put LILO in the MBR of the drive with DOS and W98SE on it.  The example lilo.conf is at the end of this page.

Now, you need to chainload that from grub.cfg.  Problem:  the drive mapping keeps changing, MBRs don't have labels or UUIDs, Grub's search command has no option for "get me the drive (NOT the partition)," and if it supports any string mangling functions they aren't documented.

So, I did this as dumb as possible.  Find the W98SE partition, then check each possible value and assign the corresponding device name.  Not even a case statement.  Yuck.

menuentry "DOS / W98SE" {
  search --no-floppy --label --set=root W98SE
  if   [ ${root} = "hd0,msdos1" ]; then
    root="hd0"
  elif [ ${root} = "hd1,msdos1" ]; then
    root="hd1"
  elif [ ${root} = "hd2,msdos1" ]; then
    root="hd2"
  else
    echo "Did not match device; rebooting."
    sleep 5
    reboot
  fi
  chainloader +1
}

If the bootloader is installed in the partition instead of the MBR then the big if statement isn't needed.

Beware that chainloading from Grub2 may disable USB legacy emulation.

lilo.conf

This example is more complex than necessary, but it allows each OS to think that it owns the C: drive while hiding the other vfat partition from it.

lba32
boot = /dev/disk/by-id/ata-HDS722525VLSA80_VN6J3ECFDYLPSD
map = /boot/map
compact
prompt
vga = normal
change-rules
  reset
  type=DOS32
    normal=0x0c
    hidden=0x1c
other = /dev/disk/by-label/W98SE
  label = W98SE
  table = /dev/disk/by-id/ata-HDS722525VLSA80_VN6J3ECFDYLPSD
  boot-as=0x80
  change
    partition=/dev/disk/by-label/W98SE
      set=DOS32_normal
      activate
    partition=/dev/disk/by-label/DOS
      set=DOS32_hidden
      deactivate
other = /dev/disk/by-label/DOS
  label = DOS
  table = /dev/disk/by-id/ata-HDS722525VLSA80_VN6J3ECFDYLPSD
  boot-as=0x80
  change
    partition=/dev/disk/by-label/DOS
      set=DOS32_normal
      activate
    partition=/dev/disk/by-label/W98SE
      set=DOS32_hidden
      deactivate

KB
Home