From patchwork Fri Jun 28 17:35:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasileios Amoiridis X-Patchwork-Id: 1954193 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=lTTxkNWN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9vQb6mJRz20Xg for ; Sat, 29 Jun 2024 11:11:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5829B885BF; Sat, 29 Jun 2024 03:11:22 +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="lTTxkNWN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9126D885A8; Fri, 28 Jun 2024 19:35:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) (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 16AEA88570 for ; Fri, 28 Jun 2024 19:35:48 +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=vassilisamir@gmail.com Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a7241b2fe79so99482566b.1 for ; Fri, 28 Jun 2024 10:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719596147; x=1720200947; darn=lists.denx.de; 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=X6+DDq5TOd3SFmSfA7iMyjEZ/u01+t14H7M8U0wGnKA=; b=lTTxkNWNlR2iayjgHplJsR/6Dwmp1wU/BDjlxfO2jEacnhl09zfz4Qa8KpbYw6IXZp yMNEkG8q6SfPKu+HYTmL7FyV5YdEGLcOeCd6cYsNRgKXd1/ILaK3UVsixP8YzoBrPe5f VWrLiUigWo5ic/N/cTvOCiYtKcbtut1tCiWTvV/Z+LWE6Y+0b2pQcnUCEQEmc/1FM99v U+QRHBUPFl4REJ06y2MbKEtQ8ulliWOoIURq2eUFbFgDHKfQu6w8wd1RCPFUEl17iK5a Uzj77Ojq1aomyw5zH0Ut996WaBzcnH3yn/2R3iT7tg/ha74yFRm7dequ+LS6QDVd+BUA vj4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719596147; x=1720200947; 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=X6+DDq5TOd3SFmSfA7iMyjEZ/u01+t14H7M8U0wGnKA=; b=qrJw54mfZm9KVqxn/W/xncEnhzdQ43QIWJ1f/uBcBNKda2IdMQmUKv+bAjrglHIIqb B19qIviwZSgg2kXww+EoHGOvDNDxCkwzT5Vx70TCiQclC3N6c5/9ZaETsAcWcPAGELSY kD8jkj472hkXH+UbzLROtlu/UQcLM4ydHEEzJoDw3T1K0SzuT4LRHgJJukIUnXJ08D+5 H9+cUjmDB9XXPIA/PCpo+aFB8g6cqAS/Uq9HWkKYOHPf83GiB+6vc4gMi5tLFpW5LcB2 HhFqNvz+jQjSG9qaaeyDMmP5i1FfquMfnPxLOs67cJ+SgauVRBeYaEjn0NL7nr0aWfwG Qlmg== X-Forwarded-Encrypted: i=1; AJvYcCW9BTJ0tB0MB+/Rj69nbDaP/8KQiP1VyOY962l2DP38evlIZoIvfvZuftGr5z+AnZf2RXVv8TJagKe8VD2g6hECgw98WQ== X-Gm-Message-State: AOJu0YzzEs3BMC9/WJkBLlzSM+8MdpipZicantZNIap/Lh6TZIdXBsNM kBwd5v4I2ugxJqgE8wdF9qquFYxTChG8ntoP+MCcGCl40rWC+EK7 X-Google-Smtp-Source: AGHT+IHCDnKm9PibO0rhkfQQjcCXGFgQaLXayYpT4f/voc3cengG0amfCk17G1kTRDvxL6rMk9smNg== X-Received: by 2002:a17:907:160f:b0:a72:8a75:6559 with SMTP id a640c23a62f3a-a728a7566afmr779480766b.47.1719596147207; Fri, 28 Jun 2024 10:35:47 -0700 (PDT) Received: from localhost.localdomain ([2a04:ee41:82:7577:b996:e85b:4fbf:5c89]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aafb9e4csm96214666b.95.2024.06.28.10.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:35:46 -0700 (PDT) From: Vasileios Amoiridis To: trini@konsulko.com, hs@denx.de, pro@denx.de Cc: vassilisamir@gmail.com, quentin.schulz@cherry.de, u-boot@lists.denx.de, Vasileios Amoiridis Subject: [PATCH v4 1/3] drivers: bootcount: Add support for ANY filesystem Date: Fri, 28 Jun 2024 19:35:41 +0200 Message-Id: <20240628173543.129207-2-vassilisamir@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628173543.129207-1-vassilisamir@gmail.com> References: <20240628173543.129207-1-vassilisamir@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 29 Jun 2024 03:11:20 +0200 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 Add support to save boot count variable in ANY filesystem. Tested with FAT and EXT. Reviewed-by: Tom Rini Reviewed-by: Heiko Schocher Reviewed-by: Philip Oberfichtner Signed-off-by: Vasileios Amoiridis --- doc/README.bootcount | 12 +++---- drivers/bootcount/Kconfig | 36 +++++++++---------- drivers/bootcount/Makefile | 2 +- .../{bootcount_ext.c => bootcount_fs.c} | 12 +++---- 4 files changed, 31 insertions(+), 31 deletions(-) rename drivers/bootcount/{bootcount_ext.c => bootcount_fs.c} (81%) diff --git a/doc/README.bootcount b/doc/README.bootcount index f6c5f82f98..0f4ffb6828 100644 --- a/doc/README.bootcount +++ b/doc/README.bootcount @@ -23,15 +23,15 @@ It is the responsibility of some application code (typically a Linux application) to reset the variable "bootcount" to 0 when the system booted successfully, thus allowing for more boot cycles. -CONFIG_BOOTCOUNT_EXT +CONFIG_BOOTCOUNT_FS -------------------- -This adds support for maintaining boot count in a file on an EXT filesystem. -The file to use is defined by: +This adds support for maintaining boot count in a file on a filesystem. +Supported filesystems are FAT and EXT. The file to use is defined by: -CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE -CONFIG_SYS_BOOTCOUNT_EXT_DEVPART -CONFIG_SYS_BOOTCOUNT_EXT_NAME +CONFIG_SYS_BOOTCOUNT_FS_INTERFACE +CONFIG_SYS_BOOTCOUNT_FS_DEVPART +CONFIG_SYS_BOOTCOUNT_FS_NAME The format of the file is: diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig index 3c56253b1e..fbf3c56b41 100644 --- a/drivers/bootcount/Kconfig +++ b/drivers/bootcount/Kconfig @@ -25,13 +25,13 @@ config BOOTCOUNT_GENERIC Set to the address where the bootcount and bootcount magic will be stored. -config BOOTCOUNT_EXT - bool "Boot counter on EXT filesystem" - depends on FS_EXT4 - select EXT4_WRITE +config BOOTCOUNT_FS + bool "Boot counter on a filesystem" help - Add support for maintaining boot count in a file on an EXT - filesystem. + Add support for maintaining boot count in a file on a filesystem. + This requires that you have enabled write support for the filesystem + that you will be used by the partition that you configure this feature + for. config BOOTCOUNT_AM33XX bool "Boot counter in AM33XX RTC IP block" @@ -184,26 +184,26 @@ config SYS_BOOTCOUNT_SINGLEWORD This option enables packing boot count magic value and boot count into single word (32 bits). -config SYS_BOOTCOUNT_EXT_INTERFACE - string "Interface on which to find boot counter EXT filesystem" +config SYS_BOOTCOUNT_FS_INTERFACE + string "Interface on which to find boot counter filesystem" default "mmc" - depends on BOOTCOUNT_EXT + depends on BOOTCOUNT_FS help Set the interface to use when locating the filesystem to use for the boot counter. -config SYS_BOOTCOUNT_EXT_DEVPART - string "Partition of the boot counter EXT filesystem" +config SYS_BOOTCOUNT_FS_DEVPART + string "Partition of the boot counter filesystem" default "0:1" - depends on BOOTCOUNT_EXT + depends on BOOTCOUNT_FS help Set the partition to use when locating the filesystem to use for the boot counter. -config SYS_BOOTCOUNT_EXT_NAME - string "Path and filename of the EXT filesystem based boot counter" +config SYS_BOOTCOUNT_FS_NAME + string "Path and filename of the FS filesystem based boot counter" default "/boot/failures" - depends on BOOTCOUNT_EXT + depends on BOOTCOUNT_FS help Set the filename and path of the file used to store the boot counter. @@ -211,18 +211,18 @@ config SYS_BOOTCOUNT_ADDR hex "RAM address used for reading and writing the boot counter" default 0x44E3E000 if BOOTCOUNT_AM33XX || BOOTCOUNT_AM33XX_NVMEM default 0xE0115FF8 if ARCH_LS1043A || ARCH_LS1021A - depends on BOOTCOUNT_AM33XX || BOOTCOUNT_GENERIC || BOOTCOUNT_EXT || \ + depends on BOOTCOUNT_AM33XX || BOOTCOUNT_GENERIC || BOOTCOUNT_FS || \ BOOTCOUNT_AM33XX_NVMEM help Set the address used for reading and writing the boot counter. config SYS_BOOTCOUNT_MAGIC hex "Magic value for the boot counter" - default 0xB001C041 if BOOTCOUNT_GENERIC || BOOTCOUNT_EXT || \ + default 0xB001C041 if BOOTCOUNT_GENERIC || BOOTCOUNT_FS || \ BOOTCOUNT_AM33XX || BOOTCOUNT_ENV || \ BOOTCOUNT_RAM || BOOTCOUNT_AT91 || DM_BOOTCOUNT default 0xB0 if BOOTCOUNT_AM33XX_NVMEM - depends on BOOTCOUNT_GENERIC || BOOTCOUNT_EXT || \ + depends on BOOTCOUNT_GENERIC || BOOTCOUNT_FS || \ BOOTCOUNT_AM33XX || BOOTCOUNT_ENV || \ BOOTCOUNT_RAM || BOOTCOUNT_AT91 || DM_BOOTCOUNT || \ BOOTCOUNT_AM33XX_NVMEM diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile index e7771f5b36..245f879633 100644 --- a/drivers/bootcount/Makefile +++ b/drivers/bootcount/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_BOOTCOUNT_AT91) += bootcount_at91.o obj-$(CONFIG_BOOTCOUNT_AM33XX) += bootcount_davinci.o obj-$(CONFIG_BOOTCOUNT_RAM) += bootcount_ram.o obj-$(CONFIG_BOOTCOUNT_ENV) += bootcount_env.o -obj-$(CONFIG_BOOTCOUNT_EXT) += bootcount_ext.o +obj-$(CONFIG_BOOTCOUNT_FS) += bootcount_fs.o obj-$(CONFIG_BOOTCOUNT_AM33XX_NVMEM) += bootcount_nvmem.o obj-$(CONFIG_DM_BOOTCOUNT) += bootcount-uclass.o diff --git a/drivers/bootcount/bootcount_ext.c b/drivers/bootcount/bootcount_fs.c similarity index 81% rename from drivers/bootcount/bootcount_ext.c rename to drivers/bootcount/bootcount_fs.c index 9639e638e9..569592d8aa 100644 --- a/drivers/bootcount/bootcount_ext.c +++ b/drivers/bootcount/bootcount_fs.c @@ -25,8 +25,8 @@ void bootcount_store(ulong a) loff_t len; int ret; - if (fs_set_blk_dev(CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE, - CONFIG_SYS_BOOTCOUNT_EXT_DEVPART, FS_TYPE_EXT)) { + if (fs_set_blk_dev(CONFIG_SYS_BOOTCOUNT_FS_INTERFACE, + CONFIG_SYS_BOOTCOUNT_FS_DEVPART, FS_TYPE_ANY)) { puts("Error selecting device\n"); return; } @@ -42,7 +42,7 @@ void bootcount_store(ulong a) buf->upgrade_available = upgrade_available; unmap_sysmem(buf); - ret = fs_write(CONFIG_SYS_BOOTCOUNT_EXT_NAME, + ret = fs_write(CONFIG_SYS_BOOTCOUNT_FS_NAME, CONFIG_SYS_BOOTCOUNT_ADDR, 0, sizeof(bootcount_ext_t), &len); if (ret != 0) @@ -55,13 +55,13 @@ ulong bootcount_load(void) loff_t len_read; int ret; - if (fs_set_blk_dev(CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE, - CONFIG_SYS_BOOTCOUNT_EXT_DEVPART, FS_TYPE_EXT)) { + if (fs_set_blk_dev(CONFIG_SYS_BOOTCOUNT_FS_INTERFACE, + CONFIG_SYS_BOOTCOUNT_FS_DEVPART, FS_TYPE_ANY)) { puts("Error selecting device\n"); return 0; } - ret = fs_read(CONFIG_SYS_BOOTCOUNT_EXT_NAME, CONFIG_SYS_BOOTCOUNT_ADDR, + ret = fs_read(CONFIG_SYS_BOOTCOUNT_FS_NAME, CONFIG_SYS_BOOTCOUNT_ADDR, 0, sizeof(bootcount_ext_t), &len_read); if (ret != 0 || len_read != sizeof(bootcount_ext_t)) { puts("Error loading bootcount\n"); From patchwork Fri Jun 28 17:35:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasileios Amoiridis X-Patchwork-Id: 1954194 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Exq9HBtB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9vQp4D5Zz20Xg for ; Sat, 29 Jun 2024 11:11:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B45A5885CE; Sat, 29 Jun 2024 03:11:22 +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="Exq9HBtB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 978AC88581; Fri, 28 Jun 2024 19:35:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 704778859F for ; Fri, 28 Jun 2024 19:35:49 +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=vassilisamir@gmail.com Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a7252bfe773so101525866b.1 for ; Fri, 28 Jun 2024 10:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719596149; x=1720200949; darn=lists.denx.de; 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=K77ex8tsI5XTk7QXNQuTCYQM0QaztWhh8z12mcaMuEE=; b=Exq9HBtBuzpEVTR9kOLbsrxajX363JxyxLKsK7/i3pZ82g5EMcqAS7CtdUbxPgucq+ GAZtt/U6BqtLvrfq6c12NToQweYYf9y+4tWWDxfqe/BpExn573KmHCx4rOSqXUlyQ+HY MwyvIqKTp5z6d4IjH6ahvjTY1k2cN1bI+HpUbbKRJjZiLnpsG+e+focWrLc8zuMWL7DY s5r+eW4fOWmcT7JezbP3KAszzrGKciwWPThcbA7L9TMn8afkdoLPiM5yyCgeQiFdw78D TQgYznfgeXdtLYUlVPXjm8zV6wP07YzFo5HOaA6Q3T+J7iX6kv9R7fnf/YfEkW+0ZFWs HTAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719596149; x=1720200949; 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=K77ex8tsI5XTk7QXNQuTCYQM0QaztWhh8z12mcaMuEE=; b=FumWxkq1OmTrBLVHZi7Cr7m7y8i3aumDXtAn8fJV6mdStUxjdKjBVttS0QiIQUsTry iKX5KHTAPPvK+QYkONiKgdDltRU/6TjG3WK24M/QrhYFh9Ol5XKVvSYFasrdVpi7hoNd zlnSP9lka/szG+fR81PAzLy3V927/cAMlFpHFQnAPUHv6KwEEOJceAut/yj7GMlpS0C3 aVqI+W6OIWWptSP7JBIfL4v4j/N+PX0A2j0Y+9Tij/80K2XzCwLX9DbZUPCw6QIscbbe 5RPxaxyeX6kMR9DSeEVO4xJZRiJk7rrzOWrSSEOkU9wSoONedZn8v3D/kwKfPH7AKa35 wd/A== X-Forwarded-Encrypted: i=1; AJvYcCUExoQOgLCJvFMG+ToeSaJGdAG3Uye9YI3Cxf5IkpG5lbd8Sq44b7pyZO50ou2l69nYTCK+TOci08VAcdW7URfhP3AYeA== X-Gm-Message-State: AOJu0Yy34n6GvsHakmiUAa6P3Wu7F5hPcZ/eP9Jl3G9kw3vtoiQet/6J 7xjjqNMk8sDeRJzsS8+5Tl1BPtjnnBQZ2kD3LoYQZbjCuofSD1xS1pSP5CCxbLw= X-Google-Smtp-Source: AGHT+IGjA1myRaIzNbrRBWzxo0YvW8l2wDLoI0C5xTcvuUTRGsLXnva8p/OeK2ckp+BcItRDxobx2w== X-Received: by 2002:a17:907:1c22:b0:a72:9d25:8ad3 with SMTP id a640c23a62f3a-a729d258ff1mr479198066b.9.1719596148642; Fri, 28 Jun 2024 10:35:48 -0700 (PDT) Received: from localhost.localdomain ([2a04:ee41:82:7577:b996:e85b:4fbf:5c89]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aafb9e4csm96214666b.95.2024.06.28.10.35.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:35:47 -0700 (PDT) From: Vasileios Amoiridis To: trini@konsulko.com, hs@denx.de, pro@denx.de Cc: vassilisamir@gmail.com, quentin.schulz@cherry.de, u-boot@lists.denx.de, Vasileios Amoiridis Subject: [PATCH v4 2/3] doc: api: bootcount: Convert to rST documentation Date: Fri, 28 Jun 2024 19:35:42 +0200 Message-Id: <20240628173543.129207-3-vassilisamir@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628173543.129207-1-vassilisamir@gmail.com> References: <20240628173543.129207-1-vassilisamir@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 29 Jun 2024 03:11:20 +0200 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 Move to the new documentation style with rST formatting. Signed-off-by: Vasileios Amoiridis --- doc/README.bootcount | 53 --------------------------------------- doc/api/bootcount.rst | 58 +++++++++++++++++++++++++++++++++++++++++++ doc/api/index.rst | 1 + 3 files changed, 59 insertions(+), 53 deletions(-) delete mode 100644 doc/README.bootcount create mode 100644 doc/api/bootcount.rst diff --git a/doc/README.bootcount b/doc/README.bootcount deleted file mode 100644 index 0f4ffb6828..0000000000 --- a/doc/README.bootcount +++ /dev/null @@ -1,53 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -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, 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 -"altbootcmd" will be executed. - -If the variable "bootlimit" is not defined in the environment, the Boot Count -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" to 0 when the system booted -successfully, thus allowing for more boot cycles. - -CONFIG_BOOTCOUNT_FS --------------------- - -This adds support for maintaining boot count in a file on a filesystem. -Supported filesystems are FAT and EXT. The file to use is defined by: - -CONFIG_SYS_BOOTCOUNT_FS_INTERFACE -CONFIG_SYS_BOOTCOUNT_FS_DEVPART -CONFIG_SYS_BOOTCOUNT_FS_NAME - -The format of the file is: - -==== ================= -type entry -==== ================= -u8 magic -u8 version -u8 bootcount -u8 upgrade_available -==== ================= - -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 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/doc/api/bootcount.rst b/doc/api/bootcount.rst new file mode 100644 index 0000000000..9435a7ef15 --- /dev/null +++ b/doc/api/bootcount.rst @@ -0,0 +1,58 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +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, 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 +``altbootcmd`` will be executed. + +If the variable ``bootlimit`` is not defined in the environment, the Boot Count +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`` to 0 when the system booted +successfully, thus allowing for more boot cycles. + +CONFIG_BOOTCOUNT_FS +-------------------- + +This adds support for maintaining boot count in a file on a filesystem. +Tested filesystems are FAT and EXT. The file to use is defined by: + +CONFIG_SYS_BOOTCOUNT_FS_INTERFACE +CONFIG_SYS_BOOTCOUNT_FS_DEVPART +CONFIG_SYS_BOOTCOUNT_FS_NAME + +The format of the file is: + +.. list-table:: + :header-rows: 1 + + * - type + - entry + * - u8 + - magic + * - u8 + - version + * - u8 + - bootcount + * - u8 + - upgrade_available + +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 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/doc/api/index.rst b/doc/api/index.rst index 51b2013af3..ec0b8adb2c 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -6,6 +6,7 @@ U-Boot API documentation .. toctree:: :maxdepth: 2 + bootcount clk dfu dm From patchwork Fri Jun 28 17:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasileios Amoiridis X-Patchwork-Id: 1954195 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=XTKbtyV3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9vR109bQz20Xg for ; Sat, 29 Jun 2024 11:11:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F016885DF; Sat, 29 Jun 2024 03:11:23 +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="XTKbtyV3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7215488578; Fri, 28 Jun 2024 19:35:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 8F957881EC for ; Fri, 28 Jun 2024 19:35:50 +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=vassilisamir@gmail.com Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a7194ce90afso99111166b.2 for ; Fri, 28 Jun 2024 10:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719596150; x=1720200950; darn=lists.denx.de; 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=5Yk7IAxQOJChTQaXdDtw9J76THMfaXyZ16AHt5lVfT0=; b=XTKbtyV3XN76xTRv8Brq3WQLOKhaoHsz8DlXAL66xFa+T572GgczPD79vGWHhMP+to RwlZ0kmzCCtznMvUfOOd5oqO6N9eKFjbNA35BV8hyzg3juHdNNdifE9/oByCPuxEXtyW m6Ts1WIcyjkFR3nCL7QKwWxx5K/fajvioWC5liiVkjgnOCwu0SebjCwmzpvmLCtHSYvh GjmQtYZ9vIzKVrc5dJ6CX6VhdQPPvpliuKzU6lJXu3nGCuLA/JumnZKWf8L4GmfP0Id/ 7cvNfs07+JMOaYb7ny7svoEnnyqGzij6aHPZpUZsxmgZi7CQEbXEQkr610f5jSfvNR+x ZlDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719596150; x=1720200950; 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=5Yk7IAxQOJChTQaXdDtw9J76THMfaXyZ16AHt5lVfT0=; b=p9uz/vjuuylXjgCnTXOgoJ73TFbJvozv2emcASobCa/rRkN8hlzImn1PMtNupapNaL g/N/wAJHgV2dYTitc6HClHNjth8CAjt8LLmOvy6mWBfCc2d46+8kXNr1J/NDTKM4egcC e9TH+cNqh7G2La1i+OSKXxtzJGZ/rAPp9Js3rDGat0D52cGNSjzshK7e+ad5WrtBGxnk lSEF2M8L2tTljGjbUcYw14vVo9d5ZgH2RtoJBm/x7/Se+pbWejyS23eznAnUtDtgmVrp glhYuzv5dfV5g4eyNdD6u5/OOqgfr4f/dus0QiJtZxQCvT4hOKEhVjHp8aGhBqZ8Dqk0 tx3Q== X-Forwarded-Encrypted: i=1; AJvYcCV5KL9a5kLvv7T06Yzwoc3BEfrYPBtskBla/9APuM1t/jdBrPZ2xQ0VFCqPtLWHWtQEiCpecMbFyZ1neqoupS0STusPgw== X-Gm-Message-State: AOJu0YzoMZD4xH/IWKuk40v4DzuLTZlBF3/ZNqahuXHA1XC/Q1B39Bju /7ranohj2UjtOQIt6wpvJGSGkkJZCQzV/jTz95ml8OiG88VN+yD20d74qHzCHJQ= X-Google-Smtp-Source: AGHT+IHOteg67kcWJfjd1CzS2ltbCgAIFxfX1NTm1oNtpaSRpbelHBB2tC7Ud2VIDlPphxrrZ+m4uw== X-Received: by 2002:a17:906:4a12:b0:a6f:d085:9e32 with SMTP id a640c23a62f3a-a716593e3efmr1145275566b.76.1719596149802; Fri, 28 Jun 2024 10:35:49 -0700 (PDT) Received: from localhost.localdomain ([2a04:ee41:82:7577:b996:e85b:4fbf:5c89]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aafb9e4csm96214666b.95.2024.06.28.10.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 10:35:49 -0700 (PDT) From: Vasileios Amoiridis To: trini@konsulko.com, hs@denx.de, pro@denx.de Cc: vassilisamir@gmail.com, quentin.schulz@cherry.de, u-boot@lists.denx.de, Vasileios Amoiridis Subject: [PATCH v4 3/3] drivers: bootcount: Fix typo in documentation Date: Fri, 28 Jun 2024 19:35:43 +0200 Message-Id: <20240628173543.129207-4-vassilisamir@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240628173543.129207-1-vassilisamir@gmail.com> References: <20240628173543.129207-1-vassilisamir@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 29 Jun 2024 03:11:20 +0200 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 The bootcount documentation was using "unattended" while it probably intending to say "unintended" Signed-off-by: Vasileios Amoiridis Reviewed-by: Quentin Schulz --- doc/api/bootcount.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/bootcount.rst b/doc/api/bootcount.rst index 9435a7ef15..968c679c3c 100644 --- a/doc/api/bootcount.rst +++ b/doc/api/bootcount.rst @@ -49,7 +49,7 @@ The format of the file is: * - u8 - upgrade_available -To prevent unattended usage of ``altbootcmd``, the ``upgrade_available`` +To prevent unintended 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 saved.