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 206A0C433EF for ; Wed, 2 Mar 2022 15:56:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 342DE837E2; Wed, 2 Mar 2022 16:56:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.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=bootlin.com header.i=@bootlin.com header.b="kk5OvacI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E9A0B83C90; Wed, 2 Mar 2022 16:56:15 +0100 (CET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3F9D281DDF for ; Wed, 2 Mar 2022 16:56:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael.opdenacker@bootlin.com Received: (Authenticated sender: michael.opdenacker@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id CE3E31C0007; Wed, 2 Mar 2022 15:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1646236568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=TRtAWe0SPEz6atX3FV2bF1nXbthCcH/IGj9nW1YJt6Q=; b=kk5OvacIpqRG1e0hOsFU4i5C1mGvnf08M7RFcoYDIw4r+K5IyYiRZ6B2ulqKI3drjalmrO 1L/BY9+JX30R+i/w5ZEb3R0Tu2HylRCT2CSEafpYqsSi85CFczlx9uhlBNA9winOhCTEUT Fwh7+UxO/gl4Ufo8y4dDzqCGo1XOTTcFnwxYjzsPilSPu2c9IEN1ESeBbbo+bqjVSvPAd5 8/LpF/qEnme4STJDWo9Z7iFvmn6MfARtNBhpP+MnQEcd30nYPvhC758YFsZR3pu03DuBg9 3cZ+AOZvf1/Lq0Uo0p5MJviTDLgLagp3mwH45JPtWHUeXWBvhtmPCED9JSUM7A== From: Michael Opdenacker To: u-boot@lists.denx.de Cc: lokeshvutla@ti.com, Gireesh.Hiremath@in.bosch.com, nandor.han@vaisala.com, sjg@chromium.org, michael.opdenacker@bootlin.com Subject: [PATCH] bootcount: clarify documentation Date: Wed, 2 Mar 2022 16:56:02 +0100 Message-Id: <20220302155602.326642-1-michael.opdenacker@bootlin.com> X-Mailer: git-send-email 2.25.1 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.5 at phobos.denx.de X-Virus-Status: Clean - Grammar fixes - Clarify explanations Signed-off-by: Michael Opdenacker --- doc/README.bootcount | 34 ++++++++++++++++++---------------- drivers/bootcount/Kconfig | 10 +++++----- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/doc/README.bootcount b/doc/README.bootcount index b1c22905c6..f6c5f82f98 100644 --- a/doc/README.bootcount +++ b/doc/README.bootcount @@ -3,14 +3,16 @@ Boot Count Limit ================ +This is enabled by CONFIG_BOOTCOUNT_LIMIT. + This allows to detect multiple failed attempts to boot Linux. -After a power-on reset, "bootcount" variable will be initialized with 1, and +After a power-on reset, the "bootcount" variable will be initialized to 1, and each reboot will increment the value by 1. If, after a reboot, the new value of "bootcount" exceeds the value of "bootlimit", then instead of the standard boot action (executing the contents of -"bootcmd") an alternate boot action will be performed, and the contents of +"bootcmd"), an alternate boot action will be performed, and the contents of "altbootcmd" will be executed. If the variable "bootlimit" is not defined in the environment, the Boot Count @@ -18,18 +20,18 @@ Limit feature is disabled. If it is enabled, but "altbootcmd" is not defined, then U-Boot will drop into interactive mode and remain there. It is the responsibility of some application code (typically a Linux -application) to reset the variable "bootcount", thus allowing for more boot -cycles. +application) to reset the variable "bootcount" to 0 when the system booted +successfully, thus allowing for more boot cycles. -BOOTCOUNT_EXT -------------- +CONFIG_BOOTCOUNT_EXT +-------------------- This adds support for maintaining boot count in a file on an EXT filesystem. -The file to use is define by: +The file to use is defined by: -SYS_BOOTCOUNT_EXT_INTERFACE -SYS_BOOTCOUNT_EXT_DEVPART -SYS_BOOTCOUNT_EXT_NAME +CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE +CONFIG_SYS_BOOTCOUNT_EXT_DEVPART +CONFIG_SYS_BOOTCOUNT_EXT_NAME The format of the file is: @@ -42,10 +44,10 @@ u8 bootcount u8 upgrade_available ==== ================= -To prevent unattended usage of "altbootcmd" the "upgrade_available" variable is +To prevent unattended usage of "altbootcmd", the "upgrade_available" variable is used. -If "upgrade_available" is 0, "bootcount" is not saved, if "upgrade_available" is -1 "bootcount" is save. -So the Userspace Application must set the "upgrade_available" and "bootcount" -variables to 0, if a boot was successfully. -This also prevents writes on all reboots. +If "upgrade_available" is 0, "bootcount" is not saved. +If "upgrade_available" is 1, "bootcount" is saved. +So a userspace application should take care of setting the "upgrade_available" +and "bootcount" variables to 0, if the system boots successfully. +This also avoids writing the "bootcount" information on all reboots. diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig index 607027c968..65c052fc2e 100644 --- a/drivers/bootcount/Kconfig +++ b/drivers/bootcount/Kconfig @@ -68,15 +68,15 @@ config BOOTCOUNT_ENV "bootcount" is stored in the environment. To prevent a saveenv on all reboots, the environment variable "upgrade_available" is used. If "upgrade_available" is - 0, "bootcount" is always 0, if "upgrade_available" is - 1 "bootcount" is incremented in the environment. + 0, "bootcount" is always 0. If "upgrade_available" is 1, + "bootcount" is incremented in the environment. So the Userspace Application must set the "upgrade_available" - and "bootcount" variable to 0, if a boot was successfully. + and "bootcount" variables to 0, if the system booted successfully. config BOOTCOUNT_RAM bool "Boot counter in RAM" help - Store the bootcount in DRAM protected against against bit errors + Store the bootcount in DRAM protected against bit errors due to short power loss or holding a system in RESET. config BOOTCOUNT_I2C @@ -166,7 +166,7 @@ config BOOTCOUNT_BOOTLIMIT help Set the Maximum number of reboot cycles allowed without the boot counter being cleared. - If set to 0 do not set a boot limit in the environment. + If set to 0, do not set a boot limit in the environment. config BOOTCOUNT_ALEN int "I2C address length" -- 2.25.1