mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] Documentation: state: add real-world example for stride size calculation
Date: Wed, 12 Jun 2024 15:36:53 +0200	[thread overview]
Message-ID: <20240612133653.2565305-1-a.fatoum@pengutronix.de> (raw)

The usual use of barebox state is to store the bootstate for
bootchooser. Thus change the example to use the minimum size of the
bootstate variable set instead and relate the result to stride size and
partition size.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/user/state.rst | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/user/state.rst b/Documentation/user/state.rst
index 9054a3792337..75352302c7ff 100644
--- a/Documentation/user/state.rst
+++ b/Documentation/user/state.rst
@@ -357,9 +357,14 @@ size of a partition).
 
 .. important:: The ``direct`` storage backend needs 8 bytes of additional space
    per *state* variable set for its meta data. Keep this in mind when calculating
-   the stridesize. For example, if your variable set needs 8 bytes, the ``raw``
-   header needs 16 bytes and the ``direct`` storage backend additionally 8 bytes.
-   The full space for one *state* variable set is now 8 + 16 + 8 = 32 bytes.
+   the stridesize. For example, the bootchooser boot state needs 20 bytes for
+   its variables. The ``raw`` header adds 16 bytes and the ``direct`` storage
+   backend adds a further 8 bytes.
+   The full space for one *state* variable set (minimum stride size) is thus
+   20 + 16 + 8 = 44 bytes.
+   The minimum size for the backend partition is then 44 * 3 = 132 bytes.
+   It's a good idea though to increase stride size beyond the minimum to leave
+   some free space for in-place addition of new variables in future.
 
 Circular Storage Backend Redundancy
 ###################################
-- 
2.39.2




             reply	other threads:[~2024-06-12 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12 13:36 Ahmad Fatoum [this message]
2024-06-13  7:04 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240612133653.2565305-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox