mirror of https://github.com/minexew/Shrine.git
88 changed files with 2444 additions and 2038 deletions
Binary file not shown.
@ -0,0 +1,33 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
#include "BootDVD" |
||||
#include "DskISORedSea" |
||||
#include "DskISO9660" |
||||
|
||||
#help_index "Install" |
||||
|
||||
#define KERNEL_BIN_C "Kernel.BIN.C" |
||||
#define BOOT_DIR "/0000Boot" |
||||
#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C |
||||
|
||||
U0 MakeAll() |
||||
{ |
||||
if (Cmp("/Compiler/Compiler","Compiler",,':')) |
||||
throw; |
||||
if (Cmp("/Kernel/Kernel","Kernel",,':')) |
||||
throw; |
||||
} |
||||
|
||||
public U0 BootDVDIns(U8 drv_let=0) |
||||
{//See $LK,"::/Misc/DoDistro.CPP"$.
|
||||
try { |
||||
if (!Drv(drv_let)) |
||||
throw; |
||||
MakeAll; |
||||
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C); |
||||
} catch { |
||||
PutExcept; |
||||
Beep; |
||||
} |
||||
} |
@ -0,0 +1,60 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
#include "BootHD" |
||||
|
||||
#help_index "Install" |
||||
|
||||
#define KERNEL_BIN_C "Kernel.BIN.C" |
||||
|
||||
U0 MakeAll() |
||||
{ |
||||
if (Cmp("/Compiler/Compiler","Compiler",,':')) |
||||
throw; |
||||
if (Cmp("/Kernel/Kernel","Kernel",,':')) |
||||
throw; |
||||
} |
||||
|
||||
public U0 BootHDIns(U8 drv_let=0) |
||||
{//$LK,"MakeAll",A="MN:MakeAll"$ and install new boot-loader.
|
||||
CDrv *dv; |
||||
CFAT32Boot br; |
||||
CDirEntry de; |
||||
I64 i; |
||||
try { |
||||
if (!Drv(drv_let)) |
||||
throw; |
||||
dv=Fs->cur_dv; |
||||
MakeAll; |
||||
switch (Let2BlkDevType(dv->drv_let)) { |
||||
case BDT_RAM: |
||||
case BDT_ATA: |
||||
Move("/Kernel/Kernel.BIN.Z","/" KERNEL_BIN_C); |
||||
if (!FileFind("/" KERNEL_BIN_C,&de,FUF_JUST_FILES)) |
||||
"No Kernel.BIN.C\n"; |
||||
else { |
||||
Free(de.full_name); |
||||
"Modifying partition boot record.\n"; |
||||
RBlks(dv,&br,dv->drv_offset,1); |
||||
br.jump_and_nop[0]=OC_JMP_REL8; |
||||
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2; |
||||
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code) |
||||
br.jump_and_nop[2]=OC_NOP; |
||||
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS; |
||||
*BHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster); |
||||
for (i=0;i<BHD_END-BHD_CODE;i++) |
||||
br.code[i]=BHD_CODE(U8 *)[i]; |
||||
#assert sizeof(CFAT32Boot.code)>=BHD_END-BHD_CODE |
||||
for (;i<sizeof(CFAT32Boot.code);i++) |
||||
br.code[i]=0; |
||||
WBlks(dv,&br,dv->drv_offset,1); |
||||
} |
||||
break; |
||||
default: |
||||
throw; |
||||
} |
||||
} catch { |
||||
PutExcept; |
||||
Beep; |
||||
} |
||||
} |
@ -1,98 +1,18 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
|
||||
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
#include "BootMHD" |
||||
#include "BootMHD2" |
||||
|
||||
#help_index "Install" |
||||
|
||||
#define KERNEL_BIN_C "Kernel.BIN.C" |
||||
#define BOOT_DIR "/0000Boot" |
||||
#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C |
||||
//Stage 2 of master boot loader
|
||||
#define BOOT_DIR_BOOTMHD2_BIN_C BOOT_DIR "/BootMHD2.BIN.C" |
||||
//Old master boot record
|
||||
#define BOOT_DIR_OLDMBR_BIN_C BOOT_DIR "/OldMBR.BIN.C" |
||||
|
||||
public U0 MakeAll() |
||||
{//Use $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$. Loader must be patched.
|
||||
//These 2 modules (and bootloaders at top) are the only AOT
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
if (Cmp("/Compiler/Compiler","Compiler",,':')) |
||||
throw; |
||||
if (Cmp("/Kernel/Kernel","Kernel",,':')) |
||||
throw; |
||||
} |
||||
|
||||
public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0) |
||||
{// Does $LK,"MakeAll",A="MN:MakeAll"$and installs new boot-loader.
|
||||
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
|
||||
//If you are making a bootable CD/DVD, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/DoDistro.CPP"$
|
||||
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
CBlkDev *bd; |
||||
CDrv *dv; |
||||
CFAT32Boot br; |
||||
CDirEntry de; |
||||
Bool res=FALSE; |
||||
I64 i,type; |
||||
try { |
||||
if (!src_drv) src_drv=Drv2Let(Fs->cur_dv); |
||||
src_drv=ToUpper(src_drv); |
||||
if (!dst_drv) dst_drv=src_drv; |
||||
dst_drv=ToUpper(dst_drv); |
||||
if (!Drv(src_drv)) |
||||
throw; |
||||
MakeAll; |
||||
if ((dv=Let2Drv(dst_drv,FALSE)) && (bd=dv->bd)) |
||||
type=bd->type; |
||||
else { |
||||
type=BDT_ATAPI; |
||||
PrintWarn("Defaulting to CD/DVD dst.\n"); |
||||
} |
||||
switch (type) { |
||||
case BDT_ATAPI: |
||||
case BDT_FILE: |
||||
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C); |
||||
res=TRUE; |
||||
break; |
||||
case BDT_RAM: |
||||
case BDT_ATA: |
||||
Move("/Kernel/Kernel.BIN.Z","/" KERNEL_BIN_C); |
||||
if (!FileFind("/" KERNEL_BIN_C,&de,FUF_JUST_FILES)) |
||||
"No Kernel.BIN.C\n"; |
||||
else { |
||||
Free(de.full_name); |
||||
"Modifying partition boot record.\n"; |
||||
RBlks(dv,&br,dv->drv_offset,1); |
||||
br.jump_and_nop[0]=OC_JMP_REL8; |
||||
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2; |
||||
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code) |
||||
br.jump_and_nop[2]=OC_NOP; |
||||
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS; |
||||
|