Skip to content

Commit

Permalink
Load invocation numbers from JSON file
Browse files Browse the repository at this point in the history
Instead of hard-coding invocation numbers, we now
get them from a file generated by the seL4 kernel
build.

Signed-off-by: Alwin Joshy <[email protected]>
  • Loading branch information
alwin-joshy committed Oct 7, 2024
1 parent cf88629 commit 0ff1e62
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 192 deletions.
6 changes: 6 additions & 0 deletions build_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ def build_sel4(
# Make output read-only
dest.chmod(0o744)

invocations_all = sel4_build_dir / "generated" / "invocations_all.json"
dest = (root_dir / "board" / board.name / config.name / "invocations_all.json" )
dest.unlink(missing_ok=True)
copy(invocations_all, dest)
dest.chmod(0o744)

include_dir = root_dir / "board" / board.name / config.name / "include"
for source in ("kernel_Config", "libsel4", "libsel4/sel4_Config", "libsel4/autoconf"):
source_dir = sel4_install_dir / source / "include"
Expand Down
17 changes: 17 additions & 0 deletions tool/microkit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3245,6 +3245,12 @@ fn main() -> Result<(), String> {
.join(args.config)
.join("include/kernel/gen_config.json");

let invocations_all_path = sdk_dir
.join("board")
.join(args.board)
.join(args.config)
.join("invocations_all.json");

if !elf_path.exists() {
eprintln!(
"Error: board ELF directory '{}' does not exist",
Expand Down Expand Up @@ -3280,6 +3286,13 @@ fn main() -> Result<(), String> {
);
std::process::exit(1);
}
if !invocations_all_path.exists() {
eprintln!(
"Error: invocations JSON file '{}' does not exist",
invocations_all_path.display()
);
std::process::exit(1);
}

let system_path = Path::new(args.system);
if !system_path.exists() {
Expand All @@ -3295,6 +3308,9 @@ fn main() -> Result<(), String> {
let kernel_config_json: serde_json::Value =
serde_json::from_str(&fs::read_to_string(kernel_config_path).unwrap()).unwrap();

let invocations_map: serde_json::Value =
serde_json::from_str(&fs::read_to_string(invocations_all_path).unwrap()).unwrap();

let arch = match json_str(&kernel_config_json, "SEL4_ARCH")? {
"aarch64" => Arch::Aarch64,
"riscv64" => Arch::Riscv64,
Expand Down Expand Up @@ -3345,6 +3361,7 @@ fn main() -> Result<(), String> {
arm_pa_size_bits,
arm_smc,
riscv_pt_levels: Some(RiscvVirtualMemory::Sv39),
invocations_map: invocations_map,
};

if let Arch::Aarch64 = kernel_config.arch {
Expand Down
Loading

0 comments on commit 0ff1e62

Please sign in to comment.