This patch series adds support for storing the GRUB environment block in
a reserved area of the Btrfs header. On copy on write filesystems such
as Btrfs, the normal file based envblk cannot be updated safely at
runtime because block addresses are not stable. The reserved area
provides a fixed location that GRUB can write directly, allowing
commands such as grub-reboot and savedefault to work on Btrfs volumes.

The series proceeds in small chunks to keep each change buildable and
easier to review. The first patches add new data structures and helpers
for creating, opening, and writing an environment block in the reserved
area. Later patches update set_variables, unset_variables, and
list_variables so they can use the external block when it is present. An
entry is added to the Btrfs header to reserve space at 256 KiB for the
environment block. Finally, grub.cfg is modified so that load_env and
save_env use the external block automatically when env_block is defined.

Michael Chang (8):
  util/grub-editenv: add basic structures and probe call for external
    envblk
  util/grub-editenv: add fs_envblk open helper
  util/grub-editenv: add fs_envblk write helper
  util/grub-editenv: wire set_variables to optional fs_envblk
  util/grub-editenv: wire unset_variables to optional fs_envblk
  util/grub-editenv: wire list_variables to optional fs_envblk
  btrfs: add environment block to reserved header area
  00_header.in: wire grub.cfg to use env_block when present

 grub-core/fs/btrfs.c     |   3 +-
 include/grub/fs.h        |   2 +
 util/grub-editenv.c      | 394 ++++++++++++++++++++++++++++++++++++++-
 util/grub.d/00_header.in |  26 ++-
 4 files changed, 418 insertions(+), 7 deletions(-)

-- 
2.50.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to