Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ostool-server/src/api/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async fn create_dtb(
request: Request,
) -> Result<(StatusCode, axum::Json<DtbFileResponse>), ApiError> {
let headers = request.headers();
let dtb_name = dtb_name_header(&headers, "X-Dtb-Name")?;
let dtb_name = dtb_name_header(headers, "X-Dtb-Name")?;
let body = read_limited_body(request, DTB_UPLOAD_MAX_MIB, "DTB").await?;
if body.is_empty() {
return Err(ApiError::bad_request("DTB upload body must not be empty"));
Expand Down
14 changes: 12 additions & 2 deletions ostool/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,19 @@ pub struct CargoUbootRunnerArgs {
/// either through QEMU emulation or via U-Boot on real hardware.
pub enum CargoRunnerKind {
/// Run the built artifact in QEMU emulator.
Qemu(CargoQemuRunnerArgs),
Qemu(Box<CargoQemuRunnerArgs>),
/// Run the built artifact on real hardware via U-Boot.
Uboot(CargoUbootRunnerArgs),
Uboot(Box<CargoUbootRunnerArgs>),
}

impl CargoRunnerKind {
pub fn new_qemu(args: CargoQemuRunnerArgs) -> Self {
Self::Qemu(Box::new(args))
}

pub fn new_uboot(args: CargoUbootRunnerArgs) -> Self {
Self::Uboot(Box::new(args))
}
}

impl Tool {
Expand Down
8 changes: 4 additions & 4 deletions ostool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ async fn try_main() -> Result<()> {
),
None => None,
};
let kind = CargoRunnerKind::Qemu(CargoQemuRunnerArgs {
let kind = CargoRunnerKind::new_qemu(CargoQemuRunnerArgs {
qemu: qemu_config,
debug,
dtb_dump,
show_output: true,
});
tool.cargo_run(&config, &kind).await?;
tool.cargo_run(config, &kind).await?;
}
build::config::BuildSystem::Custom(custom_cfg) => {
tool.build_with_config(&build_config).await?;
Expand Down Expand Up @@ -262,11 +262,11 @@ async fn try_main() -> Result<()> {
),
None => None,
};
let kind = CargoRunnerKind::Uboot(CargoUbootRunnerArgs {
let kind = CargoRunnerKind::new_uboot(CargoUbootRunnerArgs {
uboot: uboot_config,
show_output: true,
});
tool.cargo_run(&config, &kind).await?;
tool.cargo_run(config, &kind).await?;
}
build::config::BuildSystem::Custom(custom_cfg) => {
tool.build_with_config(&build_config).await?;
Expand Down
4 changes: 2 additions & 2 deletions ostool/tests/ui/pass_tool_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ fn main() {
let _ = RunQemuOptions::default();
let _ = RunUbootOptions::default();
let _ = board::RunBoardOptions::default();
let _ = build::CargoRunnerKind::Qemu(build::CargoQemuRunnerArgs {
let _ = build::CargoRunnerKind::new_qemu(build::CargoQemuRunnerArgs {
qemu: Some(qemu),
debug: false,
dtb_dump: false,
show_output: true,
});
let _ = build::CargoRunnerKind::Uboot(build::CargoUbootRunnerArgs {
let _ = build::CargoRunnerKind::new_uboot(build::CargoUbootRunnerArgs {
uboot: Some(uboot),
show_output: true,
});
Expand Down