<aname="l3"></a>ZealOS only supports traditional </span><spanclass=cF2>BIOS</span><spanclass=cF0> booting, not the newer technique, </span><spanclass=cF2>UEFI</span><spanclass=cF0>. This document describes </span><spanclass=cF2>BIOS</span><spanclass=cF0> booting.
<aname="l5"></a>When you turn-on (power-up) a computer or you do a hardware reset, the computer starts executing the </span><spanclass=cF2>BIOS</span><spanclass=cF0>. Sometimes, you
<aname="l6"></a>must change the </span><spanclass=cF2>BIOS</span><spanclass=cF0> boot order to boot the device you want.
<aname="l8"></a>The </span><spanclass=cF2>BIOS</span><spanclass=cF0> loads a boot sector from CD/DVD, hard disk or whatever. The boot sector runs in 16-bit real mode and often
<aname="l9"></a>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
<aname="l10"></a>assembly language. Most boot sectors use the </span><spanclass=cF2>BIOS</span><spanclass=cF0> to load-in the next stage.
<aname="l15"></a>operating system must load the rest of itself. With ZealOS, the </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><spanclass=cF4>::/Boot/Kernel.BIN.C</span></a><spanclass=cF0> file is loaded by the boot sector. We
<aname="l16"></a>try to put a minimum in the </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><spanclass=cF4>Kernel Module</span></a><spanclass=cF0>, so that it will always fit in 640K. When Kernel.BIN runs, it switches to 32-bit
<aname="l17"></a>mode, then, to 64-bit mode allowing access to more memory. Then, it loads in the rest of ZealOS by executing </span><ahref="https://zeal-operating-system.github.io/ZealOS/StartOS.CC.html#l1"><spanclass=cF4>::/StartOS.CC</span></a><spanclass=cF0>.
<aname="l22"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootDVDIns.CC.html#l1"><spanclass=cF4>BootDVDIns.CC</span></a><spanclass=cF0> Prep for CD/DVD install by creating </span><spanclass=cF2>/Boot/DVDKernel.BIN.C</span><spanclass=cF0>.
<aname="l23"></a>If you are curious about CD/DVDs, see </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/DiskISORedSea.CC.html#l1"><spanclass=cF4>DiskISORedSea.CC</span></a><spanclass=cF0>. To make a custom bootable CD/DVD, look here </span><ahref="https://zeal-operating-system.github.io/ZealOS/Misc/DoDistro.CC.html#l1"><spanclass=cF4>Bootable CD</span></a><spanclass=cF0>.
<aname="l28"></a></span><spanclass=cF2>BootMHD</span><spanclass=cF0> goes on block zero. </span><spanclass=cF2>/Boot/BootMHD2.BIN.C</span><spanclass=cF0> is stored as a file in a partition, risky and unusual, since most master
<aname="l29"></a>boot loaders place stage 2 in a gap that's not in any partition. </span><spanclass=cF2>BootMHD2</span><spanclass=cF0> displays a menu and boots a partition.
<aname="l31"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHD.CC.html#l1"><spanclass=cF4>BootHD.CC</span></a><spanclass=cF0> HD partition boot record.</span><spanclass=cF4>
<aname="l32"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l1"><spanclass=cF4>BootHDIns.CC</span></a><spanclass=cF0> Installs HD partition boot record at </span><spanclass=cF2>/Boot/Kernel.BIN.C</span><spanclass=cF0>.
<aname="l33"></a></span><spanclass=cF2>BootHD</span><spanclass=cF0> is the boot record for a ZealOS partition. Each partition has its own partition boot record, the first block of the
<aname="l34"></a>partition.
<aname="l35"></a>
<aname="l36"></a>The boot records don't access directories because that would make them too big for one block and would make them depend on a
<aname="l37"></a>file system layout. Instead, they get patched with the LBA, logical block addresses, to load files. To update with a new
<aname="l38"></a>ZealOS kernel, you must create a </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><spanclass=cF4>::/Boot/Kernel.BIN.C</span></a><spanclass=cF0> binary file and patch the boot loader so it knows the LBA blocks to
<aname="l39"></a>load. Therefore, you usually recompile the kernel and update the boot sector at the same time with </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l25"><spanclass=cF4>BootHDIns</span></a><spanclass=cF0>(). </span><spanclass=cF4>
<aname="l40"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootMHDIns.CC.html#l76"><spanclass=cF4>BootMHDIns</span></a><spanclass=cF0>() will install a master boot loader.
<aname="l42"></a>With ZealOS, </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><spanclass=cF4>::/Boot/Kernel.BIN.C</span></a><spanclass=cF0> loads </span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/Compiler.PRJ.html#l1"><spanclass=cF4>::/Compiler/Compiler.BIN</span></a><spanclass=cF0> so it can work with source code from then on. It compiles
<aname="l43"></a>start-up scripts beginning with </span><ahref="https://zeal-operating-system.github.io/ZealOS/StartOS.CC.html#l1"><spanclass=cF4>::/StartOS.CC</span></a><spanclass=cF0> into the </span><ahref="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l154"><spanclass=cF4>System Task</span></a><spanclass=cF0>'s memory including the code in the </span><spanclass=cF2>/System</span><spanclass=cF0> and </span><spanclass=cF2>/Home</span><spanclass=cF0>
<aname="l46"></a>It is possible to do a fast reboot without doing a hardware reset. You might do this when working on </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><spanclass=cF4>::/Boot/Kernel.BIN.C</span></a><spanclass=cF0> or
<aname="l47"></a>your start-up scripts when you want to compile them effect. See </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootRAM.CC.html#l33"><spanclass=cF4>BootRAM</span></a><spanclass=cF0>().