Rewrite Bootsector Example

WARNING:
The way descriped below may be not the only way to use the rewrite option, but this is the way I use it and the way it works.
You need a Linux Bootdisk and should have a install version of Windows95 or NT.
PLEASE BACKUP ALL IMPORTANT DATA ON YOU HARDDISKS BEFORE TRYING THESE.

Let's assume you have a working Linux / DOS6.22 & Windows3.11 system:
OSdevTypeactive
Linux/dev/hda1 (1st partition table entry) 83 (Linux)no
SWAP/dev/hda2 (2nd partition table entry) 82 (Linux SWAP)no
DOS/Windows/dev/hda3 (3rd partition table entry) 06 (DOS 16-bit >=32M)yes
----/dev/hda4 (4th partition table entry) ------

Now assume you want to use the 4th partition to install Win95 and would keep W95 away from your old DOS/Windows3.11 partition (nobody knows what W95 does with files on HD :-) )

1. Create the partition for Win95 with fdisk or cfdisk, set the type to 99 (unknown). The partition table should look as follow:
OSdevTypeactive
Linux/dev/hda1 (1st partition table entry) 83 (Linux)no
SWAP/dev/hda2 (2nd partition table entry) 82 (Linux SWAP)no
DOS/Windows/dev/hda3 (3rd partition table entry) 06 (DOS 16-bit >=32M)yes
Windows 95/dev/hda4 (4th partition table entry) 99 (unknown)no

2. Boot DOS and use fdisk to write a clean DOS MBR (fdisk /mbr)

3. Boot Linux using a Linux bootdisk (yes you need a bootdisk :-) )

4. Save the DOS MBR (dd if=/dev/hda of=dos.mbr bs=512 count=1)

5. Change the partition table (using fdisk / cfdisk) so that it look as follow:
OSdevTypeactive
Linux/dev/hda1 (1st partition table entry) 83 (Linux)no
SWAP/dev/hda2 (2nd partition table entry) 82 (Linux SWAP)no
DOS/Windows/dev/hda3 (3rd partition table entry) 99 (unknown)no
Windows 95/dev/hda4 (4th partition table entry) 06 (DOS 16-bit >=32M)yes

6. Install Windows 95 (this will overwrite the DOS MBR with a "Win95 MBR")

7. Boot Linux using a Linux bootdisk

8. Save the WIN95 MBR (dd if=/dev/hda of=win95.mbr bs=512 count=1)

9. Create a Chos configuration file (you may use Visual Chos from me). Choose bootsect or bootfile, set image to the saved MBR and enable the rewrite option. The config file should contain the following lines (names may different):

bootsect "Windows 95" {
  image=/boot/win95.mbr
  rewrite=yes
}

bootsect "Dos 6.2" {
  image=/boot/dos.mbr
  rewrite=yes
}

10. Install Choose-OS

Every time you boot DOS or Windows95 the bootsector loader compares the partition type and active flags of the file loaded (dos.mbr or win95.mbr) with the installed MBR. If the flags are different they will be changed (only the flags would be changed not the size of the partitions). After the flags had been changed you hear a "Beep" and the changed MBR is rewritten. If the flags are equal (e.g. you boot DOS the 10th time) the MBR would not be rewritten.

If you find Bugs or have a improvement idea feel free to contact me: <flower@Informatik.uni-bremen.de>