Accepting request 709899 from home:michael-chang:branches:Base:System

- Avoid high resolution when trying to keep current mode (bsc#1133842) 
  * grub2-video-limit-the-resolution-for-fixed-bimap-font.patch
- Make GRUB_SAVEDEFAULT working with btrfs (bsc#1128592)
  * grub2-grubenv-in-btrfs-header.patch

OBS-URL: https://build.opensuse.org/request/show/709899
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=334
This commit is contained in:
Michael Chang 2019-06-14 07:19:55 +00:00 committed by Git OBS Bridge
parent df62b2deb2
commit 98c7f34bed
3 changed files with 64 additions and 18 deletions

View File

@ -2,6 +2,8 @@ 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.
v2: export env_block and make sure to use the device of grubenv
---
Index: grub-2.02/grub-core/kern/fs.c
===================================================================
@ -447,19 +449,21 @@ Index: grub-2.02/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
@@ -46,6 +46,13 @@ cat << EOF
if [ -s \$prefix/grubenv ]; then
load_env
fi
+
+if [ "\${env_block}" ] ; then
+ set env_block="(\${root})\${env_block}"
+ export env_block
+ load_env -f "\${env_block}"
+fi
+
EOF
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
cat <<EOF
@@ -55,6 +60,9 @@ elif [ "\${next_entry}" ] ; then
@@ -55,6 +62,9 @@ elif [ "\${next_entry}" ] ; then
set default="\${next_entry}"
set next_entry=
save_env next_entry
@ -469,7 +473,7 @@ Index: grub-2.02/util/grub.d/00_header.in
set boot_once=true
else
set default="${GRUB_DEFAULT}"
@@ -66,6 +74,9 @@ if [ "\${next_entry}" ] ; then
@@ -66,6 +76,9 @@ if [ "\${next_entry}" ] ; then
set default="\${next_entry}"
set next_entry=
save_env next_entry
@ -479,12 +483,15 @@ Index: grub-2.02/util/grub.d/00_header.in
set boot_once=true
else
set default="${GRUB_DEFAULT}"
@@ -94,6 +105,10 @@ function savedefault {
@@ -93,7 +106,12 @@ fi
function savedefault {
if [ -z "\${boot_once}" ]; then
saved_entry="\${chosen}"
save_env saved_entry
- save_env saved_entry
+ if [ "\${env_block}" ] ; then
+ save_env -f "\${env_block}" saved_entry
+ else
+ save_env saved_entry
+ fi
+
fi

View File

@ -12,16 +12,28 @@ This change also makes grub font readable on hiDPI device without going through
the steps in.
https://wiki.archlinux.org/index.php/HiDPI#GRUB
v2: efi_gop: Avoid high resolution when trying to keep current mode.
---
grub-core/video/efi_gop.c | 7 +++++++
grub-core/video/i386/pc/vbe.c | 8 +++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
index 1e7b396..1db39e7 100644
--- a/grub-core/video/efi_gop.c
+++ b/grub-core/video/efi_gop.c
@@ -377,6 +377,13 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
Index: grub-2.02/grub-core/video/efi_gop.c
===================================================================
--- grub-2.02.orig/grub-core/video/efi_gop.c
+++ grub-2.02/grub-core/video/efi_gop.c
@@ -360,7 +360,7 @@ grub_video_gop_setup (unsigned int width
grub_err_t err;
unsigned bpp;
int found = 0;
- int avoid_low_resolution = 1;
+ int avoid_extreme_resolution = 1;
unsigned long long best_volume = 0;
unsigned int preferred_width = 0, preferred_height = 0;
grub_uint8_t *buffer;
@@ -377,13 +377,21 @@ grub_video_gop_setup (unsigned int width
preferred_height = 600;
grub_errno = GRUB_ERR_NONE;
}
@ -35,11 +47,33 @@ index 1e7b396..1db39e7 100644
}
again:
diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c
index b0d3190..68700ec 100644
--- a/grub-core/video/i386/pc/vbe.c
+++ b/grub-core/video/i386/pc/vbe.c
@@ -994,7 +994,13 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
/* Keep current mode if possible. */
if (gop->mode->info &&
- (!avoid_low_resolution ||
- (gop->mode->info->width >= 800 && gop->mode->info->height >= 600)))
+ (!avoid_extreme_resolution ||
+ ((gop->mode->info->width >= 800 && gop->mode->info->height >= 600) &&
+ (gop->mode->info->width <= 1920 && gop->mode->info->height <= 1080))))
{
bpp = grub_video_gop_get_bpp (gop->mode->info);
if (bpp && ((width == gop->mode->info->width
@@ -456,9 +464,9 @@ again:
if (!found)
{
- if (avoid_low_resolution && gop->mode->info)
+ if (avoid_extreme_resolution && gop->mode->info)
{
- avoid_low_resolution = 0;
+ avoid_extreme_resolution = 0;
goto again;
}
grub_dprintf ("video", "GOP: no mode found\n");
Index: grub-2.02/grub-core/video/i386/pc/vbe.c
===================================================================
--- grub-2.02.orig/grub-core/video/i386/pc/vbe.c
+++ grub-2.02/grub-core/video/i386/pc/vbe.c
@@ -994,7 +994,13 @@ grub_video_vbe_setup (unsigned int width
{
grub_vbe_get_preferred_mode (&width, &height);
if (grub_errno == GRUB_ERR_NONE)
@ -54,6 +88,3 @@ index b0d3190..68700ec 100644
else
{
/* Fall back to 640x480. This is conservative, but the largest
--
2.12.3

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Jun 14 06:13:58 UTC 2019 - mchang@suse.com
- Avoid high resolution when trying to keep current mode (bsc#1133842)
* grub2-video-limit-the-resolution-for-fixed-bimap-font.patch
- Make GRUB_SAVEDEFAULT working with btrfs (bsc#1128592)
* grub2-grubenv-in-btrfs-header.patch
-------------------------------------------------------------------
Fri May 17 13:57:29 UTC 2019 - rw@suse.com