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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F465C48BDF for ; Tue, 15 Jun 2021 08:07:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 78EE1611BE for ; Tue, 15 Jun 2021 08:07:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78EE1611BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1215D81249; Tue, 15 Jun 2021 10:07:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1623744475; bh=uIfPAejhVXTLqJZ1p54CjsHKGFmbiTL/AtBDLfibC1Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QH2EwP2dcCpsn6erDO54bmXEYKGvUk1/cWBTLzRfJ507Ma36PnKBbZxmrIOMKvexv PUogr0uRz3kcbaTmtm0N99f1TR5oSCQQ7wU2Rqhu9wwioUb8mz9oeOeGPHmHy3Qmq0 6uAS8bV9AJlVIWi/97cWxwTBIc23k8qe9SopnI+dj+C8QgnZygYYor38T7oBrYrgFT gjGW+GotGqwlx6a8P71Hoti9G6bHH6plL2cNtsBEHL9XXBdojPoZIS9iKWxy+gJytA rZeUROx2I95FCN3rJjOeBPTXsT0nfCsK+lgmLAGSZjw+JGOKT1HQWr0IXLSmwQEXkk sRKvipU0tgRhA== Received: by phobos.denx.de (Postfix, from userid 109) id 7107281D48; Tue, 15 Jun 2021 10:07:53 +0200 (CEST) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [IPv6:2001:67c:2050:1::465:204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8FBE680082 for ; Tue, 15 Jun 2021 10:07:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4G41CB2MmDzQjpg; Tue, 15 Jun 2021 10:07:50 +0200 (CEST) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id x87Q00RUdkCx; Tue, 15 Jun 2021 10:07:47 +0200 (CEST) Subject: Re: [PATCH u-boot-marvell] arm: mvebu: turris_{omnia,mox}: ensure running bootcmd_rescue always works To: =?UTF-8?Q?Marek_Beh=c3=ban?= , u-boot@lists.denx.de Cc: =?UTF-8?Q?Pali_Roh=c3=a1r?= References: <20210614144558.12606-1-marek.behun@nic.cz> From: Stefan Roese Message-ID: <6c41eb6c-27aa-5e0c-45e1-afdfbc73c5aa@denx.de> Date: Tue, 15 Jun 2021 10:07:46 +0200 MIME-Version: 1.0 In-Reply-To: <20210614144558.12606-1-marek.behun@nic.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 8bit X-MBO-SPAM-Probability: X-Rspamd-Score: -6.87 / 15.00 / 15.00 X-Rspamd-Queue-Id: 4C71718A1 X-Rspamd-UID: d9b48a X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On 14.06.21 16:45, Marek Behún wrote: > From: Pali Rohár > > One of the points of putting the rescue boot command into default > environment is that user can invoke it without physical access to the > board (without having to press the factory reset button), by running > run bootcmd_rescue > in U-Boot's console. > > Therefore we have to ensure that bootcmd_rescue is always set to default > value, regardless of whether the factory reset button was pressed. > Otherwise the variable will be empty for example after upgrade from > previous U-Boot. > > Fixes: ec3784d62646 ("arm: mvebu: turris_mox: add support for board rescue mode") > Fixes: 176c3e7760a2 ("arm: mvebu: turris_omnia: support invoking rescue boot from console") > Signed-off-by: Pali Rohár > Signed-off-by: Marek Behún Applied to u-boot-marvell/master Thanks, Stefan > --- > board/CZ.NIC/turris_mox/turris_mox.c | 14 +++++++++++--- > board/CZ.NIC/turris_omnia/turris_omnia.c | 13 ++++++++++--- > 2 files changed, 21 insertions(+), 6 deletions(-) > > diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c > index 44c272c7cb..428cd23a19 100644 > --- a/board/CZ.NIC/turris_mox/turris_mox.c > +++ b/board/CZ.NIC/turris_mox/turris_mox.c > @@ -440,10 +440,18 @@ static bool read_reset_button(void) > > static void handle_reset_button(void) > { > + const char * const vars[1] = { "bootcmd_rescue", }; > + > + /* > + * Ensure that bootcmd_rescue has always stock value, so that running > + * run bootcmd_rescue > + * always works correctly. > + */ > + env_set_default_vars(1, (char * const *)vars, 0); > + > if (read_reset_button()) { > - const char * const vars[3] = { > + const char * const vars[2] = { > "bootcmd", > - "bootcmd_rescue", > "distro_bootcmd", > }; > > @@ -451,7 +459,7 @@ static void handle_reset_button(void) > * Set the above envs to their default values, in case the user > * managed to break them. > */ > - env_set_default_vars(3, (char * const *)vars, 0); > + env_set_default_vars(2, (char * const *)vars, 0); > > /* Ensure bootcmd_rescue is used by distroboot */ > env_set("boot_targets", "rescue"); > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index ade923f599..8b2f94f959 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -339,9 +339,17 @@ static int set_regdomain(void) > > static void handle_reset_button(void) > { > + const char * const vars[1] = { "bootcmd_rescue", }; > int ret; > u8 reset_status; > > + /* > + * Ensure that bootcmd_rescue has always stock value, so that running > + * run bootcmd_rescue > + * always works correctly. > + */ > + env_set_default_vars(1, (char * const *)vars, 0); > + > ret = omnia_mcu_read(CMD_GET_RESET, &reset_status, 1); > if (ret) { > printf("omnia_mcu_read failed: %i, reset status unknown!\n", > @@ -352,9 +360,8 @@ static void handle_reset_button(void) > env_set_ulong("omnia_reset", reset_status); > > if (reset_status) { > - const char * const vars[3] = { > + const char * const vars[2] = { > "bootcmd", > - "bootcmd_rescue", > "distro_bootcmd", > }; > > @@ -362,7 +369,7 @@ static void handle_reset_button(void) > * Set the above envs to their default values, in case the user > * managed to break them. > */ > - env_set_default_vars(3, (char * const *)vars, 0); > + env_set_default_vars(2, (char * const *)vars, 0); > > /* Ensure bootcmd_rescue is used by distroboot */ > env_set("boot_targets", "rescue"); > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de