From: Tom Rini Date: Mon, 26 Feb 2018 09:27:11 -0500 Subject: [U-Boot] [PATCH v1 3/5] bootcount: u-boot: Do not increment bootcount if already done in SPL In-Reply-To: <20180226122246.10595-4-lukma@denx.de> References: <20180226122246.10595-1-lukma@denx.de> <20180226122246.10595-4-lukma@denx.de> Message-ID: <20180226142711.GM4311@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Feb 26, 2018 at 01:22:44PM +0100, Lukasz Majewski wrote: > If the CONFIG_SPL_BOOTCOUNT_LIMIT is defined, the bootcount variable is > already incremented after each boot attempt. > > For that reason we shall not increment it again in u-boot. > > Signed-off-by: Lukasz Majewski > --- > > common/autoboot.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/common/autoboot.c b/common/autoboot.c > index 2eef7a04cc..87fca2ea92 100644 > --- a/common/autoboot.c > +++ b/common/autoboot.c > @@ -298,7 +298,9 @@ const char *bootdelay_process(void) > > #ifdef CONFIG_BOOTCOUNT_LIMIT > bootcount = bootcount_load(); > +#ifndef CONFIG_SPL_BOOTCOUNT_LIMIT > bootcount++; > +#endif > bootcount_store(bootcount); > env_set_ulong("bootcount", bootcount); > bootlimit = env_get_ulong("bootlimit", 10, 0); Shouldn't we make the whole bit of code here depend on !CONFIG_SPL_BOOTCOUNT_LIMIT ? Or for that matter, re-work the first patch to instead be: bool SUPPORT_BOOTCOUNT "Support bootcount in some way" choice "Bootcount location" bool SPL_BOOTCOUNT_LIMIT "Count boots from POV of SPL" bool BOOTCOUNT_LIMIT "Count boots from POV of full U-Boot" endchoice ? Looking back at my old series from 2014 to do this, I just had a big warning saying you need to enable bootcount for SPL or for full U-Boot so you would never set BOOTCOUNT_LIMIT if doing SPL bootcount instead. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: