get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.0/patches/2197332/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2197332,
    "url": "http://patchwork.ozlabs.org/api/1.0/patches/2197332/?format=api",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/1.0/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<20260217163911.31878-11-hs@nabladev.com>",
    "date": "2026-02-17T16:39:10",
    "name": "[v3,10/11] siemens: capricorn: rework bootcmd environment variables",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3386c043acafefd8ad43bf8ec0e37709dd9b1f6e",
    "submitter": {
        "id": 91409,
        "url": "http://patchwork.ozlabs.org/api/1.0/people/91409/?format=api",
        "name": "Heiko Schocher",
        "email": "hs@nabladev.com"
    },
    "delegate": {
        "id": 151988,
        "url": "http://patchwork.ozlabs.org/api/1.0/users/151988/?format=api",
        "username": "festevam",
        "first_name": "Fabio",
        "last_name": "Estevam",
        "email": "festevam@gmail.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260217163911.31878-11-hs@nabladev.com/mbox/",
    "series": [
        {
            "id": 492456,
            "url": "http://patchwork.ozlabs.org/api/1.0/series/492456/?format=api",
            "date": "2026-02-17T16:39:00",
            "name": "imx8qxp: siemens: small board updates",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/492456/mbox/"
        }
    ],
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2197332/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nabladev.com header.i=@nabladev.com header.a=rsa-sha256\n header.s=dkim header.b=c5diunwG;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=nabladev.com",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nabladev.com header.i=@nabladev.com\n header.b=\"c5diunwG\";\n\tdkim-atps=neutral",
            "phobos.denx.de; dmarc=pass (p=reject dis=none)\n header.from=nabladev.com",
            "phobos.denx.de; spf=pass smtp.mailfrom=hs@nabladev.com"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fFll45wxBz1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Feb 2026 03:41:04 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id BDAB883E76;\n\tTue, 17 Feb 2026 17:39:27 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id CB95B83E4C; Tue, 17 Feb 2026 17:39:25 +0100 (CET)",
            "from mx.nabladev.com (mx.nabladev.com [178.251.229.89])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 57F8483D3D\n for <u-boot@lists.denx.de>; Tue, 17 Feb 2026 17:39:23 +0100 (CET)",
            "from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 7FC6F110AE3; Tue, 17 Feb 2026 17:39:22 +0100 (CET)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=nabladev.com;\n s=dkim; t=1771346362; h=from:subject:date:message-id:to:cc:mime-version:\n content-transfer-encoding:in-reply-to:references;\n bh=9kX00FeFvYRxEGbhmndT8dtKrBi8TJ02s07Q04R7YpI=;\n b=c5diunwGgFc/wpf9ZxrUiZE16WFb+9ANUWeSfw2X0bfoCDuwtQnWGQyQkq05xWlvgnH8S1\n 1xxn0KvmzsPQJEAZJyuXvV/rPj2Cc3HxF7B5MLJRZYi3/bUOWaO87710kwuU5Usn8eMaDx\n urQS/0+C9tiUkP95ExIjuR0x7XaQ5S0PzcMlbsyrbJL6TJq+78ifEc1bVnobLTfCUwEDeN\n 8Nl74/KtNeBxxf7xrkWud4QYKrf1yAGVx+6SMWkKQ1OyoOLCEk9rBOQmwy5uKqqsTA79oF\n ZwWdx8JDWIQ12TFvCF6O0X+P7UOgwRt6mPN6pAQaf4AWd9mj3BB8Ce66NiSgqw==",
        "From": "Heiko Schocher <hs@nabladev.com>",
        "To": "U-Boot Mailing List <u-boot@lists.denx.de>",
        "Cc": "Fabio Estevam <festevam@gmail.com>, Peng Fan <peng.fan@oss.nxp.com>,\n Adrian Freihofer <adrian.freihofer@siemens.com>,\n Heiko Schocher <hs@nabladev.com>, Peng Fan <peng.fan@nxp.com>,\n Alexander Sverdlin <alexander.sverdlin@siemens.com>,\n Tom Rini <trini@konsulko.com>,\n Walter Schweizer <walter.schweizer@siemens.com>",
        "Subject": "[PATCH v3 10/11] siemens: capricorn: rework bootcmd environment\n variables",
        "Date": "Tue, 17 Feb 2026 17:39:10 +0100",
        "Message-Id": "<20260217163911.31878-11-hs@nabladev.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20260217163911.31878-1-hs@nabladev.com>",
        "References": "<20260217163911.31878-1-hs@nabladev.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Last-TLS-Session-Version": "TLSv1.3",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "From: Adrian Freihofer <adrian.freihofer@siemens.com>\n\nRework the boot state machine to a significantly simpler and more\nrobust implementation. The basic idea is to revert to the previous\npartition whenever an issue is detected during the boot process.\n\n- Broken SPL\n\n  If one of the two SPLs does not boot, the ROM code of the i.MX8 SoC\n  automatically starts the second SPL from the second boot partition.\n  For example, if the system's active partition is A but the SPL from\n  partition A is broken, the ROM code automatically uses the SPL/u-boot\n  from partition B.\n  Proceeding with this boot procedure would lead to booting the kernel/\n  rootfs from partition A, which could potentially successfully boot\n  the system and allow the user to apply the firmware update with the\n  broken SPL again. This would lead to a non-bootable system because\n  the second update would overwrite the last working bootloader.\n  To prevent such situations, zigzag boots are detected and the system\n  reverts to the previous partition rather than booting the kernel/rootfs\n  from the currently active partition. Detecting zigzag boots is done\n  via the new fallback variable.\n\n  To make this state machine even more consistent, the partitionset_active\n  variable is no longer used to determine the active partition during\n  boot. Instead, the active partition is always read from the eMMC\n  partconf registers.\n  For backward compatibility, the partitionset_active variable is still\n  updated whenever a partition switch occurs. However, u-boot no longer\n  relies on this variable, as it could potentially be out of sync with\n  the actual partition state, leading to situations where the ROM code\n  of the i.MX8 SoC would be out of sync with u-boot.\n\n- Broken kernel, initramfs or rootfs\n\n  If the upgrade_available variable is set, u-boot counts the number of\n  consecutive boots via the bootcount variable. If the bootcount exceeds\n  the bootlimit variable, u-boot starts the altbootcmd instead of the\n  bootcmd. Previously, this logic was bypassed by assigning the regular\n  bootcmd to altbootcmd. Now, the altbootcmd is used to revert to the\n  previous partition when the bootlimit is exceeded.\n\nThe netdev variable is changed to eth0 by default. This is what the FEC\ndriver uses on Capricorn boards. For devices with switches and DSA\nsubsystems in use, the netdev should be set accordingly by additional\nlogic in the environment or u-boot code. This is not part of this commit.\n\nSigned-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>\nSigned-off-by: Heiko Schocher <hs@nabladev.com>\nReviewed-by: Peng Fan <peng.fan@nxp.com>\n\n---\n\nChanges in v3:\nfixed long line length in environment file as Max suggested.\n\nChanges in v2:\nAdded Acked-by from Peng, fixed typo in commit message\nAdded small fixes in Environment from Adrian: It fixes a serious bug which\nAdrian detect. It occurs when a broken firmware is applied as a downgrade.\nThe old bootloader ended up in an endless reboot boot loop. With this fix\nalso the old bootloader is able to reject the update and recover. Also\nslightly reworked bootcmd.\n\n board/siemens/capricorn/capricorn_default.env | 90 +++++++++++++++----\n 1 file changed, 74 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/board/siemens/capricorn/capricorn_default.env b/board/siemens/capricorn/capricorn_default.env\nindex c150025c882..10d612b04fe 100644\n--- a/board/siemens/capricorn/capricorn_default.env\n+++ b/board/siemens/capricorn/capricorn_default.env\n@@ -1,17 +1,23 @@\n-altbootcmd=run bootcmd\n+terminate_upgrade=bootcount reset; setenv upgrade_available 0\n+altbootcmd=run terminate_upgrade; run toggle_partition\n baudrate=115200\n bootcmd=run flash_self;reset;\n bootdelay=3\n bootdir=targetdir/rootfs/boot\n bootlimit=3\n-check_upgrade=if test ${upgrade_available} -eq 1; then echo  upgrade_available is set; if test ${bootcount} -gt ${bootlimit}; then setenv upgrade_available 0;echo toggle partition;run toggle_partition;fi;fi;\n cntr_addr=0x88000000\n cntr_file=os_cntr_signed.bin\n console=ttyLP2\n dtb_name_default=default\n ethprime=eth1\n fdt_addr=0x83000000\n-flash_self=run mmc_boot\n+flash_self=if test -n \"$fallback\";then\n+\t\techo \"fallback: $fallback\";\n+\t\trun terminate_upgrade;\n+\t\trun toggle_partition;\n+\telse\n+\t\trun mmc_boot;\n+\tfi\n flash_self_test=setenv testargs test loglevel=3 systemd.unit=test.target; run mmc_boot\n hostname=capricorn\n initrd_addr=0x83100000\n@@ -19,7 +25,7 @@ initrd_high=0xffffffffffffffff\n ip_method=none\n kernel_name=Image\n loadaddr=0x80400000\n-mmc_boot=run set_bootargs;run check_upgrade; run set_partition;run set_bootargs_mmc;run mmc_load_bootfiles\n+mmc_boot=run set_bootargs; run set_partition;run set_bootargs_mmc;run mmc_load_bootfiles\n mmc_boot_fit=ext4load mmc 0:${mmc_part_nr} 0x88000000 boot/fitImage;\n \tif test -n ${A};then\n \t\tsetenv bootargs ${bootargs} rootfs_sig=${sig_a};\n@@ -28,27 +34,79 @@ mmc_boot_fit=ext4load mmc 0:${mmc_part_nr} 0x88000000 boot/fitImage;\n \t\tsetenv bootargs ${bootargs} rootfs_sig=${sig_b};\n \tfi;\n \tbootm 0x88000000#conf-${dtb_name}.dtb;bootm 0x88000000\n-mmc_boot_image=ext4load mmc 0:${mmc_part_nr} ${fdt_addr} boot/${dtb_name}.dtb;if test $? -eq 1;then ext4load mmc 0:${mmc_part_nr} ${fdt_addr} boot/${dtb_name_default}.dtb;fi; ext4load mmc 0:${mmc_part_nr} ${loadaddr} boot/${kernel_name}; booti ${loadaddr} - ${fdt_addr}\n-mmc_load_bootfiles=echo -n Loading from eMMC ...; if test -e mmc 0:${mmc_part_nr} boot/fitImage; then echo fit; setenv fdt_high; setenv initrd_high; run mmc_boot_fit; else echo image; run mmc_boot_image; fi\n-net_nfs=wdt dev scu-wdt; wdt stop; echo Booting from network ...; run set_bootargs_net; tftpboot ${loadaddr} ${bootdir}/${kernel_name}; printenv bootargs; if test ${kernel_name} = fitImage; then setenv fdt_high; setenv initrd_high; bootm ${loadaddr}#conf-${dtb_name}.dtb; else tftpboot ${fdt_addr} ${serverip}:${bootdir}/${dtb_name}.dtb; if test $? -eq 1; then echo Loading default.dtb!; tftpboot ${fdt_addr} ${serverip}:${bootdir}/${dtb_name_default}.dtb; fi; booti ${loadaddr} - ${fdt_addr}; fi\n-net_unfs=setenv nfsopts vers=3,udp,rsize=4096,wsize=4096,nolock,port=3049,mountport=3048 rw; run net_nfs\n-netdev=lan0\n+mmc_boot_image=ext4load mmc 0:${mmc_part_nr} ${fdt_addr} boot/${dtb_name}.dtb;\n+\tif test $? -eq 1;then\n+\t\text4load mmc 0:${mmc_part_nr} ${fdt_addr} boot/${dtb_name_default}.dtb;\n+\tfi;\n+\text4load mmc 0:${mmc_part_nr} ${loadaddr} boot/${kernel_name};\n+\tbooti ${loadaddr} - ${fdt_addr}\n+mmc_load_bootfiles=echo -n Loading from eMMC ...;\n+\tif test -e mmc 0:${mmc_part_nr} boot/fitImage; then\n+\t\techo fit; setenv fdt_high; setenv initrd_high; run mmc_boot_fit;\n+\telse\n+\t\techo image; run mmc_boot_image;\n+\tfi\n+net_nfs=wdt dev scu-wdt; wdt stop; echo Booting from network ...;\n+\trun set_bootargs_net; tftpboot ${loadaddr} ${bootdir}/${kernel_name};\n+\tprintenv bootargs;\n+\tif test ${kernel_name} = fitImage; then\n+\t\tsetenv fdt_high; setenv initrd_high;\n+\t\tbootm ${loadaddr}#conf-${dtb_name}.dtb;\n+\telse\n+\t\ttftpboot ${fdt_addr} ${serverip}:${bootdir}/${dtb_name}.dtb;\n+\t\tif test $? -eq 1; then\n+\t\t\techo Loading default.dtb!;\n+\t\t\ttftpboot ${fdt_addr} ${serverip}:${bootdir}/${dtb_name_default}.dtb;\n+\t\tfi;\n+\t\tbooti ${loadaddr} - ${fdt_addr};\n+\tfi\n+net_unfs=setenv nfsopts vers=3,udp,rsize=4096,wsize=4096,nolock,port=3049,mountport=3048 rw;\n+\trun net_nfs\n+netdev=eth0\n nfsopts=vers=3,udp,rsize=4096,wsize=4096,nolock rw\n partitionset_active=A\n rootfs_name=/dev/mmcblk0\n rootpath=/home/projects/targetdir/rootfs\n script_file=u-boot-commands.img\n-set_bootargs_mmc=setenv bootargs ${bootargs} root=${mmc_active_vol} ro rootdelay=1 rootwait rootfstype=ext4 ip=${ip_method}\n-set_bootargs_net=run set_bootargs; if test ${kernel_name} = fitImage; then setenv loadaddr 0x88000000; fi; setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off\n-set_bootargs=setenv bootargs console=${console},${baudrate} target_env=${target_env} ${testargs} ${optargs}\n-set_partition=setenv ${partitionset_active} true;if test -n ${A}; then setenv mmc_part_nr 1;fi;if test -n ${B}; then setenv mmc_part_nr 2;fi;setenv mmc_active_vol ${rootfs_name}p${mmc_part_nr}\n-tftp_run_script=tftpboot ${kernel_loadaddr} ${serverip}:${script_file};if test $? -eq 0;then source ${kernel_loadaddr};fi\n-toggle_partition=setenv ${partitionset_active} true; if test -n ${A}; then setenv partitionset_active B; mmc partconf 0 1 2 0; env delete A; fi; if test -n ${B}; then setenv partitionset_active A; mmc partconf 0 1 1 0; env delete B; fi;saveenv; reset\n+set_bootargs_mmc=setenv bootargs ${bootargs} root=${mmc_active_vol} ro rootdelay=1\n+\trootwait rootfstype=ext4 ip=${ip_method}\n+set_bootargs_net=run set_bootargs;\n+\tif test ${kernel_name} = fitImage; then\n+\t\tsetenv loadaddr 0x88000000;\n+\tfi;\n+\tsetenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts}\n+\t\tip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off\n+set_bootargs=setenv bootargs console=${console},${baudrate} target_env=${target_env} ${testargs}\n+\t${optargs}\n+set_partition=mmc partconf 0 v_mmc_part_nr; setenv mmc_part_nr $v_mmc_part_nr;\n+\tsetenv mmc_active_vol ${rootfs_name}p$v_mmc_part_nr\n+tftp_run_script=tftpboot ${kernel_loadaddr} ${serverip}:${script_file};\n+\tif test $? -eq 0;then\n+\t\tsource ${kernel_loadaddr};\n+\tfi\n+toggle_partition=mmc partconf 0 v_mmc_part_nr;\n+\tif test $v_mmc_part_nr -eq 1;then\n+\t\tmmc partconf 0 1 2 0; setenv partitionset_active B;\n+\telif test $v_mmc_part_nr -eq 2;then\n+\t\tmmc partconf 0 1 1 0; setenv partitionset_active A;\n+\telse\n+\t\techo error mmc_part_nr $v_mmc_part_nr;\n+\tfi;\n+\tsaveenv;reset\n upgrade_available=0\n emmc_dev=0\n sd_dev=1\n mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused\n kboot=booti\n-bootcmd_mfg=run mfgtool_args; if iminfo ${initrd_addr}; then if test ${tee} = yes; then bootm ${tee_addr} ${initrd_addr} ${fdt_addr}; else booti ${loadaddr} ${initrd_addr} ${fdt_addr}; fi; else echo \"Run fastboot ...\"; fastboot usb auto; fi;\n+bootcmd_mfg=run mfgtool_args;\n+\tif iminfo ${initrd_addr}; then\n+\t\tif test ${tee} = yes; then\n+\t\t\tbootm ${tee_addr} ${initrd_addr} ${fdt_addr};\n+\t\telse\n+\t\t\tbooti ${loadaddr} ${initrd_addr} ${fdt_addr};\n+\t\tfi;\n+\telse\n+\t\techo \"Run fastboot ...\"; fastboot usb auto;\n+\tfi;\n fastboot_bytes=124c00\n fastboot_dev=mmc\n",
    "prefixes": [
        "v3",
        "10/11"
    ]
}