# Oberon/ETH Oberon/bootmbr

This document was originally hosted at the ETHZ. It remains under the ETH license and is in the WayBack archive.
The next level of boot complexity is that of booting from hard disk via its MBR. Every hard disk contains an MBR but the BIOS is usually able to access only the MBR of the first hard disk (the disk with device number 80H), whilst access to the further MBRs can eventually be controlled with the machine System Setup, depending on its capabilities.
Whichever operating system is used, the MBR which comes with it is a central information repository. The Boot Loader code it contains differs with each operating system and therefore its functionality varies accordingly. The order in which multiple operating systems are installed also influences the MBR content. The Boot Loader code is also replaced by a functionally different one when a boot manager is installed. Hence, an Oberon user will in any case have to deal with and have to master all the matter around the MBR, a vast subject outside of the ETH Oberon concern. A small amount of basic information is provided here, only just enough to establish a bridge to the relevant Oberon material. More information on the subject can be found, for example, in the Wikipedia article about booting.
The initial part of the description found in x86-based PC bootstrapping still applies. However, if
* no boot sector is found on the first floppy drive or
* the BIOS setup is conditioned to boot from a mass storage device, attached to an IDE, SCSI or USB controller,
INT 19 tries to read the MBR from the first sector on the first hard disk. If an MBR is found it is read into memory at location 0000:7C00 and the BIOS checks that the last two bytes of the sector are "AA 55". If that is correct, the routine jumps to memory location 0000:7C00. The small program in the MBR will attempt to locate a primary, active and bootable partition in its partition table from which an operating system can be started. If an Oberon partition is active, Oberon is started with the ETH Oberon boot loader in a manner similar to what happens with a boot diskette. As another example, when DOS is installed, the first record in the partition contains a DOS boot sector. If the DOS partition is active, the start code will load IO.SYS, which in turn loads DOS, and so on ...
When a boot manager is installed, the genuine MBR of a particular OS is replaced and the notion of "active" partition becomes irrelevant. Instead, any partition, primary partition or logical drive in an extended partition can be booted. Some boot managers can also be cascaded.
ETH Oberon does not supply an MBR. It expects that the MBR, provided by third-party software, exists prior to the installation of Oberon. Attempting to install Oberon on an empty/blank first hard disk will unavoidably call for the error message "No boot sector on hard disk". Because the MBR plays such an important role, it is necessary to understand the boot mechanism part which precedes the start of Oberon in a partition on a mass storage device.
A DOS MBR stores the partition table and 446 bytes of Boot Loader code playing a central role when a machine is started/booted.
An MBR is located in the first sector (Cylinder 0, Head 0, Sector 1) of a hard disk and it has the structure:
The structure of a partition entry is:
A good description of the boot loader mechanism is found in the Wikipedia article about booting.
Replacing an MBR is a considerable system modification which can lead to less considerable damages to all the OSes installed. Make sure beforehand that the OSes can still be started using boot diskettes prepared in advance and put aside for this eventuality. Keep also in mind that, whenever a partition is added, removed or resized on the disk, the partition table is modified and any earlier backup MBR becomes totally invalid and is a potential threat!
Caution is recommended: replacing an MBR is a dangerous operation which can lead to a massive loss of data.
The MBR is created in many ways:
* it may be present on a newly purchased hard disk - it was then placed by the manufacturer
* when an operating system is installed. DOS: FDISK used to format a partition; Windows; Linux; BeOS; ...
* when another operating system is installed. The installation order plays a major role.
* when a boot manager is installed.
* when a boot manager is uninstalled. The original MBR, displaced by the installation is restored.
* when fdisk /mbr is executed.
* when a disk inspection utility is used.
* etc.
The list is not exhaustive and the reader is invited to consult the documentation supplied with the operating system, commercial or shareware software used.
ETH Oberon offers the facilities required to manipulate or inspect an MBR by way of a number of commands described in Introduction to ETH Oberon / PC Native alpha and beta release:
* Partitions.WriteMBR dev#0 filename ~
* Partitions.PartitionToFile dev#part filename [block blocks] ~
* Partitions.FileToPartition dev#part filename [block blocks] ~
* Partitions.ShowBlocks dev#part block [blocks] ~
An interesting side effect is that ETH Oberon can be used to repair any MBR, including an MBR of a foreign OS, without the need to purchase further utility software.
If your machine does not boot anymore as it used to, it could be that the MBR has been damaged or overwritten. It is extremely unlikely that the data in the partitions has been affected. Bypassing the boot loader is a way to recover from the situation. Use a boot diskette, created during the installation, to get get you back into Oberon. If none is available, use the Oberon-0 diskette as universal rescue diskette.
21 Nov 2002 - Copyright © 2002 ETH Zürich. All rights reserved. E-Mail: oberon-web at inf.ethz.ch [expired] Homepage: http://www.ethoberon.ethz.ch/ [expired]