So, getting a MBR and os2boot on a hard drive image was a real pain. None of the current CDs would boot to a point where I could get the job done. I resorted to doing it the hard way. I mounted an old 630 meg IDE hard drive (just having this around should label me a packrat) and booted the system with an eCS 2.0 RC4 CDROM. Using the eCS tools I made a compatible partition which was bootable and wrote the MBR. Next, I did a long JFS format on the partition which completed but with errors toward the end of the format process.
eax: 0x0000aa55 43605 ecx: 0x00000000 0 edx: 0x00000080 128 ebx: 0x00000000 0 esp: 0x0000ffdc 65500 ebp: 0x00000000 0 esi: 0xffff0000 -65536 edi: 0x0008fdba 589242 eip: 0x00007c00 eflags 0x00000082 IOPL=0 id vip vif ac vm rf nt of df if tf SF zf af pf cf cs:s=0x0000, dl=0x0000ffff, dh=0x00009b00, valid=1 ds:s=0x0000, dl=0x0000ffff, dh=0x00009300, valid=1 ss:s=0x0000, dl=0x0000ffff, dh=0x00009300, valid=7 es:s=0x0000, dl=0x0000ffff, dh=0x00009300, valid=1 fs:s=0x0000, dl=0x0000ffff, dh=0x00009300, valid=1 gs:s=0x0000, dl=0x0000ffff, dh=0x00009300, valid=1 ldtr:s=0x0000, dl=0x00000000, dh=0x00000000, valid=0 tr:s=0x0000, dl=0x00000000, dh=0x00000000, valid=0 gdtr:base=0x000faeb2, limit=0x30 idtr:base=0x00000000, limit=0x3ff
Phase 1 — The MBR
In brief, control is passed from BIOS to the loaded MBR code at 07C0:0000. The code relocates itself to 07E0:0000, checks for a Boot Manager partition, and checks for a bootable partition. Once a bootable partition is found, the partition boot record or more correctly the BIOS parameter block (BPB) is loaded at 07C0:0000 and control is passed to it at 07C0:0000.
Remember, as I understand the MBR is created by the LVM utility (ex: LVM /NEWMBR). At this point the system is using INT13 calls to interface with the drive. The errors that can be encountered during this phase are:
- SYS01462
- SYS01463
- SYS01464
More detailed information can be found here:
Phase 2 — The Partition Boot Block
This code uses INT 12 to, in general, find the top of low memory. Next, the result (approx 639) has 54h subtracted, AND result with FFF0h, and then shifted left 6 bits. This will be the load segment for the next code file (ie calculated load segment). The Bochs drive returns 639 from the INT12 call, so the load segment is 8800h.
All disk access during this phase uses INT13 calls to interface with the drive. After loading the next module a far return to (calculated load segment):199C is performed. This code is placed in the partition when the sysinstx.com file is run against it. So, the sysinstx.com executable writes the partition sector/micro-FSD and os2boot.
The errors that can be encountered during this phase are:
- an error when performing the next module load (INT13 Ext) which results in an emission of DAP information, – SYS2027 – message, and the system hangs. Getting this error is an indication of a failed INT13 load from the procedure readdrive which is also used in Phase 3.
- ‘Invalid code for JFS’ (followed by address code) which is emitted after the next module is loaded and a check for the signature 1961h at (calculated load segment):0200 fails. For normal operation I assume this error would be an indication that os2boot could not be loaded and possibly running sysinstx.com against the partition could correct it.
The module loaded in Phase 2 contains code to continue the boot process and the micro-FSD. Using the Bochs drive image, 20h sectors are loaded at 8800:0000 and the entry point is 8800:199C.
More detailed information can be found here:
Bootable JFS Bootsector Code (BPB)
Phase 3 — The Partition Boot Block Plus Extra (micro-FSD)
After a bit of playing, I found that the load in Phase 2 does indeed reload the Partition Boot Block and an additional 31 sectors at 0x88000. Looking at the code and stepping through execution with Bochs, I have confirmed this to be correct.
I am starting to see the structure of the Phase 3 load and it does not seem as documented. I believe this module loads os2boot and it only contains the mini-file system. It next loads os2ldr, sets up the required structures and then jumps into os2ldr.
I’m going to post my notes to the blog, link at top of the page.