Re: [PATCH v6 11/12] docs: add Btrfs env block and special env vars

Michael Chang via Grub-devel <[email protected]>
Newsgroups org.gnu.grub-devel
Message-ID <ws3vtfbmxx4kzwis22626uburyhveqdzmpe5qn7zycfk7namy2@f4in4yxblwjl>
Hi Leo,

Thanks for reporting this. I see it has already been merged into git, so
you can simply apply from there now. 

Thanks,
Michael

On Fri, Oct 24, 2025 at 12:18:37PM -0600, Leo Sandoval wrote:
> a minor merge conflict:
> 
> This patch in particular needs to be rebased to latest master
> 
> otherwise I am seeing this on my b4 command
> 
> $ b4 shazam
> https://lore.kernel.org/grub-devel/CAEg-Je8-yE=upFm3RG_4LuG1fRhHGDtco9tEuORE3N3CvqA2Kg@mail.gmail.com/T/#t
> Grabbing thread from
> lore.kernel.org/all/CAEg-Je8-yE%[email protected]/t.mbox.gz
> Checking for newer revisions
> Grabbing search results from lore.kernel.org
> Analyzing 19 messages in the thread
> Analyzing 99 code-review messages
> Checking attestation on all messages, may take a moment...
> ---
>   ✗ [PATCH v6 1/12] misc: add z length modifier support
>   ✗ [PATCH v6 2/12] tests: add z modifier printf tests
>   ✗ [PATCH v6 3/12] util/grub-editenv: add fs_envblk open helper
>   ✗ [PATCH v6 4/12] util/grub-editenv: add fs_envblk write helper
>   ✗ [PATCH v6 5/12] util/grub-editenv: wire set_variables to optional
> fs_envblk
>   ✗ [PATCH v6 6/12] util/grub-editenv: wire unset_variables to optional
> fs_envblk
>   ✗ [PATCH v6 7/12] util/grub-editenv: wire list_variables to optional
> fs_envblk
>   ✗ [PATCH v6 8/12] util/grub-editenv: add probe call for external envblk
>   ✗ [PATCH v6 9/12] btrfs: add environment block to reserved header area
>   ✗ [PATCH v6 10/12] 00_header.in: wire grub.cfg to use env_block when
> present
>   ✗ [PATCH v6 11/12] docs: add Btrfs env block and special env vars
>   ✗ [PATCH v6 12/12] btrfs: update doc link for bootloader support
>   ---
>   ✗ BADSIG: DKIM/suse.com
> ---
> Total patches: 12
> ---
> Applying: misc: add z length modifier support
> Applying: tests: add z modifier printf tests
> Applying: util/grub-editenv: add fs_envblk open helper
> Applying: util/grub-editenv: add fs_envblk write helper
> Applying: util/grub-editenv: wire set_variables to optional fs_envblk
> Applying: util/grub-editenv: wire unset_variables to optional fs_envblk
> Applying: util/grub-editenv: wire list_variables to optional fs_envblk
> Applying: util/grub-editenv: add probe call for external envblk
> Applying: btrfs: add environment block to reserved header area
> Applying: 00_header.in: wire grub.cfg to use env_block when present
> Applying: docs: add Btrfs env block and special env vars
> Patch failed at 0011 docs: add Btrfs env block and special env vars
> error: patch failed: docs/grub.texi:3271
> error: docs/grub.texi: patch does not apply
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> hint: When you have resolved this problem, run "git am --continue".
> hint: If you prefer to skip this patch, run "git am --skip" instead.
> hint: To restore the original branch and stop patching, run "git am
> --abort".
> hint: Disable this message with "git config set advice.mergeConflict false"
> 
> 
> 
> On Fri, Oct 17, 2025 at 3:04 AM Michael Chang via Grub-devel <
> [email protected]> wrote:
> 
> > Update grub.texi to describe the external environment block in the
> > reserved area of Btrfs header used for grub-reboot and savedefault, and
> > add a section documenting the saved_entry, next_entry, and env_block
> > variables.
> >
> > Signed-off-by: Michael Chang <[email protected]>
> > Reviewed-by: Neal Gompa <[email protected]>
> > Reviewed-by: Daniel Kiper <[email protected]>
> > ---
> >  docs/grub.texi | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 60 insertions(+)
> >
> > diff --git a/docs/grub.texi b/docs/grub.texi
> > index 34b3484dc..6ffb3a370 100644
> > --- a/docs/grub.texi
> > +++ b/docs/grub.texi
> > @@ -3271,6 +3271,7 @@ GRUB.  Others may be used freely in GRUB
> > configuration files.
> >  @menu
> >  * Special environment variables::
> >  * Environment block::
> > +* Special environment block variables::
> >  @end menu
> >
> >
> > @@ -3868,9 +3869,68 @@ For safety reasons, this storage is only available
> > when installed on a plain
> >  disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and
> >  using BIOS or EFI functions (no ATA, USB or IEEE1275).
> >
> > +On Btrfs filesystems, a reserved area in the filesystem header may be
> > used to
> > +store the environment block. This static block avoids the problems of
> > updating
> > +a normal file on a copy-on-write filesystem, where writing raw block is
> > not
> > +stable and requires metadata update. The reserved area provides a fixed
> > +location that GRUB can update directly, allowing commands such as
> > +@command{grub-reboot} and @samp{GRUB_SAVEDEFAULT} to function correctly on
> > +Btrfs volumes.
> > +
> >  @command{grub-mkconfig} uses this facility to implement
> >  @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
> >
> > +
> > +@node Special environment block variables
> > +@section Special environment block variables
> > +
> > +These special variables are usually written to the environment block
> > +(@pxref{Environment block}) to customize the behavior of @file{grub.cfg}
> > +generated by @command{grub-mkconfig}.
> > +
> > +@menu
> > +* saved_entry::
> > +* next_entry::
> > +* env_block::
> > +@end menu
> > +
> > +
> > +@node saved_entry
> > +@subsection saved_entry
> > +
> > +The @var{saved_entry} variable sets the default boot entry in
> > @file{grub.cfg}
> > +created by @command{grub-mkconfig}. It can be set with
> > +@command{grub-set-default} to choose a default entry, or at runtime with
> > the
> > +@code{savedefault} function in grub.cfg to save the current entry as the
> > new
> > +default. This may require write access by GRUB.
> > +
> > +
> > +@node next_entry
> > +@subsection next_entry
> > +
> > +The @var{next_entry} variable sets the boot entry for the next boot only.
> > After
> > +it is used, GRUB clears the value so it is not reused. This requires write
> > +access to the environment block (@pxref{Environment block}) at runtime.
> > The
> > +@command{grub-reboot} command is usually used instead of changing this
> > variable
> > +directly.
> > +
> > +
> > +@node env_block
> > +@subsection env_block
> > +
> > +If the filesystem is Btrfs and the disk is not an abstracted device such
> > as
> > +LVM, RAID, or encryption, the reserved space in the Btrfs header can be
> > used as
> > +the environment block (@pxref{Environment block}). This provides a fixed
> > raw
> > +block that GRUB can reliably write to. The @var{env_block} records this
> > +location in GRUB blocklist syntax (@pxref{Block list syntax}) so that
> > +@command{grub-editenv} and @file{grub.cfg} know how to access and use the
> > +external raw block.
> > +
> > +This variable is initialized when @file{grubenv} is first created by
> > +@command{grub-editenv} and is treated as read-only to avoid being
> > overwritten
> > +with an unpredictable value.
> > +
> > +
> >  @node Modules
> >  @chapter Modules
> >
> > --
> > 2.51.0
> >
> >
> > _______________________________________________
> > Grub-devel mailing list
> > [email protected]
> > https://lists.gnu.org/mailman/listinfo/grub-devel
> >

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.