Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Update to latest TempleOS
Browse files Browse the repository at this point in the history
  • Loading branch information
minexew committed Jun 17, 2017
1 parent f545a53 commit 0a60bcc
Show file tree
Hide file tree
Showing 14 changed files with 614 additions and 108 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "isoparser"]
path = isoparser
url = https://github.com/barneygale/isoparser.git
[submodule "TempleOS"]
path = TempleOS
url = https://github.com/minexew/TempleOS.git
Expand Down
6 changes: 1 addition & 5 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ During the process, the TOS ISO is first patched to enable an unattended install
- use the following commands

```
# This only needs to be done once
git submodule update --init --recursive
git apply isoparser.patch
# Some files are provided as diffs against stock TempleOS, this generates the full files
cd AutoOSInstall && ./apply-patches.sh && cd ..
cd Shrine && ./apply-patches.sh && cd ..
# Finally run the machinery
qemu-img create -f qcow2 ~/shrine.img 2G
mkdir PkgBin
./make-dist.py TempleOSCD.ISO Shrine ~/shrine.img
./make-dist.py TOS_Distro.ISO Shrine ~/shrine.img
```

The output will be `Shrine-HEAD.iso`.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Setting up with networking
- Native Stack (highly experimental)
- configure your VM networking: *Adapter Type: PCnet-PCI II* (`pcnet` in QEMU)
- *Attached to: NAT* seems to be the most reliable setting, Bridged Mode also works somewhat
- Make sure the VM has **no more than 3 GB RAM**, otherwise the driver will fail to load.
- On boot, Shrine will automatically attempt to acquire an IP address. If you don't get a message about "Configuring network", the adapter was not detected.

- To enable tunelled networking through Snail:
Expand Down
8 changes: 4 additions & 4 deletions Shrine/Distro/DoDistro.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/../TempleOS/TempleOSCD/Misc/DoDistro.HC b/Patched/Misc/DoDistro.HC
index 6cd1f30..9e31ba4 100644
index 70552ac..5e0ef2a 100644
--- a/../TempleOS/TempleOSCD/Misc/DoDistro.HC
+++ b/Patched/Misc/DoDistro.HC
@@ -31,7 +31,7 @@ U0 MakeMyISO(U8 *_out_iso_filename)
Expand All @@ -11,11 +11,11 @@ index 6cd1f30..9e31ba4 100644
CopyTree("/Linux","/Distro/Linux"); //You can leave this out.
DirMk("/Distro/Tmp");
DirMk("/Distro/Tmp/ScrnShots");
@@ -47,6 +47,6 @@ U0 MakeMyISO(U8 *_out_iso_filename)
@@ -44,6 +44,6 @@ U0 MakeMyISO(U8 *_out_iso_filename)
Free(out_iso_filename);
}

-MakeMyISO("/Tmp/MyDistro.ISO");
+MakeMyISO("/Tmp/ShrineDist.ISO");
-MakeMyISO("/Tmp/MyDistro.ISO.C");
+MakeMyISO("/Tmp/ShrineDist.ISO.C");

// Study my account examples $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOS/TOSCfg.HC,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOS/TOSDistro.HC,1"$.
2 changes: 1 addition & 1 deletion Shrine/mkdist.script
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ command DelTree("/Tmp");
command DirMk("/Tmp");

command #include "/Misc/DoDistro";
list /Tmp/ShrineDist.ISO Shrine-HEAD.iso
list /Tmp/ShrineDist.ISO.C Shrine-HEAD.iso

command Reboot;
wait 1
Binary file renamed TempleOSCD.ISO → TOS_Distro.ISO
Binary file not shown.
2 changes: 1 addition & 1 deletion TempleOS
18 changes: 6 additions & 12 deletions inject_templeos.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import sys
sys.path.append('isoparser')
sys.path.append('redseafs')

import errno
import isoparser
import os
import subprocess
from isoc import RedSea

ISO_FILE = sys.argv[1]
PATH_TO_REPLACE = sys.argv[2]
REPLACEMENT_FILE = sys.argv[3]

iso = isoparser.parse(ISO_FILE)
iso = RedSea(ISO_FILE)

with open(REPLACEMENT_FILE, 'rb') as f:
data = f.read()

record = iso.record(*[s.encode() for s in PATH_TO_REPLACE.split('/')])
patches = record.generate_patchset(data)
patches = iso.generate_patchset('/' + PATH_TO_REPLACE, data)

iso.close()
del(iso)

with open(ISO_FILE, 'rb+') as isof:
for offset, orig, new in patches:
Expand Down
1 change: 0 additions & 1 deletion isoparser
Submodule isoparser deleted from 954c2c
80 changes: 0 additions & 80 deletions isoparser.patch

This file was deleted.

24 changes: 24 additions & 0 deletions redseafs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>
36 changes: 36 additions & 0 deletions redseafs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# redseafs
FUSE implementation of TempleOS RedSea file system


This is a proof-of-concept, it will probably get better. (Time zones are not handled correctly.)


Currently, you can use redseafs to create/modify/read RedSea ISO.C files on any system that supports FUSE.


# Commands

`isoc-mount [--rw] <filename.ISO.C> <mount_point>` will mount an ISO.C image on `mount_point`

Specify `--rw` to commit writes to ISO.C file, otherwise discarded on unmount.

Specify `--2k` to pad ISO.C file to multiple of 2048 bytes, for compatibility with VirtualBox virtual CD or physical disc ONLY

(2k padded ISO.C files will not mount with TempleOS `MountFile()`, you will get `ERROR: Not RedSea`)

If the ISO.C file does not exist, a blank filesystem will be created (and written on unmount if `--rw` specified.)

`fusermount -u <mount_point>` to unmount

# Installation

Clone the repo, move `isoc-mount` and `isoc.py` to `/usr/bin`, `chmod +x`.

On a Debian/Ubuntu system: `sudo apt install fuse; sudo apt install python-pip; sudo pip install fusepy`

NOTE: This will install fusepy globally, if that's not what you want... then you probably don't need instructions anyway :P

# Prerequisites

- FUSE
- pip install: fusepy
27 changes: 27 additions & 0 deletions redseafs/isoc-mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python
import os, sys

pad = "0"
rw = ""
ctr = 0
while ctr < len(sys.argv):
if sys.argv[ctr].lower() == "--rw":
rw = "rw"
del(sys.argv[ctr])
ctr += 1
ctr = 0
while ctr < len(sys.argv):
if sys.argv[ctr].lower() == "--2k":
pad = "1"
del(sys.argv[ctr])
ctr += 1

if len(sys.argv) < 3:
print "Usage: " + sys.argv[0] + " [--rw] [--2k] <filename.ISO.C> <mount_point>"
print " --rw: commit writes to ISO.C file, otherwise discarded on unmount."
print " If the ISO.C file does not exist, a new one will be created."
print " --2k: Pad ISO.C to multiple of 2048 bytes "
print " (for VirtualBox or physical disk only) "
sys.exit()

os.system('"' + sys.argv[0][:sys.argv[0].rfind("/")+1] + 'isoc.py" "' + sys.argv[1] + '" "' + sys.argv[2] + '" "' + rw + '" "' + pad + '" &')
Loading

0 comments on commit 0a60bcc

Please sign in to comment.