next: refresh to main + afw OS bundle (install/uninstall, GUI, genuine-firmware restore) #29
@@ -463,7 +463,13 @@ fn run_install(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
|
||||
AmInstallOutcome::DryRun(report) => {
|
||||
print!("{}", report.render());
|
||||
println!("DRY RUN: no board erase or write was performed.");
|
||||
println!("Re-run with --confirm FLASH to write mtd8, mtd6 and mtd7.");
|
||||
let targets = plan
|
||||
.targets
|
||||
.iter()
|
||||
.map(|t| t.partition.name.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
println!("Re-run with --confirm FLASH to write {targets}.");
|
||||
}
|
||||
AmInstallOutcome::Installed(receipt) => {
|
||||
for backup in &receipt.backups {
|
||||
|
||||
@@ -580,7 +580,8 @@ pub fn preflight(
|
||||
let fingerprint = remote.user_command(
|
||||
"uname -r; echo __MODEL__; cat /proc/device-tree/model 2>/dev/null; echo; \
|
||||
echo __RELEASE__; cat /etc/os-release 2>/dev/null; \
|
||||
ls /etc/alkane-release /etc/ouros-release /etc/bos_version /etc/fw-info 2>/dev/null",
|
||||
ls /etc/alkane-release /etc/ouros-release /etc/bos_version /etc/fw-info 2>/dev/null \
|
||||
|| true",
|
||||
Duration::from_secs(20),
|
||||
)?;
|
||||
let text = String::from_utf8_lossy(&fingerprint).into_owned();
|
||||
@@ -622,16 +623,20 @@ pub fn preflight(
|
||||
)?)
|
||||
.into_owned();
|
||||
let mtd = parse_proc_mtd(&mtd_text);
|
||||
let map_ok = MTD_MAP.iter().all(|(name, _, size, ..)| {
|
||||
mtd.get(*name)
|
||||
.map(|entry: &(u64, String)| entry.0 == *size && entry.1 == *name)
|
||||
.unwrap_or(false)
|
||||
});
|
||||
// Validate the live geometry against the plan's partitions by index+size.
|
||||
// The vendor labels (spl, u-boot, kernel, ...) are board-specific and are
|
||||
// not part of our map, so only the mtdN index and its size are checked.
|
||||
let map_ok = plan.partitions.len() == mtd.len()
|
||||
&& plan.partitions.iter().all(|part| {
|
||||
mtd.get(&part.name)
|
||||
.map(|entry: &(u64, String)| entry.0 == part.size)
|
||||
.unwrap_or(false)
|
||||
});
|
||||
checks.push(AmCheck {
|
||||
name: "mtd-map".to_owned(),
|
||||
ok: map_ok,
|
||||
detail: if map_ok {
|
||||
"12 partitions match the captured map".to_owned()
|
||||
format!("{} partitions match the plan geometry by size", plan.partitions.len())
|
||||
} else {
|
||||
format!("partition table differs: {mtd_text}")
|
||||
},
|
||||
|
||||
@@ -354,7 +354,14 @@ pub(crate) fn classify(kernel: &str, release: &str, all: &str) -> String {
|
||||
if all.contains("/etc/fw-info") || release.contains("Vnish") || release.contains("AnthillOS") {
|
||||
return "vnish".to_owned();
|
||||
}
|
||||
if kernel.contains("4.9.38") || all.contains("update-daemon") || all.contains("rroot") {
|
||||
// Stock Bitmain control boards: Amlogic stock is kernel 4.9.38; the AM335x
|
||||
// (BeagleBone-class) stock is kernel 3.8.13+ with an "Antminer" model line.
|
||||
if kernel.contains("4.9.38")
|
||||
|| kernel.starts_with("3.8.13")
|
||||
|| all.contains("update-daemon")
|
||||
|| all.contains("rroot")
|
||||
|| all.to_lowercase().contains("antminer")
|
||||
{
|
||||
return "stock-bitmain".to_owned();
|
||||
}
|
||||
"unknown".to_owned()
|
||||
|
||||
Reference in New Issue
Block a user