home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / BOOTANY1.ZIP / BOOTANY.DOC < prev    next >
Text File  |  1990-10-29  |  15KB  |  326 lines

  1. ********************************************************************************
  2.  
  3.     This program uses methods different than those documented by FDISK
  4.     to boot your computer. You should read the following text to
  5.     understand how BOOTANY works and what it will do for you.
  6.  
  7. ********************************************************************************
  8.  
  9.  
  10. This package consists of the following files:
  11.  
  12.    BOOTANY      - The NMAKE file for BOOTANY.SYS
  13.    BOOTANY.ASM  - The source code to an assembler program which can be
  14.                   used as a replacement for the master boot program on
  15.                   hard disks with multiple partitions.
  16.    BOOTANY.SYS  - The binary image used as the new master boot program.
  17.    BOOTANY.H    - Definitions and structures used by the C programs.
  18.    BOOTANY.INC  - Definitions and equates used by BOOTANY.ASM and
  19.                   BSTRAP.ASM
  20.    BOOTIO.ASM   - The source for the program which reads or writes the
  21.                   Master Boot Record.
  22.    BSTRAP       - The NMAKE file for BSTRAP.COM
  23.    BSTRAP.ASM   - The source for the program which installs BOOTANY.SYS
  24.                   onto your hard disk.
  25.    BSTRAP.COM   - The executable file which will install BOOTANY.SYS
  26.    INSTBOOT.BAT - A batch file which when executed installs BOOTANY.SYS
  27.                   on your hard disk.
  28.    PREFDISK     - The NMAKE file for PREFDISK.EXE
  29.    PREFDISK.C   - The source for the program to run before FDISK.
  30.    PREFDISK.EXE - Program to invalidate partition table entries before
  31.                   running FDISK.
  32.    PREINST      - The NMAKE file for PREINST.EXE
  33.    PREINST.C    - The source for the program to validate all partition
  34.                   Table entries
  35.    PREINST.EXE  - Program to validate all partition table entries before
  36.                   Running BSTRAP
  37.    READ.ME      - This file
  38.    SHOWBOOT     - The NMAKE file for SHOWBOOT.EXE
  39.    SHOWBOOT.C   - The source for the program which displays the master
  40.                   partition table
  41.    SHOWBOOT.EXE - Program to display the master partition table
  42.  
  43.  
  44.  
  45. Section 1 - How the ROM BIOS Boots an Operating System
  46.  
  47. When an IBM PC or compatible computer boots (via <CTRL><ALT><DEL> or
  48. by turning the power on), the last operation the ROM BIOS boot strap
  49. program does is to read the first sector of the A: drive or if no disk
  50. is present in A:, the first sector of the C: drive. After the sector is
  51. read to the 512 bytes starting at address 0000:7C00, the boot strap
  52. program validates the sector by insuring that the last 2 bytes
  53. (0000:7DFE) contain the hex value 55AA. If they are, the boot strap
  54. program branches to 0000:7C00. It is important to note that up until
  55. this point NO operating system services have been created or are
  56. available. This is why some programs (like Flight Simulator) can be
  57. started at system boot, and also why the PC is capable of running
  58. multiple operating systems.
  59.  
  60.  
  61. Section 2 - The Master Boot Record
  62.  
  63. On a floppy diskette formatted with the DOS command "FORMAT A: /s",
  64. the first sector will contain EB34xx in the first three bytes. This
  65. is a jump instruction which bypasses the next several bytes. Following
  66. this will be an 8 character system id. On machines using IBM DOS this
  67. will be the characters "IBM " followed by the version of DOS. And
  68. of course the last two bytes of the sector will contain hex 55AA. This
  69. is the DOS boot program.
  70.  
  71. On hard disks, which must be set up with FDISK, other than the last
  72. two bytes containing hex 55AA and the first byte containing an
  73. executable instruction, this first sector is quite different. It is
  74. called the Master Boot Record.
  75.  
  76. Starting at byte 446 (hex 1BE) is the Partition Table. It contains
  77. 4 entries, so your hard disk can be divided into at most 4 partitions.
  78. Each entry has the following format:
  79.  
  80. Offset   Size   Field              Purpose
  81. +0         1    BootIndicator      Indicates if partition is startable
  82.                   hex 00             Non-startable partition
  83.                   hex 80             Startable partition
  84. +1         1    BeginHead          Side on which partition starts
  85. +2         1    BeginSector        Sector at which partition starts
  86. +3         1    BeginCyl           Cylinder at which partition starts
  87. +4         1    SystemId           Identifies partition type
  88.                   hex 00             Empty partition entry
  89.                   hex 01             DOS FAT-12
  90.                   hex 02             XENIX
  91.                   hex 04             DOS FAT-16
  92.                   hex 05             Extended partition
  93.                   hex 06             DOS > 32M
  94.                   hex 07             HPFS
  95.                   hex 64             Novell
  96.                   hex 75             PCIX
  97.                   hex DB             CP/M
  98.                   hex FF             BBT
  99. +5         1    EndHead            Side on which partition ends
  100. +6         1    EndSector          Sector at which partition ends
  101. +7         1    EndCyl             Cylinder at which partition ends
  102. +8         4    RelativeSectors    # Sectors before start of partition
  103. +12        4    NumberSectors      # Sectors in partition
  104.  
  105.  
  106. The master boot program (starting at byte 0) copies itself to a
  107. different location in memory and then inspects the partition table
  108. looking for a startable partition. If more than one startable partition
  109. exists or any BootIndicator is not hex 80 or 0 than "Invalid Partition
  110. Table" will be written on the screen and the program will enter an
  111. endless loop.  After successfully validating the table, the program then
  112. obtains the Begin Head, Sector, and Cylinder for the startable partition
  113. and reads it from disk to 0000:7C00. It validates that the hex 55AA is
  114. present and then jumps to location 0000:7C00.  From this point on
  115. startup is identical to booting from a floppy.
  116.  
  117.  
  118. Section 3 - OS/2
  119.  
  120. OS/2 supports the use of multiple partitions on a hard disk just as
  121. DOS does. In fact, FDISK is again how OS/2 partitions are defined.
  122. What is slightly strange though, is that HPFS partitions must be
  123. defined using FDISK as DOS primary or secondary partitions. This
  124. means that they are initially defined as FAT partitions. However,
  125. when OS/2 formats that partition as HPFS it updates the Partition
  126. Table to indicate a type of 07.
  127.  
  128. During installation, OS/2 tries to install itself in the first DOS
  129. partition it finds - even if its too small or something is already
  130. there. If it doesn't find a DOS partition it will look for the first
  131. HPFS and install itself there. OS/2 installation also marks the
  132. installed OS/2 partition as the "Active" partition. The BOOT program
  133. accompanying OS/2 1.2 changes the active partition to the OS/2 or
  134. DOS partition. Re-booting the computer causes the appropriate
  135. operating system to be started.
  136.  
  137.  
  138. Section 3 - Multiple "Primary" partitions.
  139.  
  140. Primary partitions basically are those with system ids other than 0 or
  141. 5. A 0 system id indicates that the partition entry is not in use.  Type
  142. 5 is a special type of partition which I will discuss a little later.
  143. Type 5 partitions cannot be marked startable.
  144.  
  145. DOS and OS/2 (and presumably other operating systems) behave similarly
  146. with regards to how they handle multiple primary partitions. If a PC
  147. contains multiple hard disks, each must contain a primary partition
  148. valid for the target operating system for it to be recognized.  If both
  149. disks also contained a secondary, after boot the drive configuration
  150. would be:
  151.  
  152.    C: First hard disk's primary partition
  153.    D: Second hard disk's primary partition
  154.    E: First hard disk's secondary partition
  155.    F: Second hard disk's secondary partition
  156.  
  157. If the primary partition on the first drive became unavailable, the
  158. operating system could (and woould) boot off of the second drive's
  159. primary partition. Unknown partition types are completely ignored by the
  160. operating system so a hard disk with no known primary partition will be
  161. skipped.
  162.  
  163. When a single drive is configured with multiple primaries similar
  164. logic is encountered. First all unknown partitions are ignored by
  165. the operating system. Secondly, only the first known primary and valid
  166. secondaries become accessable.  If the following configuration were
  167. used,
  168.  
  169.   Partition  SystemId
  170.       1         07
  171.       2         07
  172.       3         06
  173.       4         05
  174.  
  175. and a boot of OS/2 was attempted, OS/2 would mark partition 1 as C:,
  176. ignore partitions 2 and 3, and then would look at the extended
  177. partition for more logical drives.  If partition 2 were marked as the
  178. startable partition some bizarre behaviour would be encountered. OS/2
  179. would be started using the boot program from partition 2, however C:
  180. would be partition one and partition 2 would be inaccessable, most
  181. likely causing strange results.
  182.  
  183.  
  184. Section 4 - Secondary partitions.
  185.  
  186. Secondary partitions allow the creation of DOS or HPFS partitions
  187. which can be shared among operating systems or versions of an
  188. operating system. For example, an extended partition may be defined
  189. as having both an HPFS partition and a FAT partition. DOS will be
  190. able to manipulate the FAT partititon while all versions of OS/2
  191. can work with both the FAT and the HPFS partitions. Thus version
  192. specific data may be kept on the primary partitions while common
  193. data may be kept on an extended partition.
  194.  
  195. Secondary (or extended) partitions are those defined as type 5. FDISK
  196. only allows them to be created if a primary partition is defined,
  197. however, the available OS/2 documentation states that secondary
  198. partitions may be created without a primary if the (phsysical) drive
  199. is not startable.
  200.  
  201. A secondary partition contains a collection of "extended volumes"
  202. which are linked together by a pointer in the extended volumes'
  203. start-up record.  Each extended volume contains an extended start-up
  204. record, located in the first sector of the volume. The extended
  205. start-up record contains the normal 55AA signiture at the end. The
  206. extended start-up record also contains a partition table, the format
  207. of which is identical to the master partition table. The code in
  208. the extended start-up record, if there is any, starts at location 0
  209. and probably writes a message indicating an attempt to start a
  210. non-startable partition.  A partition entry of type 5 allows chaining
  211. to the next extended volume.
  212.  
  213. An extended volume is only allowed to have one block device driver,
  214. therefore only 1 entry will be used to map a logical drive. One
  215. other entry may be used to chain to the next extended volume.
  216.  
  217. Section 5 - How BOOTANY works.
  218.  
  219. BOOTANY is a fairly simple program. It has to be to fit within the
  220. 445 bytes available for code in the master boot record.
  221.  
  222. First, BOOTANY must be installed. As part of the installation, the
  223. installer associates function keys 1, 2, and/or 3 with a specific entry
  224. in the partition table and a short description of the partition.  As
  225. each partition is defined it will be validated to insure it was marked
  226. startable. If it was not it can be marked startable by the install
  227. program.  Only startable partititons should be defined as primary
  228. partitions.
  229.  
  230. After all the partitions have been defined to BOOTANY, the install
  231. program will proceed to move the SystemId in each bootable partition
  232. entry to the BootIndicator field in the same entry. The SystemId
  233. will then be set to hex 80 (an undefined value). If the system
  234. were then to be booted from a floppy, NO valid partitions would
  235. exist.
  236.  
  237. After installation, every time the computer is rebooted from the
  238. hard disk a short menu will appear. The menu consists of the
  239. defined function keys along with their textual description. Whichever
  240. function key was used at the previous boot will be displayed as the
  241. default. If no key is depressed within 5 seconds, the default system
  242. will be booted.
  243.  
  244. After selection of a boot partition, BOOTANY will validate that the
  245. partition is startable (the BootIndicator is non-zero). If it is the
  246. first sector of the partition will be read to 0000:7C00. The last two
  247. bytes will be compared to hex 55AA. If they match, the previously booted
  248. partition entry will be modified so that the BootIndicator contains the
  249. SystemId value and the SystemId is hex 80.  The partition entry to be
  250. booted will next be modified so that the System ID is restored and the
  251. BootIndicator is set to hex 80.
  252.  
  253. This procedure insures that there is only one valid primary partition at
  254. a time, thus avoiding the situation described in the last paragraph of
  255. Section 3 above.
  256.  
  257.  
  258. Section 6 - Installing and booting multiple operating systems.
  259.  
  260.  
  261. Sample installation for OS/2 1.2, OS/2 2.0 and DOS 4.0
  262.  
  263. 1. Start with an empty but low-level formatted hard disk.
  264. 2. Using DOS FDISK create a primary partition to be used by DOS 4.0 as
  265.    its FAT C: drive. (2 Meg minimum) Make sure the partition is marked
  266.    startable.
  267. 3. Install DOS onto drive C:
  268. 4. Run PREFDISK.EXE to invalidate the partition just created.
  269. 5. Using DOS FDISK create a DOS primary partition to be used by OS/2 1.2 as
  270.    its HPFS C: drive. (14 Meg minimum) Make sure the partition is marked
  271.    startable.
  272. 6. Install OS/2 onto drive C:
  273. 7. Boot DOS from floppy and again run PREFDISK to invalidate the partition
  274.    just created.
  275. 8. Using DOS FDISK create a primary partition to be used by OS/2 2.0 as
  276.    its HPFS C: drive. (14 Meg minimum) Make sure the partition is marked
  277.    startable.
  278. 9. Install OS/2 onto drive C:
  279. 10.Run INSTBOOT replying as indicated: (entered text is shown in [])
  280.  
  281. <CTRL><BREAK> may be used to end the install at any time
  282.  
  283. What partition should be installed to F1? (1-3, 0 to end) [1]
  284.  
  285. Enter partition description to be assigned to F1 (15 chars max) [OS/2 1.2 HPFS]
  286.  
  287. What partition should be installed to F1? (1-3, 0 to end) [2]
  288.  
  289. Enter partition description to be assigned to F1 (15 chars max) [OS/2 2.0 HPFS]
  290.  
  291. What partition should be installed to F1? (1-3, 0 to end) [3]
  292.  
  293. Enter partition description to be assigned to F1 (15 chars max) [DOS  4.0 FAT ]
  294.  
  295. Do you want Num Lock turned off at boot? [Y]
  296.  
  297. Boot record updated.
  298.  
  299. 11.Press <CTRL><ALT><DEL>
  300.  
  301. At restart the computer will respond with:
  302.  
  303. F1 . . . OS/2 1.2 HPFS
  304. F2 . . . OS/2 2.0 HPFS
  305. F3 . . . DOS  4.0 FAT
  306. F4 . . . ROM BASIC
  307.  
  308. Default: F?
  309.  
  310. 12.Select F3 and run FDISK to Install a secondary partition and logical FAT
  311. and/or HPFS drives as desired.
  312.  
  313. 13.Reboot the computer. The default will now be F3 since DOS was
  314. previously booted.
  315.  
  316.  
  317. To install a new operating system
  318.  
  319. 1a.Boot the operating system which will have its partition entry
  320.    changed, or
  321. 1b.Boot DOS, run PREFDISK to invalidate all partitions and then run
  322.    FDISK to install a new partition.
  323. 2. Install the new operating system in the vacant partition.
  324. 3. Run INSTBOOT replying as needed.
  325. 4. Reboot the computer.
  326.