Refactor the boot library to be a bit simpler.
This commit is contained in:
parent
834841a70e
commit
9b034aaa1a
|
@ -4,7 +4,6 @@ parameter debug is false.
|
|||
|
||||
Bootstrap(
|
||||
"/boot/aircraft",
|
||||
"/prog/aircraft",
|
||||
List(), // no additional program files
|
||||
List("/prog/aircraft"),
|
||||
debug
|
||||
).
|
||||
|
|
|
@ -4,7 +4,6 @@ parameter debug is false.
|
|||
|
||||
Bootstrap(
|
||||
"/boot/helicopter",
|
||||
"/prog/helicopter",
|
||||
List(), // no additional program files
|
||||
List("/prog/helicopter"),
|
||||
debug
|
||||
).
|
||||
|
|
|
@ -4,7 +4,6 @@ parameter debug is false.
|
|||
|
||||
Bootstrap(
|
||||
"/boot/launchpad",
|
||||
"/prog/launchpad",
|
||||
List(),
|
||||
List("/prog/launchpad"),
|
||||
debug
|
||||
).
|
||||
|
|
|
@ -4,7 +4,6 @@ parameter debug is false.
|
|||
|
||||
Bootstrap(
|
||||
"/boot/rocket",
|
||||
"/prog/rocket",
|
||||
List(),
|
||||
List("/prog/rocket"),
|
||||
debug
|
||||
).
|
||||
|
|
|
@ -4,12 +4,12 @@ parameter debug is false.
|
|||
|
||||
Bootstrap(
|
||||
"/boot/satellite",
|
||||
"",
|
||||
List(
|
||||
"/prog/execnode",
|
||||
"/prog/circ",
|
||||
"/prog/satdeploy",
|
||||
"/prog/nodestats"
|
||||
),
|
||||
debug
|
||||
debug,
|
||||
false
|
||||
).
|
||||
|
|
|
@ -4,12 +4,12 @@ parameter debug is false.
|
|||
|
||||
Bootstrap(
|
||||
"/boot/science",
|
||||
"",
|
||||
List(
|
||||
"/prog/circ",
|
||||
"/prog/execnode",
|
||||
"/prog/nodestats",
|
||||
"/prog/reentry"
|
||||
),
|
||||
debug
|
||||
debug,
|
||||
false
|
||||
).
|
||||
|
|
29
lib/boot.ks
29
lib/boot.ks
|
@ -1,20 +1,24 @@
|
|||
|
||||
// "bootfile" should be the path to the bootfile, so it can be deleted.
|
||||
// "programs" is a List() of programs to install in the CPU root.
|
||||
// "debug" will skip compiling if enabled, and only copy files.
|
||||
// if "init" is true, the first program in the programs List will become the new boot file.
|
||||
// pass false in here if you want CPU control from the terminal.
|
||||
function Bootstrap {
|
||||
parameter bootFile, init, programs, debug.
|
||||
parameter bootFile, programs, debug, init is true.
|
||||
|
||||
local initProgram is "".
|
||||
if init {
|
||||
set initProgram to programs[0]:Replace("/prog", "").
|
||||
}
|
||||
|
||||
// create a list of libraries that we need to compile
|
||||
local libs is UniqueSet().
|
||||
if init <> "" {
|
||||
addLibs(libs, init).
|
||||
}
|
||||
for program in programs {
|
||||
addLibs(libs, program).
|
||||
}
|
||||
|
||||
// compile the main program files
|
||||
if init <> "" {
|
||||
compileFile(init, "/init", debug).
|
||||
}
|
||||
for program in programs {
|
||||
compileFile(program, program:Replace("/prog", ""), debug).
|
||||
}
|
||||
|
@ -29,18 +33,13 @@ function Bootstrap {
|
|||
// Open a terminal and run init.
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
if init <> "" {
|
||||
run "/init".
|
||||
RunPath(initProgram).
|
||||
}
|
||||
// ... or delete the bootstrapping file, set init to the bootfile,
|
||||
// ... or delete the bootstrapping file, configure to boot from the init program,
|
||||
// and reboot.
|
||||
} else {
|
||||
DeletePath("1:" + bootfile).
|
||||
// Set OS to boot and restart.
|
||||
if init = "" {
|
||||
set CORE:BOOTFILENAME to "".
|
||||
} else {
|
||||
set CORE:BOOTFILENAME to "/init".
|
||||
}
|
||||
set CORE:BOOTFILENAME to initProgram.
|
||||
reboot.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user