diff --git a/.gitea/workflows/flash-aminpa-V1.5.yml b/.gitea/workflows/flash-aminpa-V1.5.yml index 9bb6aaf..e3a7d54 100644 --- a/.gitea/workflows/flash-aminpa-V1.5.yml +++ b/.gitea/workflows/flash-aminpa-V1.5.yml @@ -67,5 +67,8 @@ jobs: - name: Configure and verify bootcmd for detected flash run: /usr/bin/python3 scripts/serial_command.py set-bootcmd + - name: Save U-Boot environment before reboot + run: /usr/bin/python3 scripts/serial_command.py saveenv + - name: Reboot hardware after successful flashing run: /usr/bin/python3 scripts/serial_command.py reboot diff --git a/scripts/serial_command.py b/scripts/serial_command.py index 8757f05..45eb84b 100644 --- a/scripts/serial_command.py +++ b/scripts/serial_command.py @@ -213,7 +213,7 @@ def boot_config(cli, confirmed=False): def main(): parser = argparse.ArgumentParser() - parser.add_argument("mode", choices=("check", "configure", "transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs", "erase", "boot-config", "preflight", "set-bootcmd", "reboot"), default="check", nargs="?") + parser.add_argument("mode", choices=("check", "configure", "transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs", "erase", "boot-config", "preflight", "set-bootcmd", "saveenv", "reboot"), default="check", nargs="?") parser.add_argument("--port", default="/dev/ttyUSB0") parser.add_argument("--firmware", type=Path, default=None) parser.add_argument("--rootfs-size", type=lambda value: int(value, 0), help="Actual RootFS partition size in bytes (decimal or 0x-prefixed hex)") @@ -232,6 +232,10 @@ def main(): cli.detect() if args.mode == "check": return + if args.mode == "saveenv": + cli.command("saveenv", timeout=120) + print("Current U-Boot environment saved successfully.", flush=True) + return if args.mode == "reboot": print("\n>>> reset", flush=True) port.write(b"reset\r")