Ephemerboot/Read Me Second.txt

1 line
11 KiB
Plaintext
Raw Normal View History

2019-03-29 16:35:52 +00:00
Ephemerboot 1.0 David "Potatoswatter" Krauss, 5/02 See bottom for credits. What is Ephemerboot? Ephemerboot is a RAM disk driver which will boot Classic on NewWorld machines. Why is it cool? Ephemerboot solves two tough problems, making it Weird. 1. Bit rot Many Macs in the past have been able to boot from RAM disks, allowing very fast startup. However, NewWorld machines (ones since the original iMac, without ROMs) can't. They power down (more accurately, cease to refresh) RAM momentarily during reboot, causing its data to become suddenly ephemeral. It simply fades away... but actually most remains intact. To allow bootable RAM disks despite this, Ephemerboot implements data checksumming & correction to retrieve data lost from RAM transistors to "bit rot". 2. No access The bootability feature of Apple's own RAM disk driver (".EDisk") is hard-coded into the Mac boot sequence. Older machines store it in ROM; NewWorld machines have it in the "Mac OS ROM" file. Before the Mac OS reads anything from disk, ROM code reserves memory for the RAM disk, loads the driver, and takes a special look at it to give it special booting privileges. Only problem is, I don't work at Apple. I was a toddler when that code was written. To accomplish what that little bit of ROM code does, Ephemerboot uses two off-beat components: a chaining bootloader and a patch partition module. A driver in the patch partition module does the real work. 2a. The bootloader The bootloader phase ("ramboot") reserves RAM for the disk. As Open Firmware is running, the Mac represents the arrangement of DIMMs on the motherboard as a set of numbers (starting address/# bytes) in the /memory device-tree node. Ramboot alters these in a way similar to that described in QA1099 [1], with a few differences. Ramboot supports a variable amount of RAM shrinkage. Ramboot supports discontiguous physical memory. This is a bit technical to explain here, but it makes things a hassle to do properly. Unlike the QA1099 method, RAMBoot isn't designed simply to waste RAM. It reclaims 2 MB of memory that would otherwise be wasted because it's used by Open Firmware. To see your reclaimed memory, go to Apple System Profiler and look at the "Memory" section. Ramboot allows the user to choose where memory gets allocated from. This feature was hacked onto the preceding one. Note that physical addresses don't actually correspond to DIMMs when interleaving is used. DRAM interleaving allows RAM chips to act in parallel, which is normally good. It happens when you have two DIMMs of identical size in adjacent slots. 2b. The patch partition module The patch partition module contains the actual Classic Mac OS driver. (Nearly) every partitionable disk has a patch partition, an obscure and little-used invisible 256 kB partition. Code from this partition is loaded and run at boot. Normally this does boring things like patch ROM disk drivers from the pre-4 GB era and allow machines predating popular CD-ROM drives to boot from them with the "c" key. Actually, that's all that patch partitions have ever done, far as I know. You might have noticed, however, that these functions both deal with letting the machine boot from things it normally wouldn't. That's because the patch partition is run before the boot volume is determined. The patch partition consists of a series of modules in a grow-down stack and a series of module descriptions in a grow-up stack. The Ephemerboot Installer adds its code to both stacks. ----------- patch partition description 1 description 2 Ephemerboot description - empty space - Ephemerboot code patch 2 patch 1 ------------ / 256k The patch code is generated from a single source file, Ephemerboot.c. It first loads from the Name Registry information from the bootloader stage about where the disk is located. If that succeeds, it loads the master checksum from NVRAM and performs the data correction. Then, it loads the driver and the disk. 2c. The driver The driver is as simple as Mac disk drivers get. It's synchronous and it does I/O with BlockMoveData(). I