TempleOSCDV4.09.ISO
This commit is contained in:
1 parent
2d56cda5f3
commit
353eac0dbe
88 files changed
+2449
-2043
No files matched your search
@@ -1,4 +1,3 @@
|
||||
#define DVD_BOOT_LOADER_SIZE DVD_BLK_SIZE*1 //Max DVD_BLK_SIZE*4, I think
|
||||
#define BOOT_HIGH_LOC_DVD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -48,12 +48,12 @@ BHD_GET_IP:
|
||||
|
||||
BHD_BIOS_DRV_NUM: DU8 0;
|
||||
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BHD_BLK_CNT:: DU16 0;
|
||||
|
||||
BHD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
BHD_DAP_BUF: DU16 0,0;
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BHD_DAP_BLK:: //64-bit
|
||||
BHD_DAP_BLK_LO: DU32 0;
|
||||
BHD_DAP_BLK_HI: DU32 0;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -61,12 +61,12 @@ BMHD_GET_IP:
|
||||
|
||||
BMHD_BIOS_DRV_NUM: DU8 0;
|
||||
BMHD_OLD_CS_IP: DU16 0,0;
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BMHD_BLK_CNT:: DU16 0;
|
||||
|
||||
BMHD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
BMHD_DAP_BUF: DU16 0,0;
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BMHD_DAP_BLK:: //64-bit
|
||||
BMHD_DAP_BLK_LO: DU32 0;
|
||||
BMHD_DAP_BLK_HI: DU32 0;
|
||||
|
||||
@@ -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;
|
||||
*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);
|
||||
res=TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
PutExcept;
|
||||
Beep;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
public U0 BootMHDOldRead(U8 src_drv,U8 dst_drv)
|
||||
{//Reads MBR from disk drive containing src partition.
|
||||
//Writes a single blk file to dst BOOT_DIR.
|
||||
CBlkDev *bd=Let2BlkDev(src_drv);
|
||||
@@ -114,7 +34,7 @@ public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
}
|
||||
}
|
||||
|
||||
public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
public U0 BootMHDOldWrite(U8 src_drv,U8 dst_drv)
|
||||
{//Reads OldMBR from src drive BOOT_DIR.
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
@@ -129,7 +49,7 @@ public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
Free(mbr);
|
||||
}
|
||||
|
||||
public U0 MasterBootZero(U8 dst_drv)
|
||||
public U0 BootMHDZero(U8 dst_drv)
|
||||
{//Set MBR of disk with dst partition to zero.
|
||||
|
||||
//This is dangerous!!
|
||||
@@ -146,7 +66,7 @@ public U0 MasterBootZero(U8 dst_drv)
|
||||
BlkDevUnlock(bd);
|
||||
}
|
||||
|
||||
public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
public Bool BootMHDIns(U8 drv_let,U8 *drv_lst=NULL)
|
||||
{//Create new MBR on the disk that has drv_let as a partition.
|
||||
//Puts stage 2 in BOOT_DIR of drv_let.
|
||||
CBlkDev *bd,*bd1;
|
||||
@@ -167,7 +87,6 @@ public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
buf[j++]=i;
|
||||
buf[j++]=0;
|
||||
}
|
||||
|
||||
Drv(drv_let);
|
||||
dv=Fs->cur_dv;
|
||||
if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
|
||||
@@ -175,7 +94,7 @@ public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
else {
|
||||
bd=dv->bd;
|
||||
if (!FileFind(BOOT_DIR_OLDMBR_BIN_C,,FUF_JUST_FILES))
|
||||
MasterBootOldRead(drv_let,drv_let);
|
||||
BootMHDOldRead(drv_let,drv_let);
|
||||
|
||||
_q=BMHD2_BLK_ARRAY;
|
||||
MemSet(_q,0,sizeof(I64)*8);
|
||||
@@ -30,7 +30,7 @@ _extern _HI_CALL I64 HiCall(U8 *machine_code);
|
||||
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
|
||||
|
||||
#help_index "Boot"
|
||||
public U0 RAMReboot(U8 *filename)
|
||||
public U0 BootRAM(U8 *filename)
|
||||
{//Softboot Kernel Bin file. No hardware reset.
|
||||
I64 size;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),
|
||||
@@ -67,40 +67,36 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
|
||||
iso_term->type=ISO1T_TERMINATOR;
|
||||
StrCpy(iso_term->id,"CD001");
|
||||
iso_term->version=1;
|
||||
if (stage2_blk) {
|
||||
d=iso_boot(U8 *)+0x47;
|
||||
*d=20<<2>>2;
|
||||
FWBlks(out_file,iso_boot,17<<2,4);
|
||||
|
||||
FWBlks(out_file,iso_sup,18<<2,4);
|
||||
FWBlks(out_file,iso_term,19<<2,4);
|
||||
d=iso_boot(U8 *)+0x47;
|
||||
*d=20<<2>>2;
|
||||
FWBlks(out_file,iso_boot,17<<2,4);
|
||||
|
||||
et->w[0]=1;
|
||||
StrCpy(&et->w[2],"TempleOS");
|
||||
et->w[15]=0xAA55;
|
||||
j=0;
|
||||
for (i=0;i<16;i++) //Checksum
|
||||
j+=et->w[i];
|
||||
et->w[14]=-j;
|
||||
et->bootable=0x88;
|
||||
et->media_type=0;//0=no emu 2=1.44meg 4=hard drive
|
||||
et->sect_cnt=4; //5 seems like the limit, 4 is safer
|
||||
et->load_rba=20<<2>>2+1;
|
||||
FWBlks(out_file,et,20<<2,4);
|
||||
FWBlks(out_file,iso_sup,18<<2,4);
|
||||
FWBlks(out_file,iso_term,19<<2,4);
|
||||
|
||||
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
|
||||
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=stage2_blk>>2;
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
|
||||
(stage2_size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
|
||||
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=stage2_blk&3;
|
||||
if (stage2_blk&3)
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
|
||||
FWBlks(out_file,stage1_buf,
|
||||
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
} else {
|
||||
FWBlks(out_file,iso_sup,17<<2,4);
|
||||
FWBlks(out_file,iso_term,18<<2,4);
|
||||
}
|
||||
et->w[0]=1;
|
||||
StrCpy(&et->w[2],"TempleOS");
|
||||
et->w[15]=0xAA55;
|
||||
j=0;
|
||||
for (i=0;i<16;i++) //Checksum
|
||||
j+=et->w[i];
|
||||
et->w[14]=-j;
|
||||
et->bootable=0x88;
|
||||
et->media_type=0;//0=no emu 2=1.44meg 4=hard drive
|
||||
et->sect_cnt=4; //5 seems like the limit, 4 is safer
|
||||
et->load_rba=20<<2>>2+1;
|
||||
FWBlks(out_file,et,20<<2,4);
|
||||
|
||||
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
|
||||
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=stage2_blk>>2;
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
|
||||
(stage2_size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
|
||||
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=stage2_blk&3;
|
||||
if (stage2_blk&3)
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
|
||||
FWBlks(out_file,stage1_buf,
|
||||
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
FClose(out_file);
|
||||
}
|
||||
Free(zero_buf);
|
||||
@@ -135,8 +131,8 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
I64 i,res,root_cnt,root_dir_blks,bitmap_blks,bitmap_blks1;
|
||||
CDirEntry *tempde,de;
|
||||
U8 buf[STR_LEN],*iso_filename,*src_dir,*stage2_filename;
|
||||
CDrv *dv=DrvNextFree('M'); //First $LK,"BDT_FILE",A="MN:BDT_FILE"$
|
||||
CBlkDev *bd=BlkDevNextFree(dv->drv_let,BDT_FILE);
|
||||
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('Q')); //First $LK,"BDT_FILE_WRITE",A="MN:BDT_FILE_WRITE"$
|
||||
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_FILE_WRITE);
|
||||
|
||||
if (!_iso_filename)
|
||||
_iso_filename=blkdev.dft_iso_filename;
|
||||
@@ -155,10 +151,7 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
root_cnt=LinkedLstCnt(tempde)+3;
|
||||
root_dir_blks=CeilU64(root_cnt<<6,BLK_SIZE)>>BLK_SIZE_BITS;
|
||||
if (res=RedSeaISOPass1(tempde)>>BLK_SIZE_BITS) {
|
||||
bd->drv_offset=19<<2;
|
||||
if (stage2_filename) //preboot and bootloader
|
||||
bd->drv_offset+=(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
|
||||
|
||||
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
|
||||
bitmap_blks=1;
|
||||
do {
|
||||
bitmap_blks1=bitmap_blks;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
Cd(__DIR__);;
|
||||
#include "BootDVD"
|
||||
#include "BootHD"
|
||||
#include "BootMHD"
|
||||
#include "BootMHD2"
|
||||
#include "DskISORedSea"
|
||||
#include "DskISO9660"
|
||||
#include "BootIns"
|
||||
#include "Reboot"
|
||||
#include "BootDVDIns"
|
||||
#include "BootHDIns"
|
||||
#include "BootMHDIns"
|
||||
#include "BootRAM"
|
||||
Cd("..");;
|
||||
Reference in new issue
Block a user