From mboxrd@z Thu Jan 1 00:00:00 1970 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 24DF4C77B78 for ; Wed, 26 Apr 2023 13:27:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B8CCF8636D; Wed, 26 Apr 2023 15:26:16 +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="TGLb+sIV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 86CAE8634B; Wed, 26 Apr 2023 15:26:03 +0200 (CEST) Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (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 B1B21862C5 for ; Wed, 26 Apr 2023 15:25:59 +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-x32c.google.com with SMTP id 46e09a7af769-6a6091ef0easo1591422a34.1 for ; Wed, 26 Apr 2023 06:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682515559; x=1685107559; 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=GsRe1bGRe0ShbykoyC1dJpM7gnZg4SLZ/uvH7Jj+E/g=; b=TGLb+sIVVegGwPMtMwWdKGN+kboFMS/8PbyAGBCrW7itSXnDPcJwf+d1bNK32a31Yk S5SeAxd/LkAblAZ0tPWG3C1Llz4UABVixKV2hUTc2OujFjxrCbhDkToLISUssNyUa+hm C3HcC+gN4cHD8oNlscWdCg+JLRdP7Z8zPBOdhSzrt/o9UWUTSaL1eCwX7SRkYtyBYgzs U8MUuMxZAysAOAG4pEm3lvOFG7Kx1W7M7ZpxlkN6IUCt5VE7zrn9VyME1nUcG5iNv91t TKbvar+0DLA1HCpBmo9aI3j5jQ/wDi6ClfFiGeSU68h3yzsuCJ8WaleENGLAUshPm8oJ vKlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682515559; x=1685107559; 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=GsRe1bGRe0ShbykoyC1dJpM7gnZg4SLZ/uvH7Jj+E/g=; b=Z50kWzEJpUcz6iMMOX9lr92/XKfuvQfZh63l/0qanODdOC/9pT8qH3NT9EtoYOPnVs AQnFn7mu29djANS3l+oWdRSVS0tI0JnsiwxjruemKN4Q3exuFEfNr/2PP0doALG+n3wD FrDrnephg0tNYQW9ArWVl97DgeXpLucGR+JaO+EPuBYYNMz3Ig/qsUOEWJ+jZeOFd+0O 5u/Dpdpi1u++EbXIitlsUscIREkGpDEsGHYPICzYGIC7lRfSGcBWbobZnIV3a/rrdGlg fHC+fzdTvo+krA21R2qZ08ccCM5HGfn3hxO3BqzcBmdbqpk1d8t90ETAf5Wwa/KvqiCy ezOQ== X-Gm-Message-State: AAQBX9eklFRZBdEy5NZwXAL3R7/bJ72cc4PnMwLtsE5mruTGw6mMRR9x V9CRqNqNKYiZ+W2eDCfkeaI= X-Google-Smtp-Source: AKy350bUaFhHEUuYYeiZ5YNli8/+jciFTM4Y7wK2nda/CjVRIRQpk9HhXYyFLLLePXrJdz61kS7oRg== X-Received: by 2002:a05:6830:2496:b0:6a5:d165:9566 with SMTP id u22-20020a056830249600b006a5d1659566mr11435131ots.0.1682515559206; Wed, 26 Apr 2023 06:25:59 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b69:f6e1:8741:de7a:38fc]) by smtp.gmail.com with ESMTPSA id h9-20020a056830164900b006a61bef7968sm6762384otr.53.2023.04.26.06.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 06:25:58 -0700 (PDT) From: Fabio Estevam To: sbabic@denx.de Cc: eduard@lionizers.com, u-boot@lists.denx.de, Fabio Estevam Subject: [PATCH v4 06/14] smegw01: Only commit to new partition if update was successful Date: Wed, 26 Apr 2023 10:25:25 -0300 Message-Id: <20230426132533.1145591-6-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230426132533.1145591-1-festevam@gmail.com> References: <20230426132533.1145591-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 v3: - 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