Skip to end of metadata
Go to start of metadata

These are my notes on the System 6 booting process, originally posted on 68kmla.  I've added it here to serve as reference, and so it can be updated and fleshed out a bit more.

The process for booting System 6:
After the ROM initializes the machine, which includes all the hardware specific bits like the memory controller, sets up the MMU with all the correct address mapping, etc. it looks over the list of disk devices it found. It looks for a disk that has valid boot blocks.

 When it finds a disk with valid boot blocks, it checks the version number in the boot blocks. Version 0x44 indicates the boot blocks contain executable code. If it's version 0x44, the ROM will load and execute that code. However, System6 does not use that version number (my System 6 boot blocks are version 0x17), which indicates to the ROM it should not execute the boot blocks, rather the ROM will try to boot the system directly.

The boot blocks for booting a particular release of the OS are stored in the System file's 'boot' resource ID 1. When you make a disk bootable, behind the scenes, that resource is being copied to the start of the disk.

System6's boot blocks actually do contain executable code, it's just not executed by a ROM version I am aware of.
The ROM tries to boot the System by finding a blessed folder (HFS filesystem attribute), and then looking for the files specified by the boot blocks (System, MacsBug, Disassembler, Scrapfile, ClipboardFile, and Finder). It then initializes some things like the filesystem, mounts the boot volume, initializes the Resource Manager to use it, it first loads 'DSAT' resource 0, which acts as an error message table for SysErr. SysErr is the ROM routine for displaying dialogs early in the boot process. You'll notice the error dialogs like the "This startup disk will not work with this Macintosh" and "This Macintosh is set for 32-bit addressing" look a little different than most dialogs on the system. Well, that's SysErr in the ROM being used when nothing else is available.
Earlier ROMs used SysErr to display the "Welcome to Macintosh" screen, but it looks like later ROMs are a bit more complex. Anyway, the "Welcome to Macintosh" screen is displayed at this point.

Then it loads MacsBug and Disassembler, if they exist, initializes more stuff, then more interesting things happen.
'PTCH' resources are loaded and run. Resource ID's -1 and 0 are run unconditionally, and then the resource ID that matches the version number of the ROM is loaded and run to patch the ROM specific bits. Here's a list of ROM version numbers for various machines. Open up your System file in Resedit, and you'll see PTCH resource ID's matching those numbers (resedit displays decimal ID's, the version numbers are displayed in hex).

Then the slot manager is called to invoke the secondary init routines for peripherals.
Then 'ADBS' resources are loaded and run.
Then it switches the 'DSAT' from resource 0 to resource 2, which essentially switches from System error messages to User error messages. We're now in user-space as far as the system is concerned.
And it gets around to loading and executing INIT resources from the System file. Each of these has a defined purpose, and the System file's INIT resource ID 31 is what eventually loads the INIT resources from cdevs, RDEVs, and INIT files.
Some more memory house keeping, scrapbook and clipboards are dealt with, and then Finder is finally loaded with the _Launch trap.

Labels
  • None