اصلاح ورک فلو فلش u-boot
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Transfer U-Boot to RAM
|
name: Transfer, Write and Verify U-Boot
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -11,6 +11,6 @@ jobs:
|
|||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Transfer firmware and verify RAM contents
|
- name: Transfer firmware, write SPI flash and verify read-back
|
||||||
run: |
|
run: |
|
||||||
/usr/bin/python3 scripts/serial_command.py transfer
|
/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
|
Place `u-boot-sunxi-with-spl.bin` here before running the workflow.
|
||||||
Transfer U-Boot to RAM 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
|
The workflow clears stale `filesize`, requires a successful TFTP transfer,
|
||||||
as its TFTP root, so the file is available as `u-boot-sunxi-with-spl.bin`.
|
and checks hexadecimal `filesize` against both the transfer count and local
|
||||||
Checking out this repository alone does not publish files over TFTP.
|
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
|
No erase, reboot or saveenv command is issued. Any failed or unverified
|
||||||
transferred size and the first 32 bytes against this local file. It does
|
command stops execution; flash writes are never automatically retried.
|
||||||
not erase or write SPI flash, save the environment, or boot the image.
|
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ class UBoot:
|
|||||||
|
|
||||||
def transfer(cli, firmware):
|
def transfer(cli, firmware):
|
||||||
image = firmware.read_bytes()
|
image = firmware.read_bytes()
|
||||||
if not 32 <= len(image) <= 0x02000000:
|
if not 32 <= len(image) <= 0x200000:
|
||||||
raise RuntimeError("Firmware must contain at least 32 bytes and fit RAM at 0x42000000")
|
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(
|
output = cli.command(
|
||||||
"tftp 0x42000000 u-boot-sunxi-with-spl.bin",
|
"tftp 0x42000000 u-boot-sunxi-with-spl.bin",
|
||||||
r"^Bytes transferred = \d+", timeout=120,
|
r"^Bytes transferred = \d+", timeout=120,
|
||||||
@@ -106,7 +108,24 @@ def transfer(cli, firmware):
|
|||||||
dumped.extend(bytes.fromhex(rows[0]))
|
dumped.extend(bytes.fromhex(rows[0]))
|
||||||
if dumped != image[:32]:
|
if dumped != image[:32]:
|
||||||
raise RuntimeError("First 32 bytes in RAM differ from the local firmware file")
|
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():
|
def main():
|
||||||
|
|||||||
مرجع در شماره جدید
مسدود کردن کاربر