mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
113 lines
11 KiB
HTML
Executable file
113 lines
11 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.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;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Install.DD.html#l1"><span class=cF4>Install Documentation</span></a><span class=cF2>.</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF2>//Study the account examples: </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSConfig.CC.html#l1"><span class=cF4>Config Strs</span></a><span class=cF2>, </span><a href="https://zeal-operating-system.github.io/ZealOS/Demo/AcctExample/TOS/TOSDistro.CC.html#l1"><span class=cF4>Update Funs</span></a><span class=cF0>
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"BootHD"</span><span class=cF0>
|
|
<a name="l5"></a>
|
|
<a name="l6"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Install"</span><span class=cF0>
|
|
<a name="l7"></a>
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0> </span><span class=cF6>"Kernel.BIN.C"</span><span class=cF0>
|
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>"/Boot"</span><span class=cF0>
|
|
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0> </span><span class=cF3>BOOT_DIR</span><span class=cF0> </span><span class=cF6>"/"</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0>
|
|
<a name="l11"></a>
|
|
<a name="l12"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CompComp</span><span class=cF0>()
|
|
<a name="l13"></a>{
|
|
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Comp</span><span class=cF7>(</span><span class=cF6>"/Compiler/Compiler"</span><span class=cF0>, </span><span class=cF6>"Compiler"</span><span class=cF0>,, </span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l15"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l16"></a>}
|
|
<a name="l17"></a>
|
|
<a name="l18"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MakeAll</span><span class=cF0>()
|
|
<a name="l19"></a>{
|
|
<a name="l20"></a> </span><span class=cF5>CompComp</span><span class=cF0>;
|
|
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Comp</span><span class=cF7>(</span><span class=cF6>"/Kernel/Kernel"</span><span class=cF0>, </span><span class=cF6>"Kernel"</span><span class=cF0>,, </span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l22"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l23"></a>}
|
|
<a name="l24"></a>
|
|
<a name="l25"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootHDIns</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l26"></a>{</span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l18"><span class=cF4>MakeAll</span></a><span class=cF2> and install new boot-loader.</span><span class=cF0>
|
|
<a name="l27"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive;
|
|
<a name="l28"></a> </span><span class=cF9>CFAT32Boot</span><span class=cF0> br;
|
|
<a name="l29"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> de;
|
|
<a name="l30"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l31"></a>
|
|
<a name="l32"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF0>drv_let</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l35"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l36"></a>
|
|
<a name="l37"></a> drive = </span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
|
<a name="l38"></a> </span><span class=cF5>MakeAll</span><span class=cF0>;
|
|
<a name="l39"></a>
|
|
<a name="l40"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>Letter2BlkDevType</span><span class=cF7>(</span><span class=cF0>drive->drv_let</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l41"></a> {
|
|
<a name="l42"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_RAM</span><span class=cF0>:
|
|
<a name="l43"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>BDT_ATA</span><span class=cF0>:
|
|
<a name="l44"></a> </span><span class=cF5>Move</span><span class=cF0>(</span><span class=cF6>"/Kernel/Kernel.BIN"</span><span class=cF0>, </span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0>);
|
|
<a name="l45"></a>
|
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF3>BOOT_DIR_KERNEL_BIN_C</span><span class=cF0>, &de, </span><span class=cF3>FUF_JUST_FILES</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l47"></a> </span><span class=cF6>"No Kernel.BIN.C\n"</span><span class=cF0>;
|
|
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l49"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF5>Free</span><span class=cF0>(de.full_name);
|
|
<a name="l51"></a> </span><span class=cF6>"Modifying partition boot record.\n"</span><span class=cF0>;
|
|
<a name="l52"></a> </span><span class=cF5>BlkRead</span><span class=cF0>(drive, &br, drive->drv_offset, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l53"></a>
|
|
<a name="l54"></a> br.jump_and_nop[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cF3>OC_JMP_REL8</span><span class=cF0>;
|
|
<a name="l55"></a> br.jump_and_nop[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code) - </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l56"></a>
|
|
<a name="l57"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code) >= </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CRedSeaBoot</span><span class=cF0>.code)
|
|
<a name="l58"></a>
|
|
<a name="l59"></a> br.jump_and_nop[</span><span class=cFE>2</span><span class=cF0>] = </span><span class=cF3>OC_NOP</span><span class=cF0>;
|
|
<a name="l60"></a> *</span><span class=cFD>BHD_BLK_COUNT</span><span class=cF0>(</span><span class=cF9>U16</span><span class=cF0> *) = (de.size + </span><span class=cF3>BLK_SIZE</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>) >> </span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
|
|
<a name="l61"></a> *</span><span class=cFD>BHD_DAP_BLK</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> *) = </span><span class=cF5>Clus2Blk</span><span class=cF0>(drive, de.clus);
|
|
<a name="l62"></a>
|
|
<a name="l63"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFD>BHD_END</span><span class=cF0> - </span><span class=cFD>BHD_CODE</span><span class=cF0>; i++)
|
|
<a name="l64"></a> br.code[i] = </span><span class=cFD>BHD_CODE</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *)[i];
|
|
<a name="l65"></a>
|
|
<a name="l66"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code) >= </span><span class=cFD>BHD_END</span><span class=cF0> - </span><span class=cFD>BHD_CODE</span><span class=cF0>
|
|
<a name="l67"></a>
|
|
<a name="l68"></a> </span><span class=cF1>for</span><span class=cF0> (; i < </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CFAT32Boot</span><span class=cF0>.code</span><span class=cF7>)</span><span class=cF0>; i++)
|
|
<a name="l69"></a> br.code[i] = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l70"></a>
|
|
<a name="l71"></a> </span><span class=cF5>BlkWrite</span><span class=cF0>(drive, &br, drive->drv_offset, </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l72"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l74"></a>
|
|
<a name="l75"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l76"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l77"></a> }
|
|
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l79"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l81"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l82"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l84"></a>}
|
|
</span></pre></body>
|
|
</html>
|