                Windows 95 + Windows 3.x + Linux Howto
             Robert Goodwin <Robert.Goodwin@mcc.ac.uk>
                            Jan 1996

  1. Why this HOWTO?

  Getting Linux to work with Win95 is covered in the Win95+Linux
  Howto. This document addresses some different issues:
  
  * How to install Win95 with Linux without having to reinstall lilo
  * How to get Win 3.x to live on the same machine as Win95 without
    problems
  * How to avoid problems on a machine with Win95 which can also
    remote boot DOS

  1a. Why?

  Although the Win95 filesystem lives on top of the standard DOS FAT,
  it does some pretty unpleasant things to it. Boot your Win95 machine
  from a bootable DOS floppy and get Norton to check the disk (but
  DON'T let it attempt any repairs or you'll mess up some "long"
  filenames)

  I am currently required to support applications in the Win95
  environment as well as under Win3.x (both run locally and network
  booted). I developed the setup described in this document to allow me
  to do all this with just one PC.
  
  Don't ask how a Unix person ended up in this position....

  2. Requirements

  You will need TWO hard disks. This is due to some DOS/Windoze
  limitations with respect to booting and allocation of drive letters.
  Believe me, I tried to get it working with one.

  3. What you will end up with

  Here is a brief description of what I now have - watch those drive
  letters because they change... 

  If you use a secondary IDE controller, you will need to create the
  /dev entries yourself (/dev/hd1a* and /dev/hd1b*) This might be the
  case if you add a second hard drive to a machine with one IDE disk
  and an IDE CDROM already installed; your second hard disk would be
  /dev/hd1a. I have tried this arrangement with no problems.


  Option 1:
    On powering up the machine, I can allow the boot ROM on the
    ethernet card to remote boot DOS. The "C" drive is the first DOS
    partition on the FIRST IDE disk (in my case /dev/hda1). The "D"
    drive is the first DOS partition on the SECOND IDE disk (in my
    case /dev/hdb1), and the "E" drive is the second DOS partition on
    the SECOND IDE disk (/dev/hdb2)
 
  Option 2:
    Allow lilo to boot the default system (Linux, naturally)

  Option 3:
    Interrupt lilo and ask for an option I call DOS. This boots DOS
    from /dev/hda1, and, as with option 1, the "C" drive is /dev/hda1
    the "D" drive is /dev/hdb1 and the "E" drive is /dev/hdb2
  
  Option 4:
    Interrupt lilo and ask for an option I call Win95. This boots
    Win95 from the first DOS partition on the SECOND IDE drive (in
    my case /dev/hdb1). Follow this carefully: the "C" drive is now
    the first DOS partition on the SECOND IDE disk (/dev/hdb1),
    the "D" drive is now the first DOS partition on the FIRST IDE
    disk (/dev/hda1), and the "E" drive remains the second DOS
    partition on the SECOND IDE disk (/dev/hdb2)


  Notice that the C drive changes depending how you boot. This means
  that when you install Win95, you install it to C:\WINDOWS, and when
  you install Win3.x, you install it to C:\WINDOWS but this isn't the
  same place :-)

  4. How to do it
  
  First of all, install Linux;  it does not matter which drive you
  install it on; but since you are using two drives it makes sense to
  create a swap partition on each.

  Create a primary DOS partition on the second disk. Unfortunately, the
  DOS FDISK won't let you do this, so you must use the Linux fdisk to
  create the partition, set the type (6 for DOS 16 BIT FAT > 32Mb), set
  the partition as bootable, and CAREFULLY follow the advice on the man
  page for fdisk. This describes how to persuade DOS to recognise a
  partition created in this manner using the dd command to zero the
  first 512 bytes of the partition. (Basically, you use
  "dd if=/dev/zero of=/dev/XXXX bs=512 count=1" where XXXX is the
  device but be VERY careful since this is a good way to trash a disk
  - for example by putting /dev/hda instead of /dev/hda1!)

  Creating the primary DOS partition on the first hard disk can be done
  with the DOS FDISK. Any other required DOS partitions can similarly
  be created.

  Both of these primary partitions must be formatted as bootable DOS
  partitions; use FORMAT C: /S and FORMAT D: /S having booted from a
  floppy. In order to avoid confusion, give the partitions meaningful
  volume labels.

  Edit /etc/lilo.conf to give you the option of booting from either
  of the two primary DOS partitions. I have appended an example
  to the end of this document. Note the use of the "loader" line in
  this example file.  Which you choose to install as Win95 and which
  as DOS/Win3.x is up to you; I used the second hard disk for Win95
  since network booting of the machine then gives the normal DOS
  drive as "C". Also (and usefully), installing Win95 on the second
  hard disk avoids having to boot linux from a recovery disk and
  re-install lilo (why this should be is explained below). Remember
  to run lilo to install the options.

  If you are (sensibly) planning to install Win95 from CDROM, you
  will need to include the relevant drivers on the Win95 partition
  such that when you boot from it, the CDROM drive will be accessible.

  Now boot, using lilo, from the drive you wish to use for DOS/Win3.x
  and install the rest of DOS and Win3.x - the Windows installation
  should go to the C:\WINDOWS directory as per default.

  Once this is done, reboot the machine and, using lilo, boot from the
  Win95 partition. Perform your Win95 installation. The installation
  procedure may suggest D:\WINDOWS for installing Win95 because it
  searches the machine for existing WINDOWS versions - DON'T accept
  this - install Win95 to C:\WINDOWS.

  Now for the neat part! Win95 is a rather arrogant system - when you 
  install it, it assumes that it is the only operating system on the
  machine and proceeds to write its own MBR (Master Boot Record) to
  the hard disk. This is why you generally need to re-install lilo.
  If you have installed Win95 to the second hard disk, you have done
  something which the Microsoft(tm) programmers didn't consider.
  On one machine where I performed this operation, Win95 wrote its
  replacement MBR to the MBR of the SECOND hard disk. On another, I
  never found any evidence of it at all. The practical upshot of this
  is that the MBR which matters, that of the first hard disk, is
  not disturbed. Thus when you reboot the machine, you will be greeted
  by the friendly and familiar LILO prompt.

  Example Partition List:
  /dev/hda1  *   DOS partition  (C: or D: depending upon boot)
  /dev/hda2      Extended partition
  /dev/hda5      /
  /dev/hda6      swap
  /dev/hda7      /home
  
  /dev/hdb1  *   Win95 partition  (C: or D: depending upon boot)
  /dev/hdb2      DOS partition    (E: always)
  /dev/hdb3      swap
  
  (Partitions with a * are set as bootable by fdisk)
  
  Example lilo.conf:
  # /etc/lilo.conf
  install = /boot/boot.b
  compact
  delay = 20	# optional, for systems that boot very quickly
  #prompt		# use instead of delay to force response to boot prompt
  #vga = normal	# force sane state
  #ramdisk = 0	# paranoia setting
  #root = current	# use "current" root
  boot = /dev/hda
  image = /boot/vmlinuz
    read-only
    label = linux
  other = /dev/hdb1
    label = win95
    loader= /boot/any_d.b
  other = /dev/hda1
    table = /dev/hda
    label = dos
  image = /boot/vmlinuz.old
    label = linux.old
    optional
    read-only


     If you have found this document useful, please let me know.
