From b452fceb8221ca4cfbecf13c95e760be5bf3c2d4 Mon Sep 17 00:00:00 2001 From: nearology Date: Mon, 9 Nov 2026 21:01:04 +0330 Subject: [PATCH] =?UTF-8?q?=D9=88=D8=B1=DA=A9=20=D9=81=D9=84=D9=88=20bootc?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/boot-config.yml | 28 ++++++++++++++++++++++++++++ scripts/serial_command.py | 19 ++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/boot-config.yml diff --git a/.gitea/workflows/boot-config.yml b/.gitea/workflows/boot-config.yml new file mode 100644 index 0000000..fab89d3 --- /dev/null +++ b/.gitea/workflows/boot-config.yml @@ -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 diff --git a/scripts/serial_command.py b/scripts/serial_command.py index a6fe407..9c3c8da 100644 --- a/scripts/serial_command.py +++ b/scripts/serial_command.py @@ -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