ورک فلو bootcmd
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
name: Inspect and Configure Boot Arguments
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
confirm_squashfs_mtdblock3:
|
||||
description: 'Confirm RootFS is actually SquashFS on mtdblock3 and set bootargs'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
boot-config:
|
||||
runs-on: serial-runner
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Inspect boot settings and optionally set verified bootargs
|
||||
env:
|
||||
CONFIRM_SQUASHFS_MTDBLOCK3: ${{ inputs.confirm_squashfs_mtdblock3 }}
|
||||
run: |
|
||||
if [ "$CONFIRM_SQUASHFS_MTDBLOCK3" = "true" ]; then
|
||||
/usr/bin/python3 scripts/serial_command.py boot-config --confirm-squashfs-mtdblock3
|
||||
else
|
||||
/usr/bin/python3 scripts/serial_command.py boot-config
|
||||
fi
|
||||
@@ -163,12 +163,26 @@ def erase_flash(cli):
|
||||
print("\nFull-flash erase command succeeded; first 256 bytes verified as FF.")
|
||||
|
||||
|
||||
def boot_config(cli, confirmed=False):
|
||||
cli.command(
|
||||
"printenv bootcmd bootargs", allow_missing=("bootcmd", "bootargs"),
|
||||
)
|
||||
if not confirmed:
|
||||
print("\nBoot configuration inspected; no changes requested.")
|
||||
return
|
||||
bootargs = "console=ttyS0,115200 loglevel=8 root=/dev/mtdblock3 rootfstype=squashfs ro rootwait"
|
||||
cli.command("setenv bootargs '" + bootargs + "'")
|
||||
cli.command("printenv bootargs", r"^bootargs=" + re.escape(bootargs) + r"$")
|
||||
print("\nBootargs verified in RAM; environment not saved and board not rebooted.")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("mode", choices=("check", "configure", "transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs", "erase"), default="check", nargs="?")
|
||||
parser.add_argument("mode", choices=("check", "configure", "transfer", "transfer-dtb", "transfer-kernel", "transfer-rootfs", "erase", "boot-config"), 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)")
|
||||
parser.add_argument("--confirm-squashfs-mtdblock3", action="store_true", help="Confirm actual RootFS is SquashFS on mtdblock3 and set bootargs")
|
||||
args = parser.parse_args()
|
||||
if args.mode == "transfer-rootfs" and (args.rootfs_size is None or args.rootfs_size < 64):
|
||||
parser.error("--rootfs-size must specify the actual RootFS partition size (at least 64 bytes)")
|
||||
@@ -188,6 +202,9 @@ def main():
|
||||
if args.mode == "erase":
|
||||
erase_flash(cli)
|
||||
return
|
||||
if args.mode == "boot-config":
|
||||
boot_config(cli, confirmed=args.confirm_squashfs_mtdblock3)
|
||||
return
|
||||
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)
|
||||
return
|
||||
|
||||
مرجع در شماره جدید
مسدود کردن کاربر