Posted 06 April 2018 - 03:29 PM
Hi, I just started making my own OS. I would like to make the bootloader depend on config files (where the 2nd stage of the loader is located, what mode to boot the OS into etc.) and I do have the basic idea of it. When I coded it all, running the 1st stage of the bootloader (startup.lua) throws an error saying "startup.lua:8: attempt to concatenate string and nil" (tells the user where the 2nd stage is located, also needed to run it) where it should say "Executing bootloader in Boot/loader.lua". Since I will need this for the OS' actual config, I am sure I will need it in the core of the OS itself! Please help!
Table (serialized and made 100% not user-made or modified):
1st stage of the loader (startup.lua):
2nd stage of the loader (Boot/loader.lua and not finished):
Table (serialized and made 100% not user-made or modified):
{
loader = "Boot/loader.lua",
minimal = false,
}
1st stage of the loader (startup.lua):
term.clear()
term.setCursorPos(1, 1)
version = 0.1
local cfgfile = fs.open("Boot/cfg.lua", "r")
bootconfig = textutils.unserialize(cfgfile.readAll())
cfgfile.close()
print("Executing bootloader on "..bootconfig[loader])
sleep(1)
shell.run(bootconfig[loader], bootconfig[minimal])
2nd stage of the loader (Boot/loader.lua and not finished):
print("This is a nice Hello World bootloader that does nothing! (so far)")