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 80F81C6FD18 for ; Tue, 18 Apr 2023 13:48:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA11C8608F; Tue, 18 Apr 2023 15:48:08 +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="qoWqdagl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D32A98608C; Tue, 18 Apr 2023 15:48:02 +0200 (CEST) Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) (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 7B8C886076 for ; Tue, 18 Apr 2023 15:47: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-x332.google.com with SMTP id 46e09a7af769-6a4124c8328so901992a34.1 for ; Tue, 18 Apr 2023 06:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681825678; x=1684417678; 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=3Ay/lY+6Ktc2hsiQ0EL0s3z5/fitE6Rj1lqnLozJ5Ms=; b=qoWqdaglkXpPDahqiWCir3hbr8xOGNjmdtSaoq2cVl8IWnml42R/s8s7VV7w5DcS/D MQkUh6yHXFu4bD948MJQNhpKlAupDbcjTx/eVoeg31nOjLJwjx+IiVheHOlqlSnLBaSm YZIRHzwI5W7H5L5YCKRjNQnkK4bYP+i8HjMo8dGvScgWuPuEO6Znne9Q11lFE9rHs4eD ejctw7jKMIi0z64q4fDJCiqCFAyz2+TEpUgE2nz7LDRjYs+iiCnAWaI+PZgu6pDnZsZJ LCIVgBp4cxIe4J1Ez0RG1xRQ+xgG1BkI1rZzqpHFg+0z/ZtCb+gAgmGDATphJpAoFIx6 peXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681825678; x=1684417678; 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=3Ay/lY+6Ktc2hsiQ0EL0s3z5/fitE6Rj1lqnLozJ5Ms=; b=jCO/dq+17pqXv572ympa3jpfxdy7F4S1ksS+a/aAH9edA5T1/tuIUusuUgpibS8K+d MXt+TAERD3k9qTsbt2szsgRQpeFok2fqpiN+BCLB0AbtJlcOlsBL0Zohn4lpdZqEGjcR zxdXADo4IGHqQJshLWMHhzIN7mv5mOoysQVjWR1upT2qoQkTXDUNVU1S39D6+Myq5yW3 IhJjqXf9fIp+pnZdC0nRdGoD7nEmaQQNRq+vZq6u/rAfvG57/yCRBkAcVXZywero0Evb Ew+Kgqz4DXS3Q3P0iwzpF7nXb5VKc9b6PRpo084M1hG456CTc0iQcFDUw9YQTZZ+eiDH Xmfw== X-Gm-Message-State: AAQBX9eL5YzrDuIh910QpxjFm/rChXYZpYsJwCyRc8FqSyEitQL9zceY PxzTcDBJIuQZQLQfrAMfcdQ= X-Google-Smtp-Source: AKy350ZhpuuTpl0kT9D8SGsiB8NP7djFqs/OWisRoE+9IzHoGgk8mGvV2ni8lniKBPFxdFTsdgTeMA== X-Received: by 2002:a05:6871:29e:b0:187:7a49:d227 with SMTP id i30-20020a056871029e00b001877a49d227mr9211480oae.5.1681825678021; Tue, 18 Apr 2023 06:47:58 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b69:df3a:5c40:f24a:e8cc]) by smtp.gmail.com with ESMTPSA id 1-20020a4a1a01000000b0054157801d51sm5823246oof.38.2023.04.18.06.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 06:47:57 -0700 (PDT) From: Fabio Estevam To: sbabic@denx.de Cc: u-boot@lists.denx.de, eduard@lionizers.com, Fabio Estevam Subject: [PATCH 04/13] smegw01: Add altbootcmd Date: Tue, 18 Apr 2023 10:47:35 -0300 Message-Id: <20230418134744.343023-4-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418134744.343023-1-festevam@gmail.com> References: <20230418134744.343023-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 Add an altbootcmd script, which is convenient way to integrate with swupdate and perform a roll back of the previous working version in the case of update failure. Signed-off-by: Eduard Strehlau Signed-off-by: Fabio Estevam --- configs/smegw01_defconfig | 2 +- include/configs/smegw01.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/smegw01_defconfig b/configs/smegw01_defconfig index 5d9d419463..418151a6de 100644 --- a/configs/smegw01_defconfig +++ b/configs/smegw01_defconfig @@ -18,7 +18,7 @@ CONFIG_SYS_MEMTEST_END=0xa0000000 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="if run loadimage; then run mmcboot; fi; " +CONFIG_BOOTCOMMAND="if test \"${ustate}\" = 1; then setenv upgrade_available 1; saveenv; fi; if run loadimage; then run mmcboot; fi; " CONFIG_HUSH_PARSER=y CONFIG_SYS_MAXARGS=32 CONFIG_SYS_PBSIZE=532 diff --git a/include/configs/smegw01.h b/include/configs/smegw01.h index a356f095a6..6ee4acc70d 100644 --- a/include/configs/smegw01.h +++ b/include/configs/smegw01.h @@ -33,6 +33,7 @@ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=/dev/mmcblk0p${mmcpart} rootwait rw " \ __stringify(EXTRA_BOOTPARAMS) "\0" \ + "bootlimit=3\0" \ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/${image}\0" \ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} boot/${fdtfile}\0" \ "mmcboot=echo Booting from mmc ...; " \ @@ -40,6 +41,13 @@ "if run loadfdt; then " \ "bootz ${loadaddr} - ${fdt_addr}; " \ "fi;\0" \ + "altbootcmd=echo Performing rollback...; " \ + "if test \"${mmcpart}\" = 1; then " \ + "setenv mmcpart 2; " \ + "else " \ + "setenv mmcpart 1; " \ + "fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; " \ + "run bootcmd;\0" /* Physical Memory Map */ #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR -- 2.38.1