Add zynq-7010 toolkit flash module (tier-2 update, offset writes, BOOT.bin guard)

The toolkit now flashes the Zynq update path through the CLI like am335x/cv1835.
- boards/zynq.rs: ZynqPlan::from_afw (validates the zynq-7010 .afw: armv7, preserve,
  the kernel/dtb/rootfs image set, zimage/fdt/cpio-gzip formats, size ceilings,
  rejects any bootloader/spl/BOOT.bin member and a non-zImage kernel), preflight
  (alkane source, root, flash tools, mtd0/mtd1, BOOT.bin-preserve guard), install
  (OFFSET-AWARE: nanddump/flash_erase/nandwrite --start at the device-relative
  slot offset - kernel 0x2200000, dtb 0x2700000 in /dev/mtd0, rootfs in /dev/mtd1
  - with per-region backup + md5 readback), and a hard guard that refuses any
  /dev/mtd0 write below BOOTBIN_PRESERVE so BOOT.bin can never be clobbered.
- alkane-artifacts: add the strict 'zimage' image format (magic 0x016f2818 at 0x24).
- alkane-cli: route zynq-7010 through afw plan/preflight/install.
- 6 module tests (good plan, non-zImage, oversize, bootloader member, wrong
  board/arch, every-mtd0-target-above-BOOT.bin). Full flash suite 47 green,
  artifacts green; the real bundle renders its plan through the CLI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qHxYpv7yf7Ah57g4rQ
This commit is contained in:
2026-11-06 20:13:38 -06:00
co-authored by Claude Opus 4.8
parent b1316b2bd9
commit cce24b6880
4 changed files with 656 additions and 1 deletions
+49
View File
@@ -12,6 +12,7 @@ use alkane_flash::boards::am335x::{
self as am335x, Am335xPlan, AmInstallOptions, AmInstallOutcome, AmRestoreOptions,
};
use alkane_flash::boards::cv1835::Cv1835Plan;
use alkane_flash::boards::zynq::{self, ZynqInstallOptions, ZynqOutcome, ZynqPlan};
use alkane_flash::install::{
install, restore, verify_live, InstallOptions, InstallOutcome, RestoreOptions,
};
@@ -344,6 +345,12 @@ fn run_plan(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
println!("plan is read-only; no write performed");
return Ok(());
}
if zynq::owns_board(&verified.manifest.board) {
let plan = ZynqPlan::from_afw(&verified)?;
println!("{}", plan.render());
println!("plan is read-only; no write performed (run preflight/install with --host)");
return Ok(());
}
let plan = Cv1835Plan::from_afw(&verified)?;
let (ssh, _secret) = ssh_options(&opts, DEFAULT_USER)?;
let mut transport = SshTransport::connect(ssh, true)?;
@@ -399,6 +406,15 @@ fn run_preflight(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
}
return Ok(());
}
if zynq::owns_board(&verified.manifest.board) {
let plan = ZynqPlan::from_afw(&verified)?;
let report = zynq::preflight(&plan, &mut transport, opts.value("host").unwrap_or(""))?;
print!("{}", report.render());
if !report.ok() {
return Err("preflight failed; do not write".into());
}
return Ok(());
}
let plan = Cv1835Plan::from_afw(&verified)?;
let held_backup = opts.value("held-backup").map(PathBuf::from);
let report = preflight(
@@ -495,6 +511,39 @@ fn run_install(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
}
return Ok(());
}
if zynq::owns_board(&verified.manifest.board) {
let plan = ZynqPlan::from_afw(&verified)?;
println!("{}", plan.render());
let install_options = ZynqInstallOptions {
dry_run: opts.flag("dry-run"),
confirm: opts.value("confirm").map(str::to_owned),
no_reboot: opts.flag("no-reboot"),
backup_dir,
};
match zynq::install(&plan, &mut transport, &install_options, opts.value("host").unwrap_or(""))? {
ZynqOutcome::DryRun(report) => {
print!("{}", report.render());
println!("DRY RUN: no board erase or write was performed.");
let targets = plan.targets.iter().map(|t| t.image_name.as_str()).collect::<Vec<_>>().join(", ");
println!("Re-run with --confirm FLASH to write {targets} (BOOT.bin preserved).");
}
ZynqOutcome::Installed(receipt) => {
for backup in &receipt.backups {
println!(
"held {} {} offset 0x{:x} md5 {}",
backup.image_name, backup.path.display(), backup.offset, backup.md5
);
}
println!("all read-backs matched before reboot; BOOT.bin never touched");
if receipt.rebooted {
println!("reboot issued; an SSH drop here is the success signature");
} else {
println!("reboot skipped (--no-reboot)");
}
}
}
return Ok(());
}
let plan = Cv1835Plan::from_afw(&verified)?;
let install_options = InstallOptions {
dry_run: opts.flag("dry-run"),