Merge "processmanger: fix release builds"

GitOrigin-RevId: 18bd5b9b85ab3b264c5816327d34b0ba3d645204
This commit is contained in:
Sam Leffler
2022-01-31 22:59:47 +00:00
parent 336808a812
commit 2f4d3c8e35
5 changed files with 63 additions and 17 deletions

View File

@@ -3,6 +3,17 @@ name = "kata-shell"
version = "0.1.0"
authors = ["Matt Harvey <mattharvey@google.com>"]
edition = "2018"
build = "build.rs"
[build-dependencies]
sel4-config = { path = "../../kata-os-common/src/sel4-config" }
[build-env]
SEL4_OUT_DIR = "${ROOTDIR}out/kata/kernel"
[features]
default = []
CONFIG_DEBUG_BUILD = []
[dependencies]
crc = { version = "1.4.0", default_features = false }

View File

@@ -0,0 +1,21 @@
//extern crate sel4_config;
use std::env;
fn main() {
// If SEL4_OUT_DIR is not set we expect the kernel build at a fixed
// location relative to the ROOTDIR env variable.
println!("SEL4_OUT_DIR {:?}", env::var("SEL4_OUT_DIR"));
let sel4_out_dir = env::var("SEL4_OUT_DIR").unwrap_or_else(
|_| format!("{}/out/kata/kernel", env::var("ROOTDIR").unwrap())
);
println!("sel4_out_dir {}", sel4_out_dir);
// Dredge seL4 kernel config for settings we need as features to generate
// correct code: e.g. CONFIG_KERNEL_MCS enables MCS support which changes
// the system call numbering.
let features = sel4_config::get_sel4_features(&sel4_out_dir);
println!("features={:?}", features);
for feature in features {
println!("cargo:rustc-cfg=feature=\"{}\"", feature);
}
}

View File

@@ -10,7 +10,6 @@ use log;
use kata_io as io;
use kata_line_reader::LineReader;
use kata_os_common::sel4_sys::seL4_DebugDumpScheduler;
use kata_proc_interface::kata_pkg_mgmt_install;
use kata_proc_interface::kata_pkg_mgmt_uninstall;
use kata_proc_interface::kata_proc_ctrl_get_running_bundles;
@@ -110,7 +109,7 @@ fn dispatch_command(cmdline: &str, input: &mut dyn io::BufRead, output: &mut dyn
"install" => install_command(&mut args, output),
"loglevel" => loglevel_command(&mut args, output),
"rz" => rz_command(input, output),
"ps" => ps_command(),
"ps" => ps_command(output),
"scecho" => scecho_command(cmdline, output),
"start" => start_command(&mut args, output),
"stop" => stop_command(&mut args, output),
@@ -214,13 +213,19 @@ fn rz_command(
}
/// Implements a "ps" command that dumps seL4 scheduler state to the console.
fn ps_command() -> Result<(), CommandError> {
#[cfg(feature = "CONFIG_DEBUG_BUILD")]
fn ps_command(_output: &mut dyn io::Write) -> Result<(), CommandError> {
unsafe {
seL4_DebugDumpScheduler();
kata_os_common::sel4_sys::seL4_DebugDumpScheduler();
}
Ok(())
}
#[cfg(not(feature = "CONFIG_DEBUG_BUILD"))]
fn ps_command(output: &mut dyn io::Write) -> Result<(), CommandError> {
Ok(writeln!(output, "Kernel support not configured!")?)
}
/// Implements a binary float addition command.
///
/// This is a toy to demonstrate that the CLI can operate on some very basic