mirror of
https://github.com/Adorable-Catgirl/Zorya-NEO.git
synced 2024-11-23 10:48:06 +11:00
Add Monolith loader
This is untested as I unfortunately couldn't get Zorya to build.
This commit is contained in:
parent
1ffba24166
commit
722606b419
35
mods/loader_monolith/init.lua
Normal file
35
mods/loader_monolith/init.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
-- monolith loader --
|
||||||
|
local zy = krequire("zorya")
|
||||||
|
local utils = krequire("utils")
|
||||||
|
local thd = krequire("thd")
|
||||||
|
local vdev = krequire("util_vcomponent")
|
||||||
|
local function proxytable(t)
|
||||||
|
return setmetatable({}, {__index=function(self, i)
|
||||||
|
if (type(t[i]) == "table") then
|
||||||
|
self[i] = proxytable(t[i])
|
||||||
|
return rawget(self, i)
|
||||||
|
else
|
||||||
|
return t[i]
|
||||||
|
end
|
||||||
|
end})
|
||||||
|
end
|
||||||
|
local monolith_count = 0
|
||||||
|
return function(addr)
|
||||||
|
local fs = component.proxy(addr)
|
||||||
|
thd.add("monolith$"..monolith_count, function()
|
||||||
|
local env = utils.make_env()
|
||||||
|
function env.computer.getBootAddress()
|
||||||
|
return addr
|
||||||
|
end
|
||||||
|
function env.computer.setBootAddress()end
|
||||||
|
local old_dl = utils.debug_log
|
||||||
|
load(utils.readfile(fs.address, fs.open("/boot/kernel/loader")), "=/boot/kernel/loader", "t", env)()
|
||||||
|
computer.pushSignal("monolith_dead")
|
||||||
|
end)
|
||||||
|
while true do
|
||||||
|
if computer.pullSignal() == "monolith_dead" then
|
||||||
|
utils.debug_log("Got signal.")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user