اضافه شدن ورک فلو بوتcmd
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
name: Configure Boot Command for Detected Flash
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
set-bootcmd:
|
||||||
|
runs-on: serial-runner
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Detect flash, set bootcmd and verify
|
||||||
|
run: /usr/bin/python3 scripts/serial_command.py set-bootcmd
|
||||||
@@ -63,3 +63,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Inspect boot configuration
|
- name: Inspect boot configuration
|
||||||
run: /usr/bin/python3 scripts/serial_command.py boot-config
|
run: /usr/bin/python3 scripts/serial_command.py boot-config
|
||||||
|
|
||||||
|
- name: Configure and verify bootcmd for detected flash
|
||||||
|
run: /usr/bin/python3 scripts/serial_command.py set-bootcmd
|
||||||
|
|||||||
@@ -184,6 +184,20 @@ def erase_flash(cli):
|
|||||||
print("\nFull-flash erase command succeeded; first 256 bytes verified as FF.")
|
print("\nFull-flash erase command succeeded; first 256 bytes verified as FF.")
|
||||||
|
|
||||||
|
|
||||||
|
def set_bootcmd(cli):
|
||||||
|
capacity = detect_flash(cli)
|
||||||
|
dtb_offset, dtb_size = LAYOUTS[capacity]["dtb"]
|
||||||
|
kernel_offset, kernel_size = LAYOUTS[capacity]["kernel"]
|
||||||
|
bootcmd = (
|
||||||
|
f"sf probe 0; sf read 0x41800000 {dtb_offset:#x} {dtb_size:#x}; "
|
||||||
|
f"sf read 0x42000000 {kernel_offset:#x} {kernel_size:#x}; "
|
||||||
|
"bootz 0x42000000 - 0x41800000"
|
||||||
|
)
|
||||||
|
cli.command("setenv bootcmd '" + bootcmd + "'")
|
||||||
|
cli.command("printenv bootcmd", r"^bootcmd=" + re.escape(bootcmd) + r"$")
|
||||||
|
print("\nDynamic bootcmd verified in RAM; environment not saved and bootcmd not executed.")
|
||||||
|
|
||||||
|
|
||||||
def boot_config(cli, confirmed=False):
|
def boot_config(cli, confirmed=False):
|
||||||
cli.command(
|
cli.command(
|
||||||
"printenv bootcmd bootargs", allow_missing=("bootcmd", "bootargs"),
|
"printenv bootcmd bootargs", allow_missing=("bootcmd", "bootargs"),
|
||||||
@@ -199,7 +213,7 @@ def boot_config(cli, confirmed=False):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("mode", choices=("check", "configure", "transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs", "erase", "boot-config", "preflight"), default="check", nargs="?")
|
parser.add_argument("mode", choices=("check", "configure", "transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs", "erase", "boot-config", "preflight", "set-bootcmd"), default="check", nargs="?")
|
||||||
parser.add_argument("--port", default="/dev/ttyUSB0")
|
parser.add_argument("--port", default="/dev/ttyUSB0")
|
||||||
parser.add_argument("--firmware", type=Path, default=None)
|
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)")
|
parser.add_argument("--rootfs-size", type=lambda value: int(value, 0), help="Actual RootFS partition size in bytes (decimal or 0x-prefixed hex)")
|
||||||
@@ -236,6 +250,9 @@ def main():
|
|||||||
if args.mode == "boot-config":
|
if args.mode == "boot-config":
|
||||||
boot_config(cli, confirmed=args.confirm_squashfs_mtdblock3)
|
boot_config(cli, confirmed=args.confirm_squashfs_mtdblock3)
|
||||||
return
|
return
|
||||||
|
if args.mode == "set-bootcmd":
|
||||||
|
set_bootcmd(cli)
|
||||||
|
return
|
||||||
if args.mode in ("transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs"):
|
if args.mode in ("transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs"):
|
||||||
transfer(cli, args.firmware, dtb=args.mode == "transfer-dtb", kernel=args.mode == "transfer-kernel", rootfs=args.mode == "transfer-rootfs", rootfs_size=args.rootfs_size)
|
transfer(cli, args.firmware, dtb=args.mode == "transfer-dtb", kernel=args.mode == "transfer-kernel", rootfs=args.mode == "transfer-rootfs", rootfs_size=args.rootfs_size)
|
||||||
return
|
return
|
||||||
|
|||||||
مرجع در شماره جدید
مسدود کردن کاربر