Merge "SDKRuntime: Introduce skeleton implementation"

GitOrigin-RevId: 4c147d204f782881662e3d30b36f848906ae51d3
This commit is contained in:
June Tate-Gans
2022-08-16 21:59:11 +00:00
committed by Sam Leffler
parent 02e6caec95
commit c0c03fe731
18 changed files with 535 additions and 19 deletions

View File

@@ -1,3 +1,17 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import <LoggerInterface.camkes>;
import <ProcessControlInterface.camkes>;
import <PackageManagementInterface.camkes>;
@@ -6,6 +20,7 @@ import <MemoryInterface.camkes>;
import <SecurityCoordinatorInterface.camkes>;
import <StorageInterface.camkes>;
import <TimerServiceInterface.camkes>;
import <SDKRuntimeInterface.camkes>;
component DebugConsole {
control;
@@ -27,6 +42,7 @@ component DebugConsole {
uses SecurityCoordinatorInterface security;
// TODO(b/200707300): for debugging
uses StorageInterface storage;
uses SDKRuntimeInterface sdk_runtime;
uses Timer timer;

View File

@@ -1,3 +1,17 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[package]
name = "kata-shell"
version = "0.1.0"
@@ -15,6 +29,7 @@ default = [
"TEST_MEMORY_MANAGER",
"TEST_ML_COORDINATOR",
"TEST_PANIC",
"TEST_SDK_RUNTIME",
"TEST_SECURITY_COORDINATOR",
"TEST_TIMER_SERVICE",
]
@@ -29,6 +44,7 @@ TEST_MAILBOX = []
TEST_MEMORY_MANAGER = []
TEST_ML_COORDINATOR = []
TEST_PANIC = []
TEST_SDK_RUNTIME = []
TEST_SECURITY_COORDINATOR = []
TEST_TIMER_SERVICE = []
TEST_UART = []
@@ -47,5 +63,6 @@ kata-os-common = { path = "../../kata-os-common" }
kata-security-interface = { path = "../../SecurityCoordinator/kata-security-interface" }
kata-storage-interface = { path = "../../StorageManager/kata-storage-interface" }
kata-timer-interface = { path = "../../TimerService/kata-timer-interface" }
kata-sdk-interface = { path = "../../SDKRuntime/kata-sdk-interface" }
log = "0.4"
zmodem = { path = "../zmodem" }

View File

@@ -1,3 +1,17 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![no_std]
extern crate alloc;
@@ -40,6 +54,8 @@ mod test_memory_manager;
mod test_ml_coordinator;
#[cfg(feature = "TEST_PANIC")]
mod test_panic;
#[cfg(feature = "TEST_SDK_RUNTIME")]
mod test_sdk_runtime;
#[cfg(feature = "TEST_SECURITY_COORDINATOR")]
mod test_security_coordinator;
#[cfg(feature = "TEST_TIMER_SERVICE")]
@@ -129,6 +145,8 @@ pub fn repl<T: io::BufRead>(output: &mut dyn io::Write, input: &mut T, builtin_c
test_ml_coordinator::add_cmds(&mut cmds);
#[cfg(feature = "TEST_PANIC")]
test_panic::add_cmds(&mut cmds);
#[cfg(feature = "TEST_SDK_RUNTIME")]
test_sdk_runtime::add_cmds(&mut cmds);
#[cfg(feature = "TEST_SECURITY_COORDINATOR")]
test_security_coordinator::add_cmds(&mut cmds);
#[cfg(feature = "TEST_TIMER_SERVICE")]

View File

@@ -0,0 +1,45 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! SDK Runtime shell test commands
use crate::CmdFn;
use crate::CommandError;
use crate::HashMap;
use core::fmt::Write;
use kata_io as io;
use kata_sdk_interface::kata_sdk_ping;
pub fn add_cmds(cmds: &mut HashMap<&str, CmdFn>) {
cmds.extend([("test_sdkping", sdk_ping_command as CmdFn)]);
}
fn sdk_ping_command(
_args: &mut dyn Iterator<Item = &str>,
_input: &mut dyn io::BufRead,
output: &mut dyn io::Write,
_builtin_cpio: &[u8],
) -> Result<(), CommandError> {
match kata_sdk_ping() {
Ok(()) => {
writeln!(output, "pong received")?;
}
Err(sdkerror) => {
writeln!(output, "ping failed: {:?}", sdkerror)?;
}
}
Ok(())
}