minexew / templeos-loader

User-space loader for TempleOS
4 stars 6 forks source link

Add basic HFS support #9

Closed tos11 closed 4 years ago

tos11 commented 4 years ago

I can now run the STARTOS script from outside the VFS.

For example I have a directory like this:

$ ls rootfs scripts templeos-loader VKernel.BIN.C

with CompileKernel.HC moved out of the rootfs and into scripts.

I can now rebuild the kernel like this:

STARTOS="-scripts/CompileKernel.HC" ./templeos-loader VKernel.BIN.C rootfs rootfs/writable

I used - as the magic path character. $ could cause issues inside and outside Temple OS. Plus it needs to be a character that will not make Temple OS think it is a bad filename (needs to be ok with char_bmp_filename).

minexew commented 4 years ago

Didn't you forget to include the modified vsyscall_handler? :stuck_out_tongue:

tos11 commented 4 years ago

Sorry, I knew I was too tired to be using git and making pull requests lol.

I also added some double include protection to templeos.h

minexew commented 4 years ago

There we go! I would go even further, and automatically adjust COMPILER and STARTOS env vars (if set) to use the VFS escape mechanism, what do you think?

minexew commented 4 years ago

Plus it needs to be a character that will not make Temple OS think it is a bad filename (needs to be ok with char_bmp_filename).

Ok, I believe it is this set then:

!#$%&'(),-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{}~

I suppose no sane filename would start with a dash, so it should be fine from that point of view.

tos11 commented 4 years ago

Yes, I was thinking that would be a good idea too. No reason to make the user worry about it.

minexew commented 4 years ago

But are you against making the prefix more explicit, such as host$StartOS.HC? Then the user could override the automatic replacement by explicitly specifying vfs$StartOS.HC, although I don't see an use case at the moment

Btw:

mask = [0x0000000,0x03FF73FB,0xEFFFFFFF,0x6FFFFFFF,
  0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF]

for i in range(256):
    if mask[i // 32] & (1 << (i & 31)):
        print(chr(i), end='')

print()
tos11 commented 4 years ago

Ok, I'll look into making it more explicit and able to do the VFS case too.

tos11 commented 4 years ago

Abandoning in favor of multiple virtual drives instead.