Merge pull request #249 from betrusted-io/rename-args.bin

Rename args.bin
This commit is contained in:
bunnie 2022-10-20 15:27:51 +08:00 committed by GitHub
commit 6ea4cd38b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 23 deletions

View file

@ -91,12 +91,12 @@ fn process_tags(b8: *mut u8) {
}
}
fn doit() -> io::Result<()> {
fn main() -> io::Result<()> {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
println!(
"Usage: {} args.bin",
args.get(0).unwrap_or(&"read-tags".to_owned())
"Usage: {} [xous_presign.img]",
args.get(0).map(|a| a.as_str()).unwrap_or("read-tags")
);
process::exit(1);
}
@ -113,6 +113,3 @@ fn doit() -> io::Result<()> {
process_tags(byte_buffer);
Ok(())
}
fn main() {
doit().unwrap();
}

View file

@ -665,20 +665,7 @@ impl Builder {
}
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_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())
.current_dir(project_root())
@ -690,7 +677,7 @@ impl Builder {
"sign-image",
"--",
"--kernel-image",
xous_img_presign_path.to_str().unwrap(),
output_bundle.to_str().unwrap(),
"--kernel-key",
&self.kernel_key,
"--kernel-output",
@ -722,8 +709,12 @@ impl Builder {
let stream = self.stream.to_str();
let mut args = vec!["run", "--package", "tools", "--bin", "create-image", "--"];
let output_file = format!("target/{}/{}/args.bin", TARGET_TRIPLE, stream);
args.push(&output_file);
let mut output_file = PathBuf::new();
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);
@ -748,7 +739,7 @@ impl Builder {
if !status.success() {
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> {