xtask: rename args.bin -> xous_presign.img

The `args.bin` file served only to be copied to `xous_presign.img`. Skip
this step and directly generate a file called `xous_presign.img`.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-10-20 14:10:52 +08:00
parent b35d65c3e1
commit 13078509e9

View file

@ -665,20 +665,7 @@ impl Builder {
} }
let mut xous_img_path = output_bundle.parent().unwrap().to_owned(); let mut xous_img_path = output_bundle.parent().unwrap().to_owned();
let mut xous_img_presign_path = xous_img_path.clone();
xous_img_path.push("xous.img"); xous_img_path.push("xous.img");
xous_img_presign_path.push("xous_presign.img");
let mut xous_img =
std::fs::File::create(&xous_img_presign_path).expect("couldn't create xous.img");
let mut bundle_file = std::fs::File::open(output_bundle).expect("couldn't open output bundle");
let mut buf = vec![];
bundle_file
.read_to_end(&mut buf)
.expect("couldn't read output bundle file");
xous_img
.write_all(&buf)
.expect("couldn't write bundle file to xous.img");
println!("Bundled image file created at {}", xous_img_path.display());
let status = Command::new(cargo()) let status = Command::new(cargo())
.current_dir(project_root()) .current_dir(project_root())
@ -690,7 +677,7 @@ impl Builder {
"sign-image", "sign-image",
"--", "--",
"--kernel-image", "--kernel-image",
xous_img_presign_path.to_str().unwrap(), output_bundle.to_str().unwrap(),
"--kernel-key", "--kernel-key",
&self.kernel_key, &self.kernel_key,
"--kernel-output", "--kernel-output",
@ -722,8 +709,12 @@ impl Builder {
let stream = self.stream.to_str(); let stream = self.stream.to_str();
let mut args = vec!["run", "--package", "tools", "--bin", "create-image", "--"]; let mut args = vec!["run", "--package", "tools", "--bin", "create-image", "--"];
let output_file = format!("target/{}/{}/args.bin", TARGET_TRIPLE, stream); let mut output_file = PathBuf::new();
args.push(&output_file); output_file.push("target");
output_file.push(TARGET_TRIPLE);
output_file.push(stream);
output_file.push("xous_presign.img");
args.push(output_file.to_str().unwrap());
args.push("--kernel"); args.push("--kernel");
args.push(kernel); args.push(kernel);
@ -748,7 +739,7 @@ impl Builder {
if !status.success() { if !status.success() {
return Err("cargo build failed".into()); return Err("cargo build failed".into());
} }
Ok(project_root().join(&format!("target/{}/{}/args.bin", TARGET_TRIPLE, stream))) Ok(project_root().join(output_file))
} }
fn fetch_prebuilds(&self) -> Result<Vec::<String>, DynError> { fn fetch_prebuilds(&self) -> Result<Vec::<String>, DynError> {