First post, by RJDog
From my blog post http://retropcbuilder.blogspot.ca/2016/11/dua … ows-31-and.html I thought this might be useful to other Vogon'ers.
Background
As mentioned in my previous post about software selection, I classify my childhood PC gaming into two eras, and thats just based on my own personal experience having a DOS-based 486 machine followed by a Windows 98 Pentium-II machine. The Retro PC I built is squarely inbetween these two eras of computing (as mentioned before, this is quite on purpose), so I would like to dual boot MS-DOS 6.22 to provide the genuine DOS experience I remember, and Windows 95 which is the period-correct OS for the machine. I knew before I even started building the PC that I would want to do this, so I researched some options to perform the task.
Boot Manager Options
V-Com System Commander is the defacto period-correct option; it was apparently quite popular in the mid '90s for dual- or multi-booting many PC variants... DOS, Win9x, WinNT... I think it also supported OS/2, Linux, etc. Perusing Computer Gaming World magazines you can even find full-page ads. I found a copy of System Commander Deluxe online, however it requires a serial number to install, so my efforts on that front were fruitless.
I also found a piece of software called GRUB4DOS, which is a recent project (so obviously not strictly period correct) but sounds very promising in features and intended use for booting DOS and DOS-based variants such as Windows 95, 98, etc.. It does also support booting Windows NT, OS/2 and Linux, but I'm less interested in that functionality.
There's also PowerQuest BootMagic, but... I don't remember why I discounted it.
GRUB4DOS
GRUB4DOS is distributed in a couple of different execution forms; one form of which you can install into the MBR and it will load itself, find its config file by searching through partitions in order (i.e. first partition it finds with a menu.lst config file is the one it uses) and present the user with a menu, if appropriate, before continuing to boot as defined in the config file. This is not unlike many other boot managers. The other form that GRUB4DOS comes in is a DOS executable... a real-mode program that is run from inside DOS to initialize the boot manager. Neat, eh? This is the one that I've chosen to use and will focus on here.
This kind of makes it sound like that GRUB4DOS could be invoked at any time from within DOS, and I thought that too, but that's not exactly true. GRUN4DOS really does not get along well with pretty much any other TSR or driver that DOS might load (especially EMM386), so it needs to be called first thing, typically as the first line in config.sys, ie. DEVICE=C:\GRUB.EXE. What this does is cause your system to boot DOS as it normally would, then as DOS gets to loading drivers in config.sys, GRUB4DOS is invoked and the user can make their boot selection. Grub can be instructed (in the menu.lst config file) to either boot or chainload another operating system, partition, or harddisk, or simply quit and allow the DOS system that booted and invoked GRUB to continue booting like normal.
Intended Operation
As I've chosen to not install GRUB4DOS in the MBR (or, in my case since I'm using a DDO, into the "MBR" that the DDO software will boot after loading), the tactic that I will be using is to have an instance of grub.exe and menu.lst on the MS-DOS 6.22 partition which will be invoked by DOS' config.sys, and another instance of grub.exe and menu.lst on the Windows 95 partition which will be invoked by the config.sys of Windows 95. This means that I'll actually have two separate menu.lst config files which are used depending on which OS is booted first.. .which could be good or bad.
To make matters a little more complicated, DOS and DOS-based variants (i.e. Win9x) really like being installed on C: -- which is the first DOS-formatted primary partition. In fact, they really don't work at all not being installed on C:. Windows 95 and onward do have some limited built-in facilities to operate a dual-boot environment (if you did an upgrade install, for example), but in that case both old and new operating systems occupy the same space on the same partition. There are several guides online about how to accomplish this with MS-DOS 6.22 and Windows 95, but this is obviously pretty messy and I would like to avoid having both operating systems and their configuration and programs installed on the same partition, if only for my own sanity. Conveniently, GRUB4DOS (and other boot managers like System Commander, Boot Magic, etc.) has a method to which it can "hide" and "unhide" DOS (FAT) partitions on a disk. Essentially, when I want to boot MS-DOS 6.22, the partition that it's on is set to "unhide" and the Windows 95 partition is set to "hide"; conversely when I want to boot Windows 95, the Windows 95 partition is set to "unhide" and the DOS partition is set to "hide". This satisfies the "C: is the first DOS-formatted primary partition" because the hidden partition, even if it's the first partition, does not appear to the OS to be a valid DOS-formatted partition, so just skips over it and the next "unhidden" partition is taken to be C:.
This operation does mean, however, that one OS will not see the other OS' partition, so to share files/games/etc. between the two, I will need a third partition that both can see.
Installing a Second OS
The system has already has MS-DOS 6.22 installed on it from when I set up the new harddisk with Maxtor's MaxBlast OnTrack DDO... I set up a 2GB primary partition formatted as FAT16 for DOS, a 2GB primary partition formatted as FAT32 for Windows 95, a 2GB extended partition formatted as FAT16 to be the drive that DOS games are installed on and to be the partition that both DOS and Windows 95 can see, and the remainder of the drive (~32GB) as an extended partition formatted as FAT32 to install Windows 95 games on. DOS, of course, can't read FAT32, so they might as well be hidden from DOS... but we'll make them actually hidden.
To make this easier on myself, I made a bootable floppy with grub.exe on it, with no config.sys or autoexec.bat so that nothing gets loaded and I have no trouble loading GRUB if I need to. I also created a menu.lst with the following contents:
title Commandline
commandline
This will just present one menu option which will give GRUB4DOS's internal command prompt so you can type in config items manually. Really, you probably don't need to create the boot disk, you just need to have grub.exe available to both OS's (for example, copied on the shared 2GB FAT16 partition), but it makes me feel a little safer, and the below steps assume the use of it.
So, essentially the idea is to perform the appropriate hide/unhide (although all partitions are "unhidden" at this point) operations on the partitions, and then boot the CD or floppy to install the second OS.
Load grub from the boot floppy, and enter the following commands (assuming your new OS will be installed from CD):
hide (hd0,0)
unhide (hd0,1)
rootnoverify (hd0,1)
setactive
cdrom --init
map --hook
chainloader (cd0)
boot
So, this will hide (hd0,0), which is the first drive, first partition (zero-based indexes); unhide (hd0,1), the first drive, second partition; set the second partition as the root partition (for GRUB's benefit); set the partition as the active bootable partition (for the new OS's benefit); then hook in the CD code and then boot the CD. Alternately, to boot a floppy instead of a CD:
chainloader (fd0)+1
boot
Then, just install the OS per normal. At this point, after the new OS is installed, the system will just boot the new OS until we tell it otherwise (i.e. hide/unhide partitions).
Dual Booting DOS and Windows 95
In my case, Windows 95 is the second OS that I installed, leaving me with a system that now always boots Windows 95. I copied grub.exe to C:\ and created the following config.sys:
DEVICE=C:\GRUB.EXE
and the following C:\menu.lst:
title Continue Booting Windows 95
quit
title Reboot to MS-DOS 6.22
unhide (hd0,0)
hide (hd0,1)
rootnoverify (hd0,0)
setactive
reboot
title Command Line
commandline
Reboot, and you'll be presented with GRUB's menu (that you just created above), and have the option to set the system to boot MS-DOS, and then reboot to boot it.
Once in DOS, we do similar steps. Copy grub.exe to C:\ and modify config.sys to have the following line as the very first line in the file:
DEVICE=C:\GRUB.EXE
and the following C:\menu.lst:
title Continue Booting MS-DOS 6.22
quit
title Reboot to Windows 95
unhide (hd0,1)
hide (hd0,0)
rootnoverify (hd0,1)
setactive
reboot
title Command Line
commandline
And presto!
This will present one of the two menus every time the system boots, which one depends on which OS is the "active" one. This does mean, however, that if you select the "Reboot to ..." option the system will reboot (surprise) and present the other menu.. so you kind of see two menus in a row, which is kind of clunky, but it works, and I didn't molest the MBR of the drive by loading in GRUB4DOS's loader.
Tips
It's worth noting that this really only works if all of the operating systems that will be booted on this system are DOS or DOS variants that can call grub.exe as a first part of its boot process. You can get Windows NT to do a similar thing, but other operating systems would probably necessitate going the MBR route.
You might find it handy to add some menu options to boot CDs, particularly if you use EZ-DRIVE DDO (see my post about Dynamic Disk Overlays). Simply add another menu title to menu.lst, similar to how we booted the CD in the first place:
title Boot CD-ROM
cdrom --init
map --hook
chainloader (cd0)
boot
Also, there are lots of tutorials that can be found online that highlight some of GRUB4DOS's other neat features, like mounting and booting floppy and CD images that are stored on the hard disk. Cool, huh?