restructure for spm

This commit is contained in:
2026-01-18 22:14:15 -05:00
parent fd7ee1aa3b
commit 63bcc2df5c
68 changed files with 120 additions and 98 deletions

View File

@@ -1,10 +0,0 @@
{
"Name": "Hyperion bash",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "basic bash shell",
"Dependencies": [
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-core-v1.0.0.pkg"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-bash-v1.0.0.tar"
}

View File

@@ -1,17 +0,0 @@
print(".. *. ..")
print(" *= +@* +* ")
print(" .@#. -@@@= :#@. ")
print(" =@@+ *@@@# +@@= ")
print(" %@@%: *@@@# -%@@% ")
print(" :@@@@+ *@@@# .*@@@@: ")
print(" :*@@@%- *@@@# -@@@@*: ")
print(" =%@@#. *@@@# .#@@%= ")
print(" :=. :*@@= *@@@# =@@+: .=: ")
print(" %@#=..*# +@@@# #*..=#@# ")
print(" .@@@@+=# .%@%: #=+@@@@. ")
print(" .....=# -@= *+...:. ")
print(" -*%*-@= - =@-*%*- ")
print(" -@*. -@%. :%@- :*@- ")
print(" .#@#@* ")
print(" -#- ")
print(" ")

View File

@@ -0,0 +1,18 @@
local userhost = syscall.OS_getUser().."@"..syscall.OS_getHostname()
print(".. *. .. | "..userhost)
print(" *= +@* +* | "..string.rep("-",#userhost))
print(" .@#. -@@@= :#@. | OS: "..syscall.OS_version())
print(" =@@+ *@@@# +@@= | Host: "..syscall.OS_getHost())
print(" %@@%: *@@@# -%@@% | Uptime: "..syscall.OS_getUptime())
print(" :@@@@+ *@@@# .*@@@@: | Tasks: "..tostring(#syscall.HPV_list()))
print(" :*@@@%- *@@@# -@@@@*: | Packages: "..tostring())
print(" =%@@#. *@@@# .#@@%= | Shell: "..syscall.HPV_getEnviron("SHELL"))
print(" :=. :*@@= *@@@# =@@+: .=: | ")
print(" %@#=..*# +@@@# #*..=#@# | ")
print(" .@@@@+=# .%@%: #=+@@@@. | ")
print(" .....=# -@= *+...:. | ")
print(" -*%*-@= - =@-*%*- | ")
print(" -@*. -@%. :%@- :*@- | ")
print(" .#@#@* | ")
print(" -#- | ")
print(" | ")

View File

@@ -1,10 +0,0 @@
{
"Name": "Hyperion core",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "Core system files and librarys for HyperionOS",
"Dependencies": [
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-kernel-v1.0.0.pkg"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-core-v1.0.0.tar"
}

View File

@@ -1,11 +0,0 @@
{
"Name": "Hyperion CCT Firmware",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The ComputerCraftTweaked firmware package for HyperionOS.",
"Dependencies": [
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-kernel-v1.0.0.pkg"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-firmware-cct-v1.0.0.tar",
"BuildCommand": "sudo cp boot/cct/eeprom /dev/eeprom"
}

View File

@@ -3,7 +3,6 @@ local BOOT_DRIVE_PATH=({...})[1] or "/$"
---@diagnostic disable-next-line: undefined-global ---@diagnostic disable-next-line: undefined-global
local term = term local term = term
local os = os local os = os
-- Function to write text to the terminal with special character handling
local function write(text) local function write(text)
local x, y = term.getCursorPos() local x, y = term.getCursorPos()
local w, h = term.getSize() local w, h = term.getSize()
@@ -49,7 +48,6 @@ local function write(text)
term.setCursorPos(x, y) term.setCursorPos(x, y)
end end
-- Function to display critical errors and halt the system
local function displaySuperBadError(err) local function displaySuperBadError(err)
term.setBackgroundColor(0x1) term.setBackgroundColor(0x1)
term.setTextColor(0x4) term.setTextColor(0x4)
@@ -62,11 +60,9 @@ local function displaySuperBadError(err)
end end
term.setCursorBlink(false) term.setCursorBlink(false)
-- Wrap all in xpcall to catch errors
local ok, err = xpcall(function() local ok, err = xpcall(function()
local apis={BOOT_DRIVE_PATH=BOOT_DRIVE_PATH} local apis={BOOT_DRIVE_PATH=BOOT_DRIVE_PATH}
-- List of standard Lua globals
local lua = { local lua = {
coroutine = true, coroutine = true,
debug = true, debug = true,
@@ -101,7 +97,6 @@ local ok, err = xpcall(function()
_G=true _G=true
} }
-- Move all non-Lua standard library globals into the apis table
local debug = debug local debug = debug
for i,v in pairs(_G) do for i,v in pairs(_G) do
if not lua[i] or lua[i]==nil then if not lua[i] or lua[i]==nil then
@@ -115,7 +110,6 @@ local ok, err = xpcall(function()
while stoptime > apis.os.clock() do end while stoptime > apis.os.clock() do end
end end
-- Set up terminal default colors
apis.term.setPaletteColor(0x1, 0x000000) -- #000000 apis.term.setPaletteColor(0x1, 0x000000) -- #000000
apis.term.setPaletteColor(0x2, 0xFFFFFF) -- #FFFFFF apis.term.setPaletteColor(0x2, 0xFFFFFF) -- #FFFFFF
apis.term.setPaletteColor(0x4, 0xFF0000) -- #FF0000 apis.term.setPaletteColor(0x4, 0xFF0000) -- #FF0000
@@ -133,7 +127,6 @@ local ok, err = xpcall(function()
apis.term.setPaletteColor(0x4000, 0x6D00FF) -- #6D00FF apis.term.setPaletteColor(0x4000, 0x6D00FF) -- #6D00FF
apis.term.setPaletteColor(0x8000, 0xB6FF00) -- #B6FF00 apis.term.setPaletteColor(0x8000, 0xB6FF00) -- #B6FF00
-- Wrapper to read files
local function getFile(path) local function getFile(path)
local file = apis.fs.open(path, "r") local file = apis.fs.open(path, "r")
if not file then displaySuperBadError("Could not open file: "..path) end if not file then displaySuperBadError("Could not open file: "..path) end
@@ -142,7 +135,6 @@ local ok, err = xpcall(function()
return content return content
end end
-- Load kernel first if it fails, we can't continue so we display an error
local Kernel = load(getFile(BOOT_DRIVE_PATH.."/boot/kernel.lua"),"@Kernel") local Kernel = load(getFile(BOOT_DRIVE_PATH.."/boot/kernel.lua"),"@Kernel")
local initFs = load(getFile(BOOT_DRIVE_PATH.."/boot/cct/initdisks"),"@Init_disks")(apis) local initFs = load(getFile(BOOT_DRIVE_PATH.."/boot/cct/initdisks"),"@Init_disks")(apis)
local fs = load(getFile(BOOT_DRIVE_PATH.."/boot/initfs"),"@InitFs")() local fs = load(getFile(BOOT_DRIVE_PATH.."/boot/initfs"),"@InitFs")()
@@ -160,15 +152,12 @@ local ok, err = xpcall(function()
displaySuperBadError("Could not load key helper.") displaySuperBadError("Could not load key helper.")
end end
-- Set up event queue
local eventQueue = {} local eventQueue = {}
-- Function to queue events
local function queueEvent(event, ...) local function queueEvent(event, ...)
table.insert(eventQueue, {event, ...}) table.insert(eventQueue, {event, ...})
end end
-- Set up computer api
local computer = { local computer = {
time = function() return apis.os.epoch("utc") end, time = function() return apis.os.epoch("utc") end,
clock = function() return apis.os.clock()/1000 end, clock = function() return apis.os.clock()/1000 end,
@@ -191,7 +180,6 @@ local ok, err = xpcall(function()
end end
} }
-- Set up terminal colors
local icolors={ local icolors={
[0x1] =0, -- #000000 [0x1] =0, -- #000000
[0x2] =1, -- #FFFFFF [0x2] =1, -- #FFFFFF
@@ -235,7 +223,6 @@ local ok, err = xpcall(function()
apis.term.clear() apis.term.clear()
apis.term.setCursorPos(1, 1) apis.term.setCursorPos(1, 1)
-- Make the kernel coroutine so we can hook its execution
local kernelCoro = coroutine.create(function() local kernelCoro = coroutine.create(function()
---@diagnostic disable-next-line: param-type-mismatch ---@diagnostic disable-next-line: param-type-mismatch
local ok, err = xpcall(Kernel, debug.traceback, apis, initFs, "cct", "/sbin/init", { local ok, err = xpcall(Kernel, debug.traceback, apis, initFs, "cct", "/sbin/init", {
@@ -255,7 +242,7 @@ local ok, err = xpcall(function()
end end
end) end)
-- Diffine a coroutine.resumeWithTimeout function to avoid hanging the system, time is in milliseconds -- time is in milliseconds
function coroutine.resumeWithTimeout(co, timeout, ...) function coroutine.resumeWithTimeout(co, timeout, ...)
local startTime = computer.time() local startTime = computer.time()
debug.sethook(co, function() debug.sethook(co, function()
@@ -276,7 +263,6 @@ local ok, err = xpcall(function()
write("Loaded in "..tostring(apis.os.clock()).." seconds.\n") write("Loaded in "..tostring(apis.os.clock()).." seconds.\n")
-- Main loop to run the kernel coroutine
while true do while true do
local status, err = coroutine.resumeWithTimeout(kernelCoro, 50) local status, err = coroutine.resumeWithTimeout(kernelCoro, 50)
apis.os.queueEvent("NoSleep") apis.os.queueEvent("NoSleep")

View File

@@ -1,11 +0,0 @@
{
"Name": "Hyperion OC Firmware",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The OpenComputers firmware package for HyperionOS.",
"Dependencies": [
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-kernel-v1.0.0.pkg"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-firmware-oc-v1.0.0.tar",
"BuildCommand": "cp boot/oc/eeprom /dev/eeprom"
}

View File

View File

@@ -1,8 +0,0 @@
{
"Name": "Hyperion Kernel",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The kernel package for HyperionOS.",
"Dependencies": [],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-kernel-v1.0.0.tar"
}

View File

@@ -30,7 +30,7 @@ function sys.spawn(func, name, envars, args, tgid)
end end
end), end),
name=name or ("task"..tostring(id)), name=name or ("task"..tostring(id)),
envars=envars or {}, envars=envars or kernel.currentTask.envars,
args=args or {}, args=args or {},
status="R", status="R",
pid=id, pid=id,
@@ -171,6 +171,22 @@ function sys.getPid()
return kernel.currentTask.pid return kernel.currentTask.pid
end end
function sys.list()
local ret={}
for i,_ in ipairs(tasks) do
ret[i]=sys.getTaskInfo(i)
end
return ret
end
function sys.getEnviron(key)
return kernel.currentTask.envars[key]
end
function sys.setEnviron(key, value)
kernel.currentTask.envars[key]=value
end
kernel.syscalls["HPV_spawn"]=sys.spawn kernel.syscalls["HPV_spawn"]=sys.spawn
kernel.syscalls["HPV_sleep"]=sys.sleep kernel.syscalls["HPV_sleep"]=sys.sleep
kernel.syscalls["HPV_getTaskInfo"]=sys.getTaskInfo kernel.syscalls["HPV_getTaskInfo"]=sys.getTaskInfo
@@ -179,6 +195,9 @@ kernel.syscalls["HPV_kill"]=sys.kill
kernel.syscalls["HPV_stop"]=sys.stop kernel.syscalls["HPV_stop"]=sys.stop
kernel.syscalls["HPV_continue"]=sys.continue kernel.syscalls["HPV_continue"]=sys.continue
kernel.syscalls["HPV_getPid"]=sys.getPid kernel.syscalls["HPV_getPid"]=sys.getPid
kernel.syscalls["HPV_list"]=sys.list
kernel.syscalls["HPV_setEnviron"]=sys.setEnviron
kernel.syscalls["HPV_getEnviron"]=sys.getEnviron
kernel._G.sleep=function(...)coroutine.yield("syscall","HPV_sleep",...)end kernel._G.sleep=function(...)coroutine.yield("syscall","HPV_sleep",...)end
local function reapDeadTasks() local function reapDeadTasks()

View File

@@ -1,15 +0,0 @@
{
"Name": "HyperionOS",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The install package for HyperionOS project.",
"Dependencies": [
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-core-v1.0.0.pkg",
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-kernel-v1.0.0.pkg",
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-ui-v1.0.0.pkg",
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-network-v1.0.0.pkg",
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-security-v1.0.0.pkg",
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-filesystem-v1.0.0.pkg",
"https://git.astronand.dev/Hyperion/HyperionOS/archive/Hyperion-bash-v1.0.0.pkg"
]
}

View File

View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS bash",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "Basic bash shell for HyperionOS",
"Dependencies": [
"HyperionOS"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/tar/HyperionOS-kernel.tar.gz"
}

View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS core",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "Core system files and librarys for HyperionOS",
"Dependencies": [
"HyperionOS"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/tar/HyperionOS-core.tar.gz"
}

View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS CCT Firmware",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The ComputerCraftTweaked firmware package for HyperionOS.",
"Dependencies": [
"HyperionOS-kernel"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/tar/HyperionOS-kernel.tar.gz"
}

View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS OC Firmware",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The OpenComputers firmware package for HyperionOS.",
"Dependencies": [
"HyperionOS-kernel"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/tar/HyperionOS-kernel.tar.gz"
}

View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS Kernel",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The kernel package for HyperionOS.",
"Dependencies": [
"HyperionOS"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/tar/HyperionOS-kernel.tar.gz"
}

View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS unit tests",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "HyperionOS testing units",
"Dependencies": [
"HyperionOS"
],
"Tar": "https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/tar/HyperionOS-units.tar.gz"
}

10
spm/pkg/HyperionOS.pkg Normal file
View File

@@ -0,0 +1,10 @@
{
"Name": "HyperionOS",
"Version": "1.0.0",
"Publishers": ["HyperionOS Dev Team"],
"Description": "The install package for HyperionOS project.",
"Dependencies": [
"HyperionOS-kernel",
"HyperionOS-core"
]
}

11
spm/spm.src Normal file
View File

@@ -0,0 +1,11 @@
{
"Packages":{
"HyperionOS":"https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/pkg/HyperionOS.pkg",
"HyperionOS-core":"https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/pkg/HyperionOS-core.pkg",
"HyperionOS-kernel":"https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/pkg/HyperionOS-kernel.pkg",
"HyperionOS-firmware-cct":"https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/pkg/HyperionOS-firmware-cct.pkg",
"HyperionOS-firmware-oc":"https://git.astronand.dev/Hyperion/HyperionOS/raw/branch/main/spm/pkg/HyperionOS-firmware-oc.pkg"
},
"Nodes":[],
"Blacklist":[]
}