SHA256
1
0
forked from pool/grub2

Accepting request 585948 from home:fos:branches:Base:System

For health-checker (https://build.opensuse.org/package/show/devel:CaaSP/health-checker) an additional flag is used to exchange information between GRUB and user space; as suggested by Michael this patch will enable writing that specific variable into the GRUB environment block.

- Store GRUB environment variable health_checker_flag
  in Btrfs header
- Rename grub2-btrfs-workaround-grub2-once.patch to
  grub2-grubenv-in-btrfs-header.patch (as the original 
  filename was too specific - the patch is not only
  storing the next_entry flag only in the Btrfs
  header now)

OBS-URL: https://build.opensuse.org/request/show/585948
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=293
This commit is contained in:
Michael Chang 2018-03-13 07:03:38 +00:00 committed by Git OBS Bridge
parent a651cf5fd9
commit 1e655f7670
3 changed files with 27 additions and 14 deletions

View File

@ -1,7 +1,12 @@
Index: grub-2.02~rc2/grub-core/kern/fs.c
GRUB cannot write Btrfs file systems from the bootloader, so it cannot
modify values set from userspace (e.g. "next_entry" set by grub2-once).
As a workaround use the Btrfs header to store known data of the GRUB environment
block.
---
Index: grub-2.02/grub-core/kern/fs.c
===================================================================
--- grub-2.02~rc2.orig/grub-core/kern/fs.c
+++ grub-2.02~rc2/grub-core/kern/fs.c
--- grub-2.02.orig/grub-core/kern/fs.c
+++ grub-2.02/grub-core/kern/fs.c
@@ -27,6 +27,7 @@
#include <grub/mm.h>
#include <grub/term.h>
@ -24,10 +29,10 @@ Index: grub-2.02~rc2/grub-core/kern/fs.c
ret += size;
len -= size;
sector -= ((size + offset) >> GRUB_DISK_SECTOR_BITS);
Index: grub-2.02~rc2/util/grub-editenv.c
Index: grub-2.02/util/grub-editenv.c
===================================================================
--- grub-2.02~rc2.orig/util/grub-editenv.c
+++ grub-2.02~rc2/util/grub-editenv.c
--- grub-2.02.orig/util/grub-editenv.c
+++ grub-2.02/util/grub-editenv.c
@@ -23,8 +23,11 @@
#include <grub/util/misc.h>
#include <grub/lib/envblk.h>
@ -239,13 +244,14 @@ Index: grub-2.02~rc2/util/grub-editenv.c
set_variables (const char *name, int argc, char *argv[])
{
grub_envblk_t envblk;
@@ -217,8 +393,26 @@ set_variables (const char *name, int arg
@@ -217,8 +393,27 @@ set_variables (const char *name, int arg
*(p++) = 0;
- if (! grub_envblk_set (envblk, argv[0], p))
- grub_util_error ("%s", _("environment block too small"));
+ if (strcmp (argv[0], "next_entry") == 0 && fs_envblk)
+ if ((strcmp (argv[0], "next_entry") == 0 ||
+ strcmp (argv[0], "health_checker_flag") == 0) && fs_envblk)
+ {
+ grub_envblk_t envblk_fs;
+ envblk_fs = open_envblk_fs (envblk);
@ -268,7 +274,7 @@ Index: grub-2.02~rc2/util/grub-editenv.c
argc--;
argv++;
@@ -226,26 +420,158 @@ set_variables (const char *name, int arg
@@ -226,26 +421,158 @@ set_variables (const char *name, int arg
write_envblk (name, envblk);
grub_envblk_close (envblk);
@ -427,7 +433,7 @@ Index: grub-2.02~rc2/util/grub-editenv.c
int
main (int argc, char *argv[])
{
@@ -277,6 +603,9 @@ main (int argc, char *argv[])
@@ -277,6 +604,9 @@ main (int argc, char *argv[])
command = argv[curindex++];
}
@ -437,10 +443,10 @@ Index: grub-2.02~rc2/util/grub-editenv.c
if (strcmp (command, "create") == 0)
grub_util_create_envblk_file (filename);
else if (strcmp (command, "list") == 0)
Index: grub-2.02~rc2/util/grub.d/00_header.in
Index: grub-2.02/util/grub.d/00_header.in
===================================================================
--- grub-2.02~rc2.orig/util/grub.d/00_header.in
+++ grub-2.02~rc2/util/grub.d/00_header.in
--- grub-2.02.orig/util/grub.d/00_header.in
+++ grub-2.02/util/grub.d/00_header.in
@@ -46,6 +46,11 @@ cat << EOF
if [ -s \$prefix/grubenv ]; then
load_env

View File

@ -7,6 +7,13 @@ Tue Mar 6 08:21:43 UTC 2018 - mchang@suse.com
- insert mdraid modules to support software RAID (bsc#1078775)
* grub2-xen-pv-firmware.cfg
-------------------------------------------------------------------
Thu Mar 1 18:36:33 UTC 2018 - iforster@suse.com
- Rename grub2-btrfs-workaround-grub2-once.patch to
grub2-grubenv-in-btrfs-header.patch
- Store GRUB environment variable health_checker_flag in Btrfs header
-------------------------------------------------------------------
Tue Feb 13 09:05:45 UTC 2018 - mchang@suse.com

View File

@ -197,7 +197,7 @@ Patch58: grub2-xen-linux16.patch
Patch59: grub2-efi-disable-video-cirrus-and-bochus.patch
Patch60: grub2-editenv-add-warning-message.patch
Patch61: grub2-vbe-blacklist-preferred-1440x900x32.patch
Patch64: grub2-btrfs-workaround-grub2-once.patch
Patch64: grub2-grubenv-in-btrfs-header.patch
Patch65: grub2-mkconfig-aarch64.patch
Patch70: grub2-default-distributor.patch
Patch71: grub2-menu-unrestricted.patch