ZealOS/docs/Doc/Boot.DD.html

126 lines
9.9 KiB
HTML
Raw Normal View History

2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
2021-08-17 07:47:37 +01:00
<meta name="generator" content="ZealOS V1.00">
2021-07-03 05:07:57 +01:00
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
2021-07-03 05:07:57 +01:00
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF5> Booting A PC</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l2"></a>
<a name="l3"></a>ZealOS only supports traditional </span><span class=cF2>BIOS</span><span class=cF0> booting, not the newer technique, </span><span class=cF2>UEFI</span><span class=cF0>. This document describes </span><span class=cF2>BIOS</span><span class=cF0> booting.
<a name="l4"></a>
<a name="l5"></a>When you turn-on (power-up) a computer or you do a hardware reset, the computer starts executing the </span><span class=cF2>BIOS</span><span class=cF0>. Sometimes, you
<a name="l6"></a>must change the </span><span class=cF2>BIOS</span><span class=cF0> boot order to boot the device you want.
2021-07-03 05:07:57 +01:00
<a name="l7"></a>
<a name="l8"></a>The </span><span class=cF2>BIOS</span><span class=cF0> loads a boot sector from CD/DVD, hard disk or whatever. The boot sector runs in 16-bit real mode and often
<a name="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
<a name="l10"></a>assembly language. Most boot sectors use the </span><span class=cF2>BIOS</span><span class=cF0> to load-in the next stage.
2021-07-03 05:07:57 +01:00
<a name="l11"></a>
<a name="l12"></a>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
<a name="l13"></a>because they run in 16-bit mode. This means they usually can't just load the whole operating system and start it running.
2021-07-03 05:07:57 +01:00
<a name="l14"></a>Some boot loaders, like Grub, have a capability of switching modes before handing-off control to the operating system. The
<a name="l15"></a>operating system must load the rest of itself. With ZealOS, the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Boot/Kernel.BIN.C</span></a><span class=cF0> file is loaded by the boot sector. We
<a name="l16"></a>try to put a minimum in the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>Kernel Module</span></a><span class=cF0>, so that it will always fit in 640K. When Kernel.BIN runs, it switches to 32-bit
<a name="l17"></a>mode, then, to 64-bit mode allowing access to more memory. Then, it loads in the rest of ZealOS by executing </span><a href="https://zeal-operating-system.github.io/ZealOS/StartOS.CC.html#l1"><span class=cF4>::/StartOS.CC</span></a><span class=cF0>.
2021-07-03 05:07:57 +01:00
<a name="l18"></a>
<a name="l19"></a>All the boot related code for ZealOS is in the </span><span class=cF2>/System/Boot</span><span class=cF0> directory.
<a name="l20"></a></span><span class=cF4>
<a name="l21"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootDVD.CC.html#l1"><span class=cF4>BootDVD.CC</span></a><span class=cF0> CD/DVD boot sector.</span><span class=cF4>
<a name="l22"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootDVDIns.CC.html#l1"><span class=cF4>BootDVDIns.CC</span></a><span class=cF0> Prep for CD/DVD install by creating </span><span class=cF2>/Boot/DVDKernel.BIN.C</span><span class=cF0>.
<a name="l23"></a>If you are curious about CD/DVDs, see </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/DiskISORedSea.CC.html#l1"><span class=cF4>DiskISORedSea.CC</span></a><span class=cF0>. To make a custom bootable CD/DVD, look here </span><a href="https://zeal-operating-system.github.io/ZealOS/Misc/DoDistro.CC.html#l1"><span class=cF4>Bootable CD</span></a><span class=cF0>.
2021-07-03 05:07:57 +01:00
<a name="l24"></a></span><span class=cF4>
<a name="l25"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootMHD.CC.html#l1"><span class=cF4>BootMHD.CC</span></a><span class=cF0> Stage 1 Master HD boot loader.</span><span class=cF4>
<a name="l26"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootMHD2.CC.html#l1"><span class=cF4>BootMHD2.CC</span></a><span class=cF0> Stage 2 Master HD boot loader.</span><span class=cF4>
<a name="l27"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootMHDIns.CC.html#l1"><span class=cF4>BootMHDIns.CC</span></a><span class=cF0> Installs Master HD boot loader.
<a name="l28"></a></span><span class=cF2>BootMHD</span><span class=cF0> goes on block zero. </span><span class=cF2>/Boot/BootMHD2.BIN.C</span><span class=cF0> is stored as a file in a partition, risky and unusual, since most master
2021-07-03 05:07:57 +01:00
<a name="l29"></a>boot loaders place stage 2 in a gap that's not in any partition. </span><span class=cF2>BootMHD2</span><span class=cF0> displays a menu and boots a partition.
<a name="l30"></a></span><span class=cF4>
<a name="l31"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHD.CC.html#l1"><span class=cF4>BootHD.CC</span></a><span class=cF0> HD partition boot record.</span><span class=cF4>
<a name="l32"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l1"><span class=cF4>BootHDIns.CC</span></a><span class=cF0> Installs HD partition boot record at </span><span class=cF2>/Boot/Kernel.BIN.C</span><span class=cF0>.
2021-07-03 05:07:57 +01:00
<a name="l33"></a></span><span class=cF2>BootHD</span><span class=cF0> is the boot record for a ZealOS partition. Each partition has its own partition boot record, the first block of the
<a name="l34"></a>partition.
<a name="l35"></a>
<a name="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
<a name="l37"></a>file system layout. Instead, they get patched with the LBA, logical block addresses, to load files. To update with a new
<a name="l38"></a>ZealOS kernel, you must create a </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Boot/Kernel.BIN.C</span></a><span class=cF0> binary file and patch the boot loader so it knows the LBA blocks to
<a name="l39"></a>load. Therefore, you usually recompile the kernel and update the boot sector at the same time with </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l25"><span class=cF4>BootHDIns</span></a><span class=cF0>(). </span><span class=cF4>
<a name="l40"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootMHDIns.CC.html#l76"><span class=cF4>BootMHDIns</span></a><span class=cF0>() will install a master boot loader.
2021-07-03 05:07:57 +01:00
<a name="l41"></a>
<a name="l42"></a>With ZealOS, </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Boot/Kernel.BIN.C</span></a><span class=cF0> loads </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/Compiler.PRJ.html#l1"><span class=cF4>::/Compiler/Compiler.BIN</span></a><span class=cF0> so it can work with source code from then on. It compiles
<a name="l43"></a>start-up scripts beginning with </span><a href="https://zeal-operating-system.github.io/ZealOS/StartOS.CC.html#l1"><span class=cF4>::/StartOS.CC</span></a><span class=cF0> into the </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l154"><span class=cF4>System Task</span></a><span class=cF0>'s memory including the code in the </span><span class=cF2>/System</span><span class=cF0> and </span><span class=cF2>/Home</span><span class=cF0>
<a name="l44"></a>directories.
<a name="l45"></a>
<a name="l46"></a>It is possible to do a fast reboot without doing a hardware reset. You might do this when working on </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Boot/Kernel.BIN.C</span></a><span class=cF0> or
<a name="l47"></a>your start-up scripts when you want to compile them effect. See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootRAM.CC.html#l33"><span class=cF4>BootRAM</span></a><span class=cF0>().
<a name="l48"></a>
<a name="l49"></a></span><span class=cFA>
<a name="l50"></a>/* Graphics Not Rendered in HTML */</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l51"></a>
<a name="l52"></a>
<a name="l53"></a>
<a name="l54"></a>
<a name="l55"></a>
<a name="l56"></a>
<a name="l57"></a>
<a name="l58"></a>
<a name="l59"></a>
<a name="l60"></a>
<a name="l61"></a>
<a name="l62"></a>
<a name="l63"></a>
<a name="l64"></a>
<a name="l65"></a>
<a name="l66"></a>
<a name="l67"></a>
<a name="l68"></a>
<a name="l69"></a>
<a name="l70"></a>
<a name="l71"></a>
<a name="l72"></a>
<a name="l73"></a>
<a name="l74"></a>
<a name="l75"></a>
<a name="l76"></a>
<a name="l77"></a>
<a name="l78"></a>
<a name="l79"></a>
<a name="l80"></a>
<a name="l81"></a>
<a name="l82"></a>
<a name="l83"></a>
<a name="l84"></a>
<a name="l85"></a>
<a name="l86"></a>
<a name="l87"></a>
<a name="l88"></a>
<a name="l89"></a>
<a name="l90"></a>
<a name="l91"></a>
<a name="l92"></a>
<a name="l93"></a>
<a name="l94"></a>
<a name="l95"></a>
<a name="l96"></a>
2021-07-03 05:07:57 +01:00
</span></pre></body>
</html>