ZealOS/docs/Doc/Boot.DD.html

125 lines
9.6 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">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
2021-07-03 05:07:57 +01:00
<a name="l1"></a><span class=cF5> Booting A PC</span><span class=cF0>
<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 must
2021-07-03 05:07:57 +01:00
<a name="l6"></a>change the </span><span class=cF2>BIOS</span><span class=cF0> boot order to boot the device you want.
<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 loads-in
2021-07-03 05:07:57 +01:00
<a name="l9"></a>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
<a name="l10"></a>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://tomawezome.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Kernel.BIN.C</span></a><span class=cF0> file is loaded by the boot sector. We try to
<a name="l16"></a>put a minimum in the </span><a href="https://tomawezome.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 mode, then,
<a name="l17"></a>to 64-bit mode allowing access to more memory. Then, it loads in the rest of ZealOS by executing </span><a href="https://tomawezome.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://tomawezome.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://tomawezome.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>/0000Boot/0000Kernel.BIN.C</span><span class=cF0>.
<a name="l23"></a>If you are curious about CD/DVDs, see </span><a href="https://tomawezome.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://tomawezome.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://tomawezome.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://tomawezome.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://tomawezome.github.io/ZealOS/System/Boot/BootMHDIns.CC.html#l1"><span class=cF4>BootMHDIns.CC</span></a><span class=cF0> Installs Master HD boot loader.
2021-07-03 05:07:57 +01:00
<a name="l28"></a></span><span class=cF2>BootMHD</span><span class=cF0> goes on block zero. </span><span class=cF2>/0000Boot/BootMHD2.BIN.C</span><span class=cF0> is stored as a file in a partition, risky and unusual, since most master
<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://tomawezome.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://tomawezome.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l1"><span class=cF4>BootHDIns.CC</span></a><span class=cF0> Installs HD partition boot record.
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://tomawezome.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Kernel.BIN.C</span></a><span class=cF0> binary file and patch the boot loader so it knows the LBA blocks to load. Ther
<a name="l39"></a>efore, you usually recompile the kernel and update the boot sector at the same time with </span><a href="https://tomawezome.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l24"><span class=cF4>BootHDIns</span></a><span class=cF0>(). </span><a href="https://tomawezome.github.io/ZealOS/System/Boot/BootMHDIns.CC.html#l76"><span class=cF4>BootMHDIns</span></a><span class=cF0>() will
2021-07-03 05:07:57 +01:00
<a name="l40"></a>install a master boot loader.
<a name="l41"></a>
<a name="l42"></a>With ZealOS, </span><a href="https://tomawezome.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Kernel.BIN.C</span></a><span class=cF0> loads </span><a href="https://tomawezome.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 start-up
<a name="l43"></a>scripts beginning with </span><a href="https://tomawezome.github.io/ZealOS/StartOS.CC.html#l1"><span class=cF4>::/StartOS.CC</span></a><span class=cF0> into the </span><a href="https://tomawezome.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> directories.
2021-07-03 05:07:57 +01:00
<a name="l44"></a>
<a name="l45"></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://tomawezome.github.io/ZealOS/Kernel/Kernel.PRJ.html#l1"><span class=cF4>::/Kernel.BIN.C</span></a><span class=cF0> or your
<a name="l46"></a>start-up scripts when you want to compile them effect. See </span><a href="https://tomawezome.github.io/ZealOS/System/Boot/BootRAM.CC.html#l33"><span class=cF4>BootRAM</span></a><span class=cF0>().
2021-07-03 05:07:57 +01:00
<a name="l47"></a>
<a name="l48"></a></span><span class=cFA>
<a name="l49"></a>/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l50"></a>
<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>
</span></pre></body>
</html>