اصلاح ورک فلو فلش u-boot

This commit is contained in:
2026-11-09 20:48:32 +03:30
والد 3cfe096d81
کامیت ca7ae6df6c
3فایلهای تغییر یافته به همراه34 افزوده شده و 13 حذف شده
@@ -1,4 +1,4 @@
name: Transfer U-Boot to RAM
name: Transfer, Write and Verify U-Boot
on:
workflow_dispatch:
@@ -11,6 +11,6 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Transfer firmware and verify RAM contents
- name: Transfer firmware, write SPI flash and verify read-back
run: |
/usr/bin/python3 scripts/serial_command.py transfer
+10 -8
مشاهده پرونده
@@ -1,10 +1,12 @@
Place `u-boot-sunxi-with-spl.bin` in this directory before running the
Transfer U-Boot to RAM workflow.
Place `u-boot-sunxi-with-spl.bin` here before running the workflow.
The existing TFTP server (`serverip`) must serve this directory as its root.
Checkout alone does not publish files over TFTP.
The existing TFTP server (`serverip` in U-Boot) must serve this directory
as its TFTP root, so the file is available as `u-boot-sunxi-with-spl.bin`.
Checking out this repository alone does not publish files over TFTP.
The workflow clears stale `filesize`, requires a successful TFTP transfer,
and checks hexadecimal `filesize` against both the transfer count and local
file size (32 through 0x200000 bytes). It compares the first 32 RAM bytes
with the local file, probes SPI flash, writes at offset 0, reads back to
0x42800000 and compares the full transferred length with `cmp.b`.
The workflow uses the current U-Boot network settings. It verifies the
transferred size and the first 32 bytes against this local file. It does
not erase or write SPI flash, save the environment, or boot the image.
No erase, reboot or saveenv command is issued. Any failed or unverified
command stops execution; flash writes are never automatically retried.
+22 -3
مشاهده پرونده
@@ -84,8 +84,10 @@ class UBoot:
def transfer(cli, firmware):
image = firmware.read_bytes()
if not 32 <= len(image) <= 0x02000000:
raise RuntimeError("Firmware must contain at least 32 bytes and fit RAM at 0x42000000")
if not 32 <= len(image) <= 0x200000:
raise RuntimeError("Firmware size must be between 32 and 0x200000 bytes")
# Invalidate any previous transfer length before attempting a new transfer.
cli.command("setenv filesize")
output = cli.command(
"tftp 0x42000000 u-boot-sunxi-with-spl.bin",
r"^Bytes transferred = \d+", timeout=120,
@@ -106,7 +108,24 @@ def transfer(cli, firmware):
dumped.extend(bytes.fromhex(rows[0]))
if dumped != image[:32]:
raise RuntimeError("First 32 bytes in RAM differ from the local firmware file")
print("\nTransfer verified: size and first 32 bytes match; no flash write performed.")
print("\nTransfer verified: size and first 32 bytes match.")
cli.command("sf probe 0:0", r"^SF: Detected .+", timeout=20)
cli.command(
"sf write 0x42000000 0x0 ${filesize}",
rf"^SF: {len(image)} bytes @ 0x0 Written: OK\s*$", timeout=120,
)
cli.command(
"sf read 0x42800000 0x0 ${filesize}",
rf"^SF: {len(image)} bytes @ 0x0 Read: OK\s*$", timeout=120,
)
output = cli.command(
"cmp.b 0x42000000 0x42800000 ${filesize}",
r"^Total of \d+ byte\(s\) were the same", timeout=60,
)
compared = re.findall(r"^Total of (\d+) byte\(s\) were the same", output, re.MULTILINE)
if compared != [str(len(image))]:
raise RuntimeError("Flash comparison byte count differs from firmware size")
print("\nU-Boot flash write and full read-back comparison verified.")
def main():