mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
remove xtask bodges for MPW
This commit is contained in:
parent
e3664738bc
commit
45ff0632b8
2 changed files with 3 additions and 108 deletions
|
|
@ -1269,6 +1269,7 @@ pub fn project_root() -> PathBuf {
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, BufRead, BufReader};
|
use std::io::{self, BufRead, BufReader};
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn search_and_replace_in_file(filename: &str, search: &str, replace: &str) -> io::Result<()> {
|
pub fn search_and_replace_in_file(filename: &str, search: &str, replace: &str) -> io::Result<()> {
|
||||||
let file = File::open(filename)?;
|
let file = File::open(filename)?;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
|
|
@ -1287,6 +1288,7 @@ pub fn search_and_replace_in_file(filename: &str, search: &str, replace: &str) -
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn search_in_file(filename: &str, search: &str) -> io::Result<bool> {
|
pub fn search_in_file(filename: &str, search: &str) -> io::Result<bool> {
|
||||||
let file = File::open(filename)?;
|
let file = File::open(filename)?;
|
||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
|
|
|
||||||
|
|
@ -204,62 +204,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
builder.set_change_target_flag();
|
builder.set_change_target_flag();
|
||||||
}
|
}
|
||||||
|
|
||||||
// manage an ugly patch we have to do to selectively configure AES for only cramium-soc targets
|
|
||||||
match builder::search_in_file("services/aes/Cargo.toml", "default = []") {
|
|
||||||
Ok(false) => {
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"services/aes/Cargo.toml",
|
|
||||||
"default = [\"cramium-soc\"]",
|
|
||||||
"default = []",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch AES");
|
|
||||||
|
|
||||||
// revert these just in case - but don't throw an error if the strings aren't found
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"Cargo.toml",
|
|
||||||
"# [patch.crates-io.curve25519-dalek]",
|
|
||||||
"[patch.crates-io.curve25519-dalek]",
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"Cargo.toml",
|
|
||||||
"# git = \"https://github.com/betrusted-io/curve25519-dalek.git\"",
|
|
||||||
"git = \"https://github.com/betrusted-io/curve25519-dalek.git\"",
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"Cargo.toml",
|
|
||||||
"# branch = \"main\" # c25519",
|
|
||||||
"branch = \"main\" # c25519",
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"services/root-keys/Cargo.toml",
|
|
||||||
"# features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
"features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"services/shellchat/Cargo.toml",
|
|
||||||
"# features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
"features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
|
|
||||||
match builder::search_in_file("services/aes/Cargo.toml", "default = []") {
|
|
||||||
Ok(false) => {
|
|
||||||
return Err(
|
|
||||||
"Couldn't revert services/aes/Cargo.toml -- is the file writeable or corrupted?"
|
|
||||||
.into(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
let mut broken_aes_cleanup = false;
|
|
||||||
|
|
||||||
// ---- now process the verb plus position dependent arguments ----
|
// ---- now process the verb plus position dependent arguments ----
|
||||||
let mut args = env::args();
|
let mut args = env::args();
|
||||||
let task = args.nth(1);
|
let task = args.nth(1);
|
||||||
|
|
@ -588,7 +532,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
Some("cramium-soc") => builder.target_cramium_soc(),
|
Some("cramium-soc") => builder.target_cramium_soc(),
|
||||||
_ => panic!("should be unreachable"),
|
_ => panic!("should be unreachable"),
|
||||||
};
|
};
|
||||||
broken_aes_cleanup = true;
|
|
||||||
|
|
||||||
for service in cramium_flash_pkgs {
|
for service in cramium_flash_pkgs {
|
||||||
builder.add_service(service, LoaderRegion::Flash);
|
builder.add_service(service, LoaderRegion::Flash);
|
||||||
|
|
@ -685,7 +628,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let bao_rram_pkgs =
|
let bao_rram_pkgs =
|
||||||
["xous-ticktimer", "xous-log", "xous-names", "keystore" /* "usb-cramium" */].to_vec(); /* "usb-cramium" */
|
["xous-ticktimer", "xous-log", "xous-names", "keystore" /* "usb-cramium" */].to_vec(); /* "usb-cramium" */
|
||||||
let bao_swap_pkgs =
|
let bao_swap_pkgs =
|
||||||
["cram-hal-service", "bao-console", /* "modals", "pddb", */ "bao-video"].to_vec(); /* "bao-video" */
|
["cram-hal-service", "bao-console", "modals", /* "pddb", */ "bao-video"].to_vec(); /* "bao-video" */
|
||||||
if !builder.is_swap_set() {
|
if !builder.is_swap_set() {
|
||||||
builder.set_swap(0, 8 * 1024 * 1024);
|
builder.set_swap(0, 8 * 1024 * 1024);
|
||||||
}
|
}
|
||||||
|
|
@ -716,7 +659,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
Some("baosec") => builder.target_cramium_soc(),
|
Some("baosec") => builder.target_cramium_soc(),
|
||||||
_ => panic!("should be unreachable"),
|
_ => panic!("should be unreachable"),
|
||||||
};
|
};
|
||||||
broken_aes_cleanup = true;
|
|
||||||
|
|
||||||
// It is important that this is the first service added, because the swapper *must* be in PID 2
|
// It is important that this is the first service added, because the swapper *must* be in PID 2
|
||||||
builder.add_service("xous-swapper", LoaderRegion::Flash);
|
builder.add_service("xous-swapper", LoaderRegion::Flash);
|
||||||
|
|
@ -756,55 +698,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
}
|
}
|
||||||
builder.build()?;
|
builder.build()?;
|
||||||
|
|
||||||
// AES is broken in the current rev of the Cramium SoC. This unpatches the crate so other builds can
|
|
||||||
// work properly.
|
|
||||||
if broken_aes_cleanup {
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"services/aes/Cargo.toml",
|
|
||||||
"default = [\"cramium-soc\"]",
|
|
||||||
"default = []",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch AES");
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"Cargo.toml",
|
|
||||||
"# [patch.crates-io.curve25519-dalek]",
|
|
||||||
"[patch.crates-io.curve25519-dalek]",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch curve25519");
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"Cargo.toml",
|
|
||||||
"# git = \"https://github.com/betrusted-io/curve25519-dalek.git\"",
|
|
||||||
"git = \"https://github.com/betrusted-io/curve25519-dalek.git\"",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch curve25519");
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"Cargo.toml",
|
|
||||||
"# branch = \"main\" # c25519",
|
|
||||||
"branch = \"main\" # c25519",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch curve25519");
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"services/root-keys/Cargo.toml",
|
|
||||||
"# features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
"features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch rootkeys");
|
|
||||||
builder::search_and_replace_in_file(
|
|
||||||
"services/shellchat/Cargo.toml",
|
|
||||||
"# features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
"features = [\"auto-release\", \"warn-fallback\"]",
|
|
||||||
)
|
|
||||||
.expect("couldn't patch shellchat");
|
|
||||||
}
|
|
||||||
match builder::search_in_file("services/aes/Cargo.toml", "default = []") {
|
|
||||||
Ok(false) => {
|
|
||||||
println!(
|
|
||||||
"Build configuration is out of sync: cramium-soc patch on AES crate was not cleared out"
|
|
||||||
);
|
|
||||||
return Err("services/aes/Cargo.toml is in a bad state! Revert any patches to the file.".into());
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
// the intent of this call is to check that crates we are sourcing from crates.io
|
// the intent of this call is to check that crates we are sourcing from crates.io
|
||||||
// match the crates in our local source. The usual cause of an inconsistency is
|
// match the crates in our local source. The usual cause of an inconsistency is
|
||||||
// a maintainer forgot to publish a change to crates.io.
|
// a maintainer forgot to publish a change to crates.io.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue