Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB409C77B78 for ; Wed, 26 Apr 2023 16:06:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 563E4863B2; Wed, 26 Apr 2023 18:05:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E4y1B3ts"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 59A7F863A5; Wed, 26 Apr 2023 18:05:27 +0200 (CEST) Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B3F0F86375 for ; Wed, 26 Apr 2023 18:05:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=festevam@gmail.com Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6a5dd5543cdso1188882a34.0 for ; Wed, 26 Apr 2023 09:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682525123; x=1685117123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vM2dFeBooXZY+7Pji2zYjFML3gzBVUpU2S/OubZN4vw=; b=E4y1B3tsd9QFa6XYiJ+cN6ZONBXSgAjLgFn/vX9TrmMJfIHR7Ns33irYxlMjYBgBhp PPpDEa4poaXP2zoQIdAsZOokWMj5s2PiS3H7Gh5/JRmcREix/dIsYi1dLgdQFlzfgMcf GX6kFHjYFO7qNv35jzUywsd5W1w7sHhcULQKLbDJqMVsycIhGJIHIdlA3UU/tXhmTXD/ PLB20fuowlYENvqmSeTdgY62344sBKaw0Ok/V0dsqQIRCiYYN6e4/fgtn7msNtI9UYsf EYEhpBDFQA0ZbfHlM3qBiItLnT6S4Q4slVB73XcmeXhr+T3NMRwFNivdLEa0y4nGeFFf mNVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682525123; x=1685117123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vM2dFeBooXZY+7Pji2zYjFML3gzBVUpU2S/OubZN4vw=; b=UjHDcXY2lmEreOuObPDWQhpnJrDXcS2laGbK8JH9bG9xqwi7kg3CLPhqlaZc6NmWq6 D/blXooK+/A9tTIQBmZCZ4j0+eoEkXuJGaPBdHff5LVw6UDDs3kb0xXQMyCJL8lJgcGB y70s75WwdCmJgvl0IeSbsBlj3jpJUpye+1UZgtzBBRd5SfT3CypDlmAi5guN/pgzu4wf MDki84rPf9oSUI/FKCh3fk/D4Z7QP5O6ZYldeJEiRmk/zhlnxJiGLhqP+QYGhaF5Je4Z v1o6iHhPSkGkyFTiMUNrUURoqVz4V+XRp+nn+2kuHXsc4ZtwKLw/hZPddmlWFssVefUN Z+LQ== X-Gm-Message-State: AAQBX9d/4ExkzNJrN+UBjCC+7kr1UqSYdf3FA3PuAF6Cx+a+K+JHwdHi 0AoUmtzi0nWO1PrNU/6o+4w= X-Google-Smtp-Source: AKy350bQ/CqlvKDKhrypi7P6iHRJJbFiCfyN44bLzo6G51+VFz9nSdPQfjrjoAd1xCJC7PQWVFD/6A== X-Received: by 2002:a05:6870:2409:b0:171:a749:bc0c with SMTP id n9-20020a056870240900b00171a749bc0cmr4001411oap.3.1682525123247; Wed, 26 Apr 2023 09:05:23 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b69:f6e1:8741:de7a:38fc]) by smtp.gmail.com with ESMTPSA id u2-20020a05687036c200b00177c314a358sm6755325oak.22.2023.04.26.09.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 09:05:22 -0700 (PDT) From: Fabio Estevam To: sbabic@denx.de Cc: eduard@lionizers.com, u-boot@lists.denx.de, Fabio Estevam Subject: [PATCH v5 06/14] smegw01: Only commit to new partition if update was successful Date: Wed, 26 Apr 2023 13:04:53 -0300 Message-Id: <20230426160501.1199085-6-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230426160501.1199085-1-festevam@gmail.com> References: <20230426160501.1199085-1-festevam@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Eduard Strehlau When performing rootfs update via swupdate, it is convenient to check the 'ustate' variable to decide whether the update succeeded or not. Signed-off-by: Eduard Strehlau Signed-off-by: Fabio Estevam --- Changes since v4: - None include/configs/smegw01.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/configs/smegw01.h b/include/configs/smegw01.h index 05edaac42f8e..277c828d0e07 100644 --- a/include/configs/smegw01.h +++ b/include/configs/smegw01.h @@ -30,13 +30,19 @@ "bootm_size=0x10000000\0" \ "mmcdev=0\0" \ "mmcpart=1\0" \ + "mmcpart_committed=1\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/mmcblk0p${mmcpart} rootwait rw " \ + "root=/dev/mmcblk0p${mmcpart_committed} rootwait rw " \ __stringify(EXTRA_BOOTPARAMS) "\0" \ + "commit_mmc=if test \"${ustate}\" = 1 -a \"${mmcpart}\" != \"${mmcpart_committed}\"; then " \ + "setenv mmcpart_committed ${mmcpart};" \ + "saveenv;" \ + "fi;\0" \ "bootlimit=3\0" \ - "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/${image}\0" \ - "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} boot/${fdtfile}\0" \ + "loadimage=load mmc ${mmcdev}:${mmcpart_committed} ${loadaddr} boot/${image}\0" \ + "loadfdt=load mmc ${mmcdev}:${mmcpart_committed} ${fdt_addr} boot/${fdtfile}\0" \ "mmcboot=echo Booting from mmc ...; " \ + "run commit_mmc; " \ "run mmcargs; " \ "if run loadfdt; then " \ "if bootz ${loadaddr} - ${fdt_addr}; then " \ @@ -48,10 +54,12 @@ "run altbootcmd; " \ "fi;\0" \ "altbootcmd=echo Performing rollback...; " \ - "if test \"${mmcpart}\" = 1; then " \ + "if test \"${mmcpart_committed}\" = 1; then " \ "setenv mmcpart 2; " \ + "setenv mmcpart_committed 2;" \ "else " \ "setenv mmcpart 1; " \ + "setenv mmcpart_committed 1;" \ "fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; " \ "run bootcmd;\0" -- 2.34.1