A TempleOS distro for heretics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

107 lines
5.3 KiB

$WW,1$$FG,5$$TX+CX,"Booting A PC"$$FG$
TempleOS only supports traditional $FG,2$BIOS$FG$ booting, not the newer technique, $FG,2$UEFI$FG$. This document describes $FG,2$BIOS$FG$ booting.
When you turn-on (power-up) a computer or you do a hardware reset, the computer starts executing the $FG,2$BIOS$FG$. Sometimes, you must change the $FG,2$BIOS$FG$ boot order to boot the device you want.
The $FG,2$BIOS$FG$ loads a boot sector from CD/DVD, hard disk or whatever. The boot sector runs in 16-bit real mode and often loads-in a second file that's bigger if it can't be done by just one sector. It's a safe bet that boot sectors are hand-coded assembly language. Most boot sectors use the $FG,2$BIOS$FG$ to load-in the next stage.
Not only do boot sectors have a size limit, 512 bytes or 2048 bytes for CD/DVD, the files they load have to fit within 640K because they run in 16-bit mode. This means they usually can't just load the whole operating system and start it running. Some boot loaders, like Grub, have a capability of switching modes before handing-off control to the operating system. The operating system must load the rest of itself. With TempleOS, the $LK,"::/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$ file is loaded by the boot sector. I try to put a minimum in the $LK,"Kernel Module",A="FI:::/Kernel/Kernel.PRJ"$, so that it will always fit in 640K. When Kernel.BIN runs, it switches to 32-bit mode, then, to 64-bit mode allowing access to more memory. Then, it loads in the rest of TempleOS by executing $LK,"::/StartOS.HC"$.
All the boot related code for TempleOS is in the $FG,2$/Adam/Opt/Boot$FG$ directory.
$LK,"BootDVD.HC",A="FI:::/Adam/Opt/Boot/BootDVD.HC"$ CD/DVD boot sector.
$LK,"BootDVDIns.HC",A="FI:::/Adam/Opt/Boot/BootDVDIns.HC"$ Prep for CD/DVD install by creating $FG,2$/0000Boot/0000Kernel.BIN.C$FG$.
If you are curious about CD/DVDs, see $LK,"DskISORedSea.HC",A="FI:::/Adam/Opt/Boot/DskISORedSea.HC"$. To make a custom bootable CD/DVD, look here $LK,"Bootable CD",A="FI:::/Misc/DoDistro.HC"$.
$LK,"BootMHD.HC",A="FI:::/Adam/Opt/Boot/BootMHD.HC"$ Stage 1 Master HD boot loader.
$LK,"BootMHD2.HC",A="FI:::/Adam/Opt/Boot/BootMHD2.HC"$ Stage 2 Master HD boot loader.
$LK,"BootMHDIns.HC",A="FI:::/Adam/Opt/Boot/BootMHDIns.HC"$ Installs Master HD boot loader.
$FG,2$BootMHD$FG$ goes on block zero. $FG,2$/0000Boot/BootMHD2.BIN.C$FG$ is stored as a file in a partition, risky and unusual, since most master boot loaders place stage 2 in a gap that's not in any partition. $FG,2$BootMHD2$FG$ displays a menu and boots a partition.
$LK,"BootHD.HC",A="FI:::/Adam/Opt/Boot/BootHD.HC"$ HD partition boot record.
$LK,"BootHDIns.HC",A="FI:::/Adam/Opt/Boot/BootHDIns.HC"$ Installs HD partition boot record.
$FG,2$BootHD$FG$ is the boot record for a TempleOS partition. Each partition has its own partition boot record, the first block of the partition.
My boot records don't access directories because that would make them too big for one block and would make them depend on a file system layout. Instead, they get patched with the LBA, logical block addresses, to load files. To update with a new TempleOS kernel, you must create a $LK,"::/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$ binary file and patch the boot loader so it knows the LBA blocks to load. Therefore, you usually recompile the kernel and update the boot sector at the same time with $LK,"BootHDIns",A="MN:BootHDIns"$(). $LK,"BootMHDIns",A="MN:BootMHDIns"$() will install a master boot loader.
With TempleOS, $LK,"::/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$ loads $LK,"::/Compiler/Compiler.BIN",A="FI:::/Compiler/Compiler.PRJ"$ so it can work with source code from then on. It compiles start-up scripts beginning with $LK,"::/StartOS.HC"$ into the $LK,"Adam Task",A="FF:::/Doc/Glossary.DD,Adam Task"$'s memory including the code in the $FG,2$/Adam$FG$ and $FG,2$/Home$FG$ directories.
It is possible to do a fast reboot without doing a hardware reset. You might do this when working on $LK,"::/Kernel.BIN.C",A="FI:::/Kernel/Kernel.PRJ"$$FG$ or your start-up scripts when you want to compile them effect. See $LK,"BootRAM",A="MN:BootRAM"$().
$SP,"",BI=1$
<EFBFBD>
<EFBFBD>
\<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD> <EFBFBD>
<EFBFBD> <EFBFBD>16-Bit Real Mode
h|h$$,DLblh|<EFBFBD>{,TempleOS CD-ROM
Boot Loader<EFBFBD>TempleOS MBR
Stage 1<EFBFBD>0TempleOS MBR
Stage 2<EFBFBD>PTempleOS Partition
Boot Blk<EFBFBD>p/Kernel.BIN.C
(16-Bit)
(32-Bit)
(64-Bit)
<EFBFBD><EFBFBD>/Compiler/Compiler.BIN.Z<EFBFBD>/StartOS.HC.Z<EFBFBD> /Adam/MakeAdam.HC.Z
<EFBFBD>H/Home/MakeHome.HC.Z
<EFBFBD>h/Home/Once.HC.Z<EFBFBD>X\Xd<EFBFBD>\<EFBFBD>dD<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DDfD<EFBFBD>hRAMReboot()
Soft BootPxRLf_16BITP<EFBFBD>RLf_VGAP<EFBFBD>RLf_32BITP<EFBFBD>RLf_PATCHEDP<EFBFBD>RLf_16MEG_SYS_CODE_BPP<EFBFBD>RLf_64BITP<EFBFBD>RLf_16MEG_ADAM_HEAP_CTRLP<EFBFBD>RLf_FULL_HEAPSP<EFBFBD>RLf_RAWP<EFBFBD>RLf_INTERRUPTSP<EFBFBD>RLf_BLKDEVP<EFBFBD>RLf_MP|<EFBFBD>RLf_COMPILERh RLf_DOCh(RLf_WINMGRh0RLf_REGISTRYhHRLf_HOMEhPRLf_AUTO_COMPLETEhXRLf_ADAM_SERVERhhRLf_ONCE_ADAMhpRLf_ONCE_USER