SHA256
1
0
forked from pool/grub2

Accepting request 669452 from Base:System

OBS-URL: https://build.opensuse.org/request/show/669452
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=198
This commit is contained in:
Stephan Kulow 2019-02-06 14:44:34 +00:00 committed by Git OBS Bridge
parent a12859021f
commit 04ef4f73ca
9 changed files with 581 additions and 111 deletions

View File

@ -19,15 +19,15 @@ V2:
XEN hypervisor version with sections for different kernels, avoiding
useless duplicates for sym-linked hypervisors. and removing previously
installed files from ESP.
V3:
- support move to '/usr/share/efi/$machine' for EFI-binaries. (bsc#1122563)
---
util/grub.d/20_linux_xen.in | 88 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 86 insertions(+), 2 deletions(-)
util/grub.d/20_linux_xen.in | 109 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 97 insertions(+), 12 deletions(-)
Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02~beta2/util/grub.d/20_linux_xen.in
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -21,6 +21,8 @@ prefix="@prefix@"
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
@ -37,7 +37,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=@PACKAGE@
@@ -36,9 +38,11 @@ CLASS="--class gnu-linux --class gnu --c
@@ -36,11 +38,23 @@ CLASS="--class gnu-linux --class gnu --c
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
@ -49,8 +49,20 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
+ CLASS="--class ${os} ${CLASS}"
fi
+machine=`uname -m`
+
+case "$machine" in
+ i?86) GENKERNEL_ARCH="x86" ;;
+ mips|mips64) GENKERNEL_ARCH="mips" ;;
+ mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
+ arm*) GENKERNEL_ARCH="arm" ;;
+ *) GENKERNEL_ARCH="$machine" ;;
+esac
+
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -85,6 +89,31 @@ esac
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
@@ -87,6 +101,32 @@ esac
title_correction_code=
@ -59,7 +71,8 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
+ err_msg=""
+ efi_dir="/boot/efi/efi/${os}"
+ grub_dir=/boot/@PACKAGE@
+ xen_dir=/usr/lib64/efi
+ xen_dir=/usr/share/efi/$machine
+ [ -d $xen_dir ] || xen_dir=/usr/lib64/efi
+ for d in $grub_dir $efi_dir $xen_dir; do
+ [ ! -d "$d" ] || continue
+ err_msg="${err_msg}$ME: Essential directory '$d' not found!\n"
@ -82,7 +95,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
linux_entry ()
{
os="$1"
@@ -122,6 +151,40 @@ linux_entry ()
@@ -124,6 +164,40 @@ linux_entry ()
save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
fi
@ -123,7 +136,24 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
@@ -219,6 +282,24 @@ while [ "x${xen_list}" != "x" ] ; do
@@ -200,16 +274,6 @@ boot_device_id=
title_correction_code=
-machine=`uname -m`
-
-case "$machine" in
- i?86) GENKERNEL_ARCH="x86" ;;
- mips|mips64) GENKERNEL_ARCH="mips" ;;
- mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
- arm*) GENKERNEL_ARCH="arm" ;;
- *) GENKERNEL_ARCH="$machine" ;;
-esac
-
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
submenu_indentation=""
@@ -223,6 +287,24 @@ while [ "x${xen_list}" != "x" ] ; do
xen_dirname=`dirname ${current_xen}`
rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
@ -148,7 +178,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
@@ -283,7 +364,6 @@ while [ "x${xen_list}" != "x" ] ; do
@@ -287,7 +369,6 @@ while [ "x${xen_list}" != "x" ] ; do
if [ x"$is_top_level" != xtrue ]; then
echo ' }'
fi
@ -156,7 +186,7 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
done
# If at least one kernel was found, then we need to
@@ -293,3 +373,7 @@ if [ x"$is_top_level" != xtrue ]; then
@@ -297,3 +378,7 @@ if [ x"$is_top_level" != xtrue ]; then
fi
echo "$title_correction_code"

View File

@ -16,11 +16,13 @@ This patch fixes the problem by ensuring the directory available to Xen
installation if any Xen hypervisor found and independent to grub boot path
$cmdpath to work.
Index: grub-2.02/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.02.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02/util/grub.d/20_linux_xen.in
@@ -91,31 +91,6 @@ esac
---
util/grub.d/20_linux_xen.in | 62 ++++++++++++++++++++++++--------------------
1 file changed, 35 insertions(+), 27 deletions(-)
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -101,32 +101,6 @@ esac
title_correction_code=
@ -29,7 +31,8 @@ Index: grub-2.02/util/grub.d/20_linux_xen.in
- err_msg=""
- efi_dir="/boot/efi/efi/${os}"
- grub_dir=/boot/@PACKAGE@
- xen_dir=/usr/lib64/efi
- xen_dir=/usr/share/efi/$machine
- [ -d $xen_dir ] || xen_dir=/usr/lib64/efi
- for d in $grub_dir $efi_dir $xen_dir; do
- [ ! -d "$d" ] || continue
- err_msg="${err_msg}$ME: Essential directory '$d' not found!\n"
@ -52,7 +55,7 @@ Index: grub-2.02/util/grub.d/20_linux_xen.in
grub2_unquote ()
{
awk '
@@ -223,10 +198,15 @@ linux_entry ()
@@ -234,10 +208,15 @@ linux_entry ()
kernel=${basename} root=${linux_root_device_thisversion} ${args_unq}
ramdisk=${initrd}
EOF
@ -69,7 +72,7 @@ Index: grub-2.02/util/grub.d/20_linux_xen.in
}
EOF
for f in ${grub_dir}/$xen_cfg ${xen_dir}/${xen_basename} ${dirname}/${basename} ${dirname}/${initrd}; do
@@ -307,6 +287,7 @@ else
@@ -318,6 +297,7 @@ else
done
fi
prepare_boot_cache=
@ -77,7 +80,7 @@ Index: grub-2.02/util/grub.d/20_linux_xen.in
boot_device_id=
title_correction_code=
@@ -327,6 +308,33 @@ submenu_indentation=""
@@ -328,6 +308,34 @@ submenu_indentation=""
is_top_level=true
@ -86,7 +89,8 @@ Index: grub-2.02/util/grub.d/20_linux_xen.in
+ err_msg=""
+ efi_dir="/boot/efi/efi/${os}"
+ grub_dir=/boot/grub2
+ xen_dir=/usr/lib64/efi
+ xen_dir=/usr/share/efi/$machine
+ [ -d $xen_dir ] || xen_dir=/usr/lib64/efi
+ for d in $grub_dir $xen_dir; do
+ [ ! -d "$d" ] || continue
+ err_msg="${err_msg}$ME: Essential directory '$d' not found!\n"

View File

@ -0,0 +1,267 @@
From b4c5f80fbfaf912553eca1b12da6fc49de4ae37f Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Mon, 7 Jan 2019 17:55:05 +0800
Subject: [PATCH] gfxmenu: support scrolling menu entry's text
If menu entry's title text is longer than its display width, the
overlong text simply get truncated. The only possible way to view the
full text is through the menu editing mode, but is a hassle switching
over the mode back and forth. Also menu editing mode could be password
protected which makes it not generally available to everyone.
This patch implemented scrolling text support to the title of grub's
gfxmenu to make it convenient for viewing the truncated text by pressing
the ctrl+l and ctrl+r to scroll the highlighted text left and right. The
scrolled result will remain in place to help memorizing it after
changing highlight to other entry.
---
grub-core/gfxmenu/gfxmenu.c | 3 +++
grub-core/gfxmenu/gui_label.c | 2 ++
grub-core/gfxmenu/gui_list.c | 38 ++++++++++++++++++++++++++++++++++
grub-core/gfxmenu/view.c | 48 +++++++++++++++++++++++++++++++++++++++++++
grub-core/normal/menu.c | 16 +++++++++++++++
include/grub/gfxmenu_view.h | 4 ++++
include/grub/menu_viewer.h | 1 +
7 files changed, 112 insertions(+)
diff --git a/grub-core/gfxmenu/gfxmenu.c b/grub-core/gfxmenu/gfxmenu.c
index 8a17dda2c..e834895fb 100644
--- a/grub-core/gfxmenu/gfxmenu.c
+++ b/grub-core/gfxmenu/gfxmenu.c
@@ -108,6 +108,8 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
view->menu = menu;
view->nested = nested;
view->first_timeout = -1;
+ if (menu->size)
+ view->menu_title_offset = grub_zalloc (sizeof (*view->menu_title_offset) * menu->size);
grub_video_set_viewport (0, 0, mode_info.width, mode_info.height);
if (view->double_repaint)
@@ -123,6 +125,7 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
instance->fini = grub_gfxmenu_viewer_fini;
instance->print_timeout = grub_gfxmenu_print_timeout;
instance->clear_timeout = grub_gfxmenu_clear_timeout;
+ instance->scroll_chosen_entry = grub_gfxmenu_scroll_chosen_entry;
grub_menu_register_viewer (instance);
diff --git a/grub-core/gfxmenu/gui_label.c b/grub-core/gfxmenu/gui_label.c
index a4c817891..8b1358dd4 100644
--- a/grub-core/gfxmenu/gui_label.c
+++ b/grub-core/gfxmenu/gui_label.c
@@ -192,6 +192,8 @@ label_set_property (void *vself, const char *name, const char *value)
"or `c' for a command-line.");
else if (grub_strcmp (value, "@KEYMAP_SHORT@") == 0)
value = _("enter: boot, `e': options, `c': cmd-line");
+ else if (grub_strcmp (value, "@SUSE_KEYMAP_SCROLL_ENTRY@") == 0)
+ value = _("ctrl+l: scroll entry left, ctrl+r: scroll entry right");
/* FIXME: Add more templates here if needed. */
self->template = grub_strdup (value);
self->text = grub_xasprintf (value, self->value);
diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c
index 01477cdf2..90487aef4 100644
--- a/grub-core/gfxmenu/gui_list.c
+++ b/grub-core/gfxmenu/gui_list.c
@@ -24,6 +24,7 @@
#include <grub/gfxmenu_view.h>
#include <grub/gfxwidgets.h>
#include <grub/color.h>
+#include <grub/charset.h>
enum scrollbar_slice_mode {
SCROLLBAR_SLICE_WEST,
@@ -314,6 +315,33 @@ draw_scrollbar (list_impl_t self,
thumb->draw (thumb, thumbx, thumby);
}
+static const char *
+grub_utf8_offset_code (const char *src, grub_size_t srcsize, int num)
+{
+ int count = 0;
+ grub_uint32_t code = 0;
+
+ while (srcsize && num)
+ {
+ if (srcsize != (grub_size_t)-1)
+ srcsize--;
+ if (!grub_utf8_process ((grub_uint8_t)*src++, &code, &count))
+ return 0;
+ if (count != 0)
+ continue;
+ if (code == 0)
+ return 0;
+ if (code > GRUB_UNICODE_LAST_VALID)
+ return 0;
+ --num;
+ }
+
+ if (!num)
+ return src;
+
+ return 0;
+}
+
/* Draw the list of items. */
static void
draw_menu (list_impl_t self, int num_shown_items)
@@ -433,6 +461,16 @@ draw_menu (list_impl_t self, int num_shown_items)
const char *item_title =
grub_menu_get_entry (self->view->menu, menu_index)->title;
+ {
+ int off = self->view->menu_title_offset[menu_index];
+ const char *scrolled_title;
+
+ scrolled_title = grub_utf8_offset_code (item_title, grub_strlen (item_title), off);
+
+ if (scrolled_title)
+ item_title = scrolled_title;
+ }
+
sviewport.y = item_top + top_pad;
sviewport.width = viewport_width;
grub_gui_set_viewport (&sviewport, &svpsave);
diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c
index ad5e82b81..7aed7faa1 100644
--- a/grub-core/gfxmenu/view.c
+++ b/grub-core/gfxmenu/view.c
@@ -37,6 +37,7 @@
#include <grub/gui_string_util.h>
#include <grub/icon_manager.h>
#include <grub/i18n.h>
+#include <grub/charset.h>
static void
init_terminal (grub_gfxmenu_view_t view);
@@ -142,6 +143,7 @@ grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view)
grub_free (view->title_text);
grub_free (view->progress_message_text);
grub_free (view->theme_path);
+ grub_free (view->menu_title_offset);
if (view->canvas)
view->canvas->component.ops->destroy (view->canvas);
grub_free (view);
@@ -410,6 +412,52 @@ grub_gfxmenu_set_chosen_entry (int entry, void *data)
grub_gfxmenu_redraw_menu (view);
}
+static int
+grub_utf8_get_num_code (const char *src, grub_size_t srcsize)
+{
+ int count = 0;
+ grub_uint32_t code = 0;
+ int num = 0;
+
+ while (srcsize)
+ {
+ if (srcsize != (grub_size_t)-1)
+ srcsize--;
+ if (!grub_utf8_process ((grub_uint8_t)*src++, &code, &count))
+ return 0;
+ if (count != 0)
+ continue;
+ if (code == 0)
+ return num;
+ if (code > GRUB_UNICODE_LAST_VALID)
+ return 0;
+ ++num;
+ }
+
+ return num;
+}
+
+void
+grub_gfxmenu_scroll_chosen_entry (void *data, int diren)
+{
+ grub_gfxmenu_view_t view = data;
+ const char *item_title;
+ int off;
+
+ if (!view->menu->size)
+ return;
+
+ item_title =grub_menu_get_entry (view->menu, view->selected)->title;
+ off = view->menu_title_offset[view->selected] + diren;
+
+ if (off < 0
+ || off > grub_utf8_get_num_code (item_title, grub_strlen(item_title)))
+ return;
+
+ view->menu_title_offset[view->selected] = off;
+ grub_gfxmenu_redraw_menu (view);
+}
+
static void
grub_gfxmenu_draw_terminal_box (void)
{
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index e7a83c2d6..0af20d052 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -376,6 +376,15 @@ menu_set_chosen_entry (int entry)
cur->set_chosen_entry (entry, cur->data);
}
+static void
+menu_scroll_chosen_entry (int diren)
+{
+ struct grub_menu_viewer *cur;
+ for (cur = viewers; cur; cur = cur->next)
+ if (cur->scroll_chosen_entry)
+ cur->scroll_chosen_entry (cur->data, diren);
+}
+
static void
menu_print_timeout (int timeout)
{
@@ -755,6 +764,13 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
menu_set_chosen_entry (current_entry);
break;
+ case GRUB_TERM_CTRL | 'l':
+ menu_scroll_chosen_entry (1);
+ break;
+ case GRUB_TERM_CTRL | 'r':
+ menu_scroll_chosen_entry (-1);
+ break;
+
case '\n':
case '\r':
case GRUB_TERM_KEY_RIGHT:
diff --git a/include/grub/gfxmenu_view.h b/include/grub/gfxmenu_view.h
index 4203c8fb9..56c0d17ae 100644
--- a/include/grub/gfxmenu_view.h
+++ b/include/grub/gfxmenu_view.h
@@ -61,6 +61,8 @@ void
grub_gfxmenu_print_timeout (int timeout, void *data);
void
grub_gfxmenu_set_chosen_entry (int entry, void *data);
+void
+grub_gfxmenu_scroll_chosen_entry (void *data, int diren);
grub_err_t grub_font_draw_string (const char *str,
grub_font_t font,
@@ -119,6 +121,8 @@ struct grub_gfxmenu_view
int nested;
int first_timeout;
+
+ int *menu_title_offset;
};
#endif /* ! GRUB_GFXMENU_VIEW_HEADER */
diff --git a/include/grub/menu_viewer.h b/include/grub/menu_viewer.h
index c6513c4e8..5f2a39dc9 100644
--- a/include/grub/menu_viewer.h
+++ b/include/grub/menu_viewer.h
@@ -33,6 +33,7 @@ struct grub_menu_viewer
void (*set_chosen_entry) (int entry, void *data);
void (*print_timeout) (int timeout, void *data);
void (*clear_timeout) (void *data);
+ void (*scroll_chosen_entry) (void *data, int diren);
void (*fini) (void *fini);
};
--
2.16.4

View File

@ -0,0 +1,33 @@
diff -pruN grub-2.02.orig/grub-core/loader/arm/linux.c grub-2.02/grub-core/loader/arm/linux.c
--- grub-2.02.orig/grub-core/loader/arm/linux.c 2016-02-22 20:04:35.000000000 +0100
+++ grub-2.02/grub-core/loader/arm/linux.c 2019-01-28 15:08:48.814415179 +0100
@@ -50,7 +50,7 @@ typedef void (*kernel_entry_t) (int, uns
#define LINUX_ZIMAGE_MAGIC 0x016f2818
#define LINUX_PHYS_OFFSET (0x00008000)
-#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
+#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x03000000)
#define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
static grub_size_t
diff -pruN grub-2.02.orig/include/grub/arm/linux.h grub-2.02/include/grub/arm/linux.h
--- grub-2.02.orig/include/grub/arm/linux.h 2017-04-24 11:15:49.000000000 +0200
+++ grub-2.02/include/grub/arm/linux.h 2019-01-28 15:08:31.122275854 +0100
@@ -28,7 +28,7 @@
#if defined GRUB_MACHINE_UBOOT
# include <grub/uboot/uboot.h>
# define LINUX_ADDRESS (start_of_ram + 0x8000)
-# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
+# define LINUX_INITRD_ADDRESS (start_of_ram + 0x03000000)
# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000)
# define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data
# define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type
@@ -38,7 +38,7 @@
/* On UEFI platforms - load the images at the lowest available address not
less than *_PHYS_OFFSET from the first available memory location. */
# define LINUX_PHYS_OFFSET (0x00008000)
-# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
+# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x03000000)
# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
# define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt
static inline grub_uint32_t

View File

@ -1 +0,0 @@
addFilter('arch-independent-package-contains-binary-or-object')

View File

@ -0,0 +1,59 @@
From 5f7f27d1198ef425f4943cc10132509415bbaf55 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Thu, 24 Jan 2019 16:41:04 +0800
Subject: [PATCH] video: limit the resolution for fixed bimap font
As grub uses fixed bitmap font and also its size is a fixed property, it is not
possible to accommodate to all resolutions, therefore we raise some limit to
the preferred resolution as most themes are designed on popular device and the
resolution in its prime, which is supposedly Full HD.
This change also makes grub font readable on hiDPI device without going through
the steps in.
https://wiki.archlinux.org/index.php/HiDPI#GRUB
---
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,
preferred_height = 600;
grub_errno = GRUB_ERR_NONE;
}
+ else
+ {
+ /* Limit the range of preferred resolution not exceeding FHD
+ to keep the fixed bitmap font readable */
+ preferred_width = (preferred_width < 1920) ? preferred_width : 1920;
+ preferred_height = (preferred_height < 1080) ? preferred_height : 1080;
+ }
}
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,
{
grub_vbe_get_preferred_mode (&width, &height);
if (grub_errno == GRUB_ERR_NONE)
- preferred_mode = 1;
+ {
+ preferred_mode = 1;
+ /* Limit the range of preferred resolution not exceeding FHD
+ to keep the fixed bitmap font readable */
+ width = (width < 1920) ? width : 1920;
+ height = (height < 1080) ? height : 1080;
+ }
else
{
/* Fall back to 640x480. This is conservative, but the largest
--
2.12.3

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Mon Jan 28 14:12:05 UTC 2019 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Add patch to fix ARM boot, when kernel become too big:
* grub2-move-initrd-upper.patch (boo#1123350)
-------------------------------------------------------------------
Fri Jan 25 07:08:32 UTC 2019 - mchang@suse.com
- Support long menu entry by scrolling its text left and right through
the key stroke ctrl+l and ctrl+r (FATE#325760)
* grub2-gfxmenu-support-scrolling-menu-entry-s-text.patch
-------------------------------------------------------------------
Thu Jan 24 09:26:09 UTC 2019 - mchang@suse.com
- Improved hiDPI device support (FATE#326680)
* grub2-video-limit-the-resolution-for-fixed-bimap-font.patch
-------------------------------------------------------------------
Wed Jan 23 10:44:09 UTC 2019 - rw@suse.com
- Build platform-packages 'noarch' and move to '/usr/share/efi'
for SUSE Manager. (FATE#326960)
* grub2-efi-xen-chainload.patch (bsc#1122563)
* grub2-efi-xen-removable.patch (refresh)
-------------------------------------------------------------------
Thu Dec 20 09:21:27 UTC 2018 - mchang@suse.com

View File

@ -7,3 +7,7 @@ addFilter("statically-linked-binary .*/grub2/*/kernel.img")
addFilter("unstripped-binary-or-object .*/grub2/*/.*.mod")
# TODO: s390 Experts: is this sensible?!
addFilter("s390x: W: executable-stack")
#
addFilter("suse-filelist-forbidden-noarch")
#
addFilter('arch-independent-package-contains-binary-or-object')

View File

@ -1,7 +1,7 @@
#
# spec file for package grub2
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,11 +12,13 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# needssslcertforbuild
%define _binaries_in_noarch_package_terminate_build 0
Name: grub2
%ifarch x86_64 ppc64
BuildRequires: gcc-32bit
@ -28,13 +30,13 @@ BuildRequires: glibc-devel
%endif
BuildRequires: automake
BuildRequires: bison
BuildRequires: dejavu-fonts
BuildRequires: device-mapper-devel
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: freetype2-devel
BuildRequires: fuse-devel
%if 0%{?suse_version} >= 1140
BuildRequires: dejavu-fonts
BuildRequires: gnu-unifont
%endif
BuildRequires: help2man
@ -44,7 +46,11 @@ BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRequires: python3
%if %{defined pythons}
BuildRequires: %{pythons}
%else
BuildRequires: python
%endif
BuildRequires: xz-devel
%ifarch x86_64 aarch64
%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110
@ -127,7 +133,7 @@ BuildRequires: update-bootloader-rpm-macros
%endif
%if %{platform} == emu
# force %{emu} to 1, e.g. for s390
# force %%{emu} to 1, e.g. for s390
%define emu 1
%endif
@ -161,7 +167,6 @@ Source16: grub2-xen-pv-firmware.cfg
# required hook for systemd-sleep (bsc#941758)
Source17: grub2-systemd-sleep.sh
Source18: grub2-check-default.sh
Source999: grub2-rpmlintrc
Source1000: PATCH_POLICY
Patch1: rename-grub-info-file-to-grub2.patch
Patch2: grub2-linux.patch
@ -250,6 +255,8 @@ Patch151: grub2-efi-Free-malloc-regions-on-exit.patch
# Linux root device related patches
Patch163: grub2-zipl-setup-fix-btrfs-multipledev.patch
Patch164: grub2-suse-remove-linux-root-param.patch
# ARM patches - boo#1123350
Patch180: grub2-move-initrd-upper.patch
# PPC64 LE support
Patch205: grub2-ppc64le-disable-video.patch
Patch207: grub2-ppc64le-memory-map.patch
@ -308,6 +315,10 @@ Patch455: 0006-Add-support-for-EFI-handover-on-ARM64.patch
# Use pkg-config to find Freetype2
Patch500: grub2-freetype-pkgconfig.patch
Patch501: grub2-btrfs-help-on-snapper-rollback.patch
# Improved hiDPI device support (FATE#326680)
Patch510: grub2-video-limit-the-resolution-for-fixed-bimap-font.patch
# Support long menuentries (FATE#325760)
Patch511: grub2-gfxmenu-support-scrolling-menu-entry-s-text.patch
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140
@ -324,6 +335,17 @@ Requires(preun):/sbin/install-info
%if ! 0%{?only_efi:1}
Requires: grub2-%{grubarch} = %{version}-%{release}
%endif
%ifarch s390x
# required utilities by grub2-s390x-04-grub2-install.patch
# use 'showconsole' to determine console device. (bnc#876743)
Requires: /sbin/showconsole
Requires: kexec-tools
# for /sbin/zipl used by grub2-zipl-setup
Requires: s390-tools
%endif
%ifarch ppc64 ppc64le
Requires: powerpc-utils
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -356,7 +378,7 @@ Authors:
Summary: Upstream branding for GRUB2's graphical console
Group: System/Fhs
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{version}
%description branding-upstream
Upstream branding for GRUB2's graphical console
@ -366,25 +388,17 @@ Upstream branding for GRUB2's graphical console
Summary: Bootloader with support for Linux, Multiboot and more
Group: System/Boot
Requires: %{name} = %{version}-%{release}
Requires(post): %{name} = %{version}-%{release}
%if %{platform} != emu
BuildArch: noarch
%endif
Requires: %{name} = %{version}
Requires(post): %{name} = %{version}
%if 0%{?update_bootloader_requires:1}
%update_bootloader_requires
%else
Requires: perl-Bootloader
Requires(post): perl-Bootloader
%endif
%ifarch s390x
# required utilities by grub2-s390x-04-grub2-install.patch
# use 'showconsole' to determine console device. (bnc#876743)
Requires: /sbin/showconsole
Requires: kexec-tools
# for /sbin/zipl used by grub2-zipl-setup
Requires: s390-tools
%endif
%ifarch ppc64 ppc64le
Requires: powerpc-utils
%endif
%description %{grubarch}
The GRand Unified Bootloader (GRUB) is a highly configurable and customizable
@ -402,10 +416,11 @@ Summary: Bootloader with support for Linux, Multiboot and more
# Require efibootmgr
# Without it grub-install is broken so break the package as well if unavailable
Group: System/Boot
BuildArch: noarch
Requires: efibootmgr
Requires(post): efibootmgr
Requires: %{name} = %{version}-%{release}
Requires(post): %{name} = %{version}-%{release}
Requires: %{name} = %{version}
Requires(post): %{name} = %{version}
%if 0%{?update_bootloader_requires:1}
%update_bootloader_requires
%else
@ -445,7 +460,7 @@ provides support for XEN systems.
Summary: Grub2's snapper plugin
Group: System/Fhs
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{version}
Requires: libxml2-tools
Supplements: packageand(snapper:grub2)
BuildArch: noarch
@ -554,6 +569,7 @@ swap partition while in resuming
%patch151 -p1
%patch163 -p1
%patch164 -p1
%patch180 -p1
%patch205 -p1
%patch207 -p1
%patch210 -p1
@ -602,8 +618,12 @@ swap partition while in resuming
%patch455 -p1
%patch500 -p1
%patch501 -p1
%patch510 -p1
%patch511 -p1
%build
# collect evidence to debug spurious build failure on SLE15
ulimit -a
# patches above may update the timestamp of grub.texi
# and via build-aux/mdate-sh they end up in grub2.info, breaking build-compare
[ -z "$SOURCE_DATE_EPOCH" ] ||\
@ -635,6 +655,7 @@ mkdir build-emu
%endif
export PYTHON=%{_bindir}/python3
[ -x $PYTHON ] || unset PYTHON # try 'python', if 'python3' is unavailable
# autogen calls autoreconf -vi
./autogen.sh
# Not yet:
@ -651,12 +672,13 @@ export CFLAGS CXXFLAGS FFLAGS
%if %{emu}
cd build-emu
%define arch_specific --enable-device-mapper --disable-grub-mount
TFLAGS="-fPIC"
TLFLAGS="-fPIC"
# -static is needed so that autoconf script is able to link
# test that looks for _start symbol on 64 bit platforms
../configure TARGET_LDFLAGS=$TFLAGS \
../configure TARGET_LDFLAGS=$TLFLAGS \
--prefix=%{_prefix} \
--libdir=%{_datadir} \
--sysconfdir=%{_sysconfdir} \
--target=%{_target_platform} \
--with-platform=emu \
@ -675,9 +697,9 @@ cd build-xen
../configure \
TARGET_LDFLAGS=-static \
--prefix=%{_prefix} \
--libdir=%{_datadir} \
--sysconfdir=%{_sysconfdir} \
--target=%{_target_platform} \
--libdir=%{_libdir} \
--with-platform=xen \
--program-transform-name=s,grub,%{name},
make %{?_smp_mflags}
@ -692,16 +714,16 @@ cd build-efi
../configure \
TARGET_LDFLAGS=-static \
--prefix=%{_prefix} \
--libdir=%{_datadir} \
--sysconfdir=%{_sysconfdir} \
--target=%{_target_platform} \
--libdir=%{_libdir} \
--with-platform=efi \
--program-transform-name=s,grub,%{name},
make %{?_smp_mflags}
#TODO: add efifwsetup module
FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs"
FS_MODULES="btrfs ext2 xfs jfs reiserfs"
CD_MODULES=" all_video boot cat chain configfile echo true \
efinet font gfxmenu gfxterm gzio halt iso9660 \
jpeg minicmd normal part_apple part_msdos part_gpt \
@ -721,9 +743,6 @@ GRUB_MODULES="${CD_MODULES} ${FS_MODULES} ${PXE_MODULES} ${CRYPTO_MODULES} mdrai
-d grub-core ${GRUB_MODULES}
./grub-mkimage -O %{grubefiarch} -o grub-tpm.efi --prefix= \
-d grub-core ${GRUB_MODULES} tpm
#./grub-mkimage -O %{grubefiarch} -o grub.efi -d grub-core part_gpt hfsplus fat \
# ext2 btrfs normal chain boot configfile linux appleldr minicmd \
# loadbios reboot halt search font gfxterm
%ifarch x86_64 aarch64
%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110
@ -765,12 +784,13 @@ cd build
%if %{platform} != "emu"
%define arch_specific --enable-device-mapper
TFLAGS="-static"
TLFLAGS="-static"
# -static is needed so that autoconf script is able to link
# test that looks for _start symbol on 64 bit platforms
../configure TARGET_LDFLAGS=$TFLAGS \
../configure TARGET_LDFLAGS="$TLFLAGS" \
--prefix=%{_prefix} \
--libdir=%{_datadir} \
--sysconfdir=%{_sysconfdir} \
--target=%{_target_platform} \
--with-platform=%{platform} \
@ -786,7 +806,7 @@ cd ..
%ifarch %{ix86} x86_64
cd build-xen
make DESTDIR=$RPM_BUILD_ROOT install
install -m 644 grub.xen $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubxenarch}/.
install -m 644 grub.xen $RPM_BUILD_ROOT%{_datadir}/%{name}/%{grubxenarch}/.
cd ..
%endif
@ -794,21 +814,28 @@ cd ..
cd build-efi
make DESTDIR=$RPM_BUILD_ROOT install
install -m 644 grub.efi grub-tpm.efi $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubefiarch}/.
install -m 644 grub.efi grub-tpm.efi $RPM_BUILD_ROOT%{_datadir}/%{name}/%{grubefiarch}/.
# Create grub.efi link to system efi directory
# This is for tools like kiwi not fiddling with the path
%if "%{grubefiarch}" == "x86_64-efi"
%define sysefidir %{_exec_prefix}/lib64/efi
%else
%define sysefidir %{_libdir}/efi
%endif
%define sysefibasedir %{_datadir}/efi
%define sysefidir %{sysefibasedir}/%{_target_cpu}
install -d $RPM_BUILD_ROOT%{sysefidir}
ln -sf ../../../%{_libdir}/%{name}/%{grubefiarch}/grub.efi $RPM_BUILD_ROOT%{sysefidir}/grub.efi
ln -sr $RPM_BUILD_ROOT%{_datadir}/%{name}/%{grubefiarch}/grub.efi $RPM_BUILD_ROOT%{sysefidir}/grub.efi
%ifarch x86_64
# provide compatibility sym-link for previous shim-install and the like
install -d $RPM_BUILD_ROOT/usr/lib64/efi
ln -srf $RPM_BUILD_ROOT%{_datadir}/%{name}/%{grubefiarch}/grub.efi $RPM_BUILD_ROOT/usr/lib64/efi/grub.efi
cat <<-EoM > $RPM_BUILD_ROOT/usr/lib64/efi/DEPRECATED
This directory and it's contents was moved to %{_datadir}/efi/x86_64.
Individual symbolic links are provided for a smooth transition and
may vanish at any point in time. Please use the new location!
EoM
%endif
%ifarch x86_64 aarch64
%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110
export BRP_PESIGN_FILES="%{_libdir}/%{name}/%{grubefiarch}/grub.efi %{_libdir}/%{name}/%{grubefiarch}/grub-tpm.efi"
export BRP_PESIGN_FILES="%{_datadir}/%{name}/%{grubefiarch}/grub.efi %{_datadir}/%{name}/%{grubefiarch}/grub-tpm.efi"
install -m 444 grub.der $RPM_BUILD_ROOT%{sysefidir}/
%endif
%endif
@ -822,17 +849,25 @@ make DESTDIR=$RPM_BUILD_ROOT install
cd ..
%endif
if [ -d build-emu/grub-core ]; then
if [ "%{platform}" = "emu" ]; then
# emu-lite is currently broken (and not needed), don't install!
rm -f $RPM_BUILD_ROOT%{_bindir}/%{name}-emu-lite
elif [ -d build-emu/grub-core ]; then
cd build-emu/grub-core
install -m 755 grub-emu $RPM_BUILD_ROOT%{_bindir}/%{name}-emu
install -m 755 grub-emu-lite $RPM_BUILD_ROOT%{_bindir}/%{name}-emu-lite
if false; then
# this needs to go to '-emu'-package; until that is ready, don't install!
install -m 755 grub-emu-lite $RPM_BUILD_ROOT%{_bindir}/%{name}-emu-lite
else
rm -f $RPM_BUILD_ROOT%{_bindir}/%{name}-emu-lite
fi
install -m 644 grub-emu.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}-emu.1
cd ../..
fi
# *.module files are installed with executable bits due to the way grub2 build
# system works. Clear executable bits to not confuse find-debuginfo.sh
find $RPM_BUILD_ROOT%{_libdir}/%{name} \
find $RPM_BUILD_ROOT%{_datadir}/%{name} \
\( -name '*.module' -o -name '*.image' -o -name '*.exec' \) -print0 | \
xargs --no-run-if-empty -0 chmod a-x
@ -847,7 +882,7 @@ install -d $RPM_BUILD_ROOT/boot/%{name}
touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg
# Remove devel files
rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h
rm $RPM_BUILD_ROOT/%{_datadir}/%{name}/*/*.h
%if 0%{?suse_version} >= 1140
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.h
%endif
@ -882,7 +917,7 @@ chmod 600 $R%{_sysconfdir}/default/zipl2grub.conf.in
%define dracutgrubmoddir %{dracutlibdir}/modules.d/99grub2
install -m 755 -d $R%{dracutgrubmoddir}
for f in module-setup.sh grub2.sh; do
mv $R%{_libdir}/%{name}/%{grubarch}/dracut-$f $R%{dracutgrubmoddir}/$f
mv $R%{_datadir}/%{name}/%{grubarch}/dracut-$f $R%{dracutgrubmoddir}/$f
done
rm -f $R%{_sysconfdir}/grub.d/30_os-prober
@ -908,6 +943,7 @@ perl -ni -e '
%find_lang %{name}
%fdupes %buildroot%{_bindir}
%fdupes %buildroot%{_libdir}
%fdupes %buildroot%{_datadir}
%pre
%service_add_pre grub2-once.service
@ -1019,8 +1055,8 @@ if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
# We did not add core.img to grub1 menu.lst in new update-bootloader macro as what
# the old %post ever did, then the %preun counterpart which removed the added core.img
# entry from old %post can be skipped entirely if having new macro in use.
# the old %%post ever did, then the %%preun counterpart which removed the added core.img
# entry from old %%post can be skipped entirely if having new macro in use.
%if ! 0%{?update_bootloader_posttrans:1}%{?only_efi:1}
# To check by current loader settings
if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then
@ -1077,6 +1113,17 @@ fi
%config(noreplace) %{_sysconfdir}/grub.d/41_custom
%config(noreplace) %{_sysconfdir}/grub.d/90_persistent
%config(noreplace) %{_sysconfdir}/grub.d/95_textmode
%ifarch %{ix86} x86_64
%config(noreplace) %{_sysconfdir}/grub.d/20_memtest86+
%endif
%ifarch ppc ppc64 ppc64le
%config(noreplace) %{_sysconfdir}/grub.d/20_ppc_terminfo
%endif
%ifarch s390x
%config(noreplace) %{_sysconfdir}/default/zipl2grub.conf.in
%{dracutlibdir}
%{_sbindir}/%{name}-zipl-setup
%endif
%{_sbindir}/%{name}-install
%{_sbindir}/%{name}-mkconfig
%{_sbindir}/%{name}-once
@ -1103,7 +1150,6 @@ fi
%if 0%{?has_systemd:1}
%{_unitdir}/grub2-once.service
%endif
%dir %{_libdir}/%{name}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/themes
%if 0%{?suse_version} >= 1140
@ -1134,7 +1180,7 @@ fi
%{_mandir}/man8/%{name}-reboot.8.*
%{_mandir}/man8/%{name}-set-default.8.*
%if %{emu}
%{_bindir}/%{name}-emu*
%{_bindir}/%{name}-emu
%{_mandir}/man1/%{name}-emu.1.*
%endif
%ifnarch s390x
@ -1161,54 +1207,54 @@ fi
%files %{grubarch}
%defattr(-,root,root,-)
%ifarch %{ix86} x86_64
%config(noreplace) %{_sysconfdir}/grub.d/20_memtest86+
%endif
%dir %{_libdir}/%{name}/%{grubarch}
%dir %{_datadir}/%{name}/%{grubarch}
%ifarch ppc ppc64 ppc64le
%config(noreplace) %{_sysconfdir}/grub.d/20_ppc_terminfo
# This is intentionally "grub.chrp" and not "%{name}.chrp"
%{_libdir}/%{name}/%{grubarch}/grub.chrp
%{_libdir}/%{name}/%{grubarch}/bootinfo.txt
# This is intentionally "grub.chrp" and not "%%{name}.chrp"
%{_datadir}/%{name}/%{grubarch}/grub.chrp
%{_datadir}/%{name}/%{grubarch}/bootinfo.txt
%endif
%ifnarch ppc ppc64 ppc64le s390x %{arm}
%{_libdir}/%{name}/%{grubarch}/*.image
%{_datadir}/%{name}/%{grubarch}/*.image
%endif
%{_libdir}/%{name}/%{grubarch}/*.img
%{_libdir}/%{name}/%{grubarch}/*.lst
%{_libdir}/%{name}/%{grubarch}/*.mod
%{_libdir}/%{name}/%{grubarch}/*.module
%{_datadir}/%{name}/%{grubarch}/*.img
%{_datadir}/%{name}/%{grubarch}/*.lst
%{_datadir}/%{name}/%{grubarch}/*.mod
%{_datadir}/%{name}/%{grubarch}/*.module
%ifarch x86_64
%{_libdir}/%{name}/%{grubarch}/efiemu*.o
%{_datadir}/%{name}/%{grubarch}/efiemu*.o
%endif
%{_libdir}/%{name}/%{grubarch}/gdb_grub
%{_libdir}/%{name}/%{grubarch}/gmodule.pl
%{_libdir}/%{name}/%{grubarch}/kernel.exec
%{_libdir}/%{name}/%{grubarch}/modinfo.sh
%endif
%ifarch s390x
%{_sbindir}/%{name}-zipl-setup
%config(noreplace) %{_sysconfdir}/default/zipl2grub.conf.in
%{dracutlibdir}
%{_datadir}/%{name}/%{grubarch}/gdb_grub
%{_datadir}/%{name}/%{grubarch}/gmodule.pl
%{_datadir}/%{name}/%{grubarch}/kernel.exec
%{_datadir}/%{name}/%{grubarch}/modinfo.sh
%endif
%ifarch %{efi}
%files %{grubefiarch}
%defattr(-,root,root,-)
%dir %{_libdir}/%{name}/%{grubefiarch}
%{_libdir}/%{name}/%{grubefiarch}/grub.efi
%{_libdir}/%{name}/%{grubefiarch}/grub-tpm.efi
%{_libdir}/%{name}/%{grubefiarch}/*.img
%{_libdir}/%{name}/%{grubefiarch}/*.lst
%{_libdir}/%{name}/%{grubefiarch}/*.mod
%{_libdir}/%{name}/%{grubefiarch}/*.module
%{_libdir}/%{name}/%{grubefiarch}/gdb_grub
%{_libdir}/%{name}/%{grubefiarch}/gmodule.pl
%{_libdir}/%{name}/%{grubefiarch}/kernel.exec
%{_libdir}/%{name}/%{grubefiarch}/modinfo.sh
%dir %{_datadir}/%{name}/%{grubefiarch}
%{_datadir}/%{name}/%{grubefiarch}/grub.efi
%{_datadir}/%{name}/%{grubefiarch}/grub-tpm.efi
%{_datadir}/%{name}/%{grubefiarch}/*.img
%{_datadir}/%{name}/%{grubefiarch}/*.lst
%{_datadir}/%{name}/%{grubefiarch}/*.mod
%{_datadir}/%{name}/%{grubefiarch}/*.module
%{_datadir}/%{name}/%{grubefiarch}/gdb_grub
%{_datadir}/%{name}/%{grubefiarch}/gmodule.pl
%{_datadir}/%{name}/%{grubefiarch}/kernel.exec
%{_datadir}/%{name}/%{grubefiarch}/modinfo.sh
%dir %{sysefibasedir}
%dir %{sysefidir}
%{sysefidir}/grub.efi
%if 0%{?suse_version} < 1600
%ifarch x86_64
# provide compatibility sym-link for previous shim-install and kiwi
%dir /usr/lib64/efi
/usr/lib64/efi/DEPRECATED
/usr/lib64/efi/grub.efi
%endif
%endif
%ifarch x86_64 aarch64
%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110
@ -1226,8 +1272,8 @@ fi
%ifarch %{ix86} x86_64
%files %{grubxenarch}
%dir %{_libdir}/%{name}/%{grubxenarch}
%{_libdir}/%{name}/%{grubxenarch}/*
%dir %{_datadir}/%{name}/%{grubxenarch}
%{_datadir}/%{name}/%{grubxenarch}/*
%endif
%if 0%{?has_systemd:1}