forked from pool/grub2
Accepting request 403817 from home:michael-chang:branches:Base:System
- Fix grub2-editenv error on encrypted lvm installation (bsc#981621) * modified grub2-btrfs-workaround-grub2-once.patch - Add missing closing bracket in 'grub2-snapper-plugin.sh'. - Fix snapshot booting on s390x (bsc#955115) * modified grub2-snapper-plugin.sh - Fallback to old subvol name scheme to support old snapshot config (bsc#953538) * added grub2-btrfs-07-subvol-fallback.patch OBS-URL: https://build.opensuse.org/request/show/403817 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=221
This commit is contained in:
parent
b9810479d0
commit
79b1983d8c
46
grub2-btrfs-07-subvol-fallback.patch
Normal file
46
grub2-btrfs-07-subvol-fallback.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
Index: grub-2.02~beta3/grub-core/fs/btrfs.c
|
||||||
|
===================================================================
|
||||||
|
--- grub-2.02~beta3.orig/grub-core/fs/btrfs.c
|
||||||
|
+++ grub-2.02~beta3/grub-core/fs/btrfs.c
|
||||||
|
@@ -925,10 +925,40 @@ lookup_root_by_name(struct grub_btrfs_da
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
+lookup_root_by_name_fallback(struct grub_btrfs_data *data, const char *path)
|
||||||
|
+{
|
||||||
|
+ grub_err_t err;
|
||||||
|
+ grub_uint64_t tree = 0;
|
||||||
|
+ grub_uint8_t type;
|
||||||
|
+ struct grub_btrfs_key key;
|
||||||
|
+
|
||||||
|
+ err = find_path (data, path, &key, &tree, &type);
|
||||||
|
+ if (err)
|
||||||
|
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
|
||||||
|
+
|
||||||
|
+ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0)
|
||||||
|
+ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path);
|
||||||
|
+
|
||||||
|
+ data->fs_tree = tree;
|
||||||
|
+ return GRUB_ERR_NONE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static grub_err_t
|
||||||
|
btrfs_handle_subvol(struct grub_btrfs_data *data __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
if (btrfs_default_subvol)
|
||||||
|
- return lookup_root_by_name(data, btrfs_default_subvol);
|
||||||
|
+ {
|
||||||
|
+ grub_err_t err;
|
||||||
|
+ err = lookup_root_by_name(data, btrfs_default_subvol);
|
||||||
|
+
|
||||||
|
+ /* Fallback to old schemes */
|
||||||
|
+ if (err == GRUB_ERR_FILE_NOT_FOUND)
|
||||||
|
+ {
|
||||||
|
+ err = GRUB_ERR_NONE;
|
||||||
|
+ return lookup_root_by_name_fallback(data, btrfs_default_subvol);
|
||||||
|
+ }
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (btrfs_default_subvolid)
|
||||||
|
return lookup_root_by_id(data, btrfs_default_subvolid);
|
@ -1,7 +1,7 @@
|
|||||||
Index: grub-2.02~beta2/grub-core/kern/fs.c
|
Index: grub-2.02~beta3/grub-core/kern/fs.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- grub-2.02~beta2.orig/grub-core/kern/fs.c
|
--- grub-2.02~beta3.orig/grub-core/kern/fs.c
|
||||||
+++ grub-2.02~beta2/grub-core/kern/fs.c
|
+++ grub-2.02~beta3/grub-core/kern/fs.c
|
||||||
@@ -27,6 +27,7 @@
|
@@ -27,6 +27,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
@ -24,11 +24,11 @@ Index: grub-2.02~beta2/grub-core/kern/fs.c
|
|||||||
ret += size;
|
ret += size;
|
||||||
len -= size;
|
len -= size;
|
||||||
sector -= ((size + offset) >> GRUB_DISK_SECTOR_BITS);
|
sector -= ((size + offset) >> GRUB_DISK_SECTOR_BITS);
|
||||||
Index: grub-2.02~beta2/util/grub-editenv.c
|
Index: grub-2.02~beta3/util/grub-editenv.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- grub-2.02~beta2.orig/util/grub-editenv.c
|
--- grub-2.02~beta3.orig/util/grub-editenv.c
|
||||||
+++ grub-2.02~beta2/util/grub-editenv.c
|
+++ grub-2.02~beta3/util/grub-editenv.c
|
||||||
@@ -23,8 +23,10 @@
|
@@ -23,8 +23,11 @@
|
||||||
#include <grub/util/misc.h>
|
#include <grub/util/misc.h>
|
||||||
#include <grub/lib/envblk.h>
|
#include <grub/lib/envblk.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
@ -37,10 +37,11 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
#include <grub/util/install.h>
|
#include <grub/util/install.h>
|
||||||
+#include <grub/emu/getroot.h>
|
+#include <grub/emu/getroot.h>
|
||||||
+#include <grub/fs.h>
|
+#include <grub/fs.h>
|
||||||
|
+#include <grub/crypto.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -120,6 +122,140 @@ block, use `rm %s'."),
|
@@ -120,6 +123,140 @@ block, use `rm %s'."),
|
||||||
NULL, help_filter, NULL
|
NULL, help_filter, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
static grub_envblk_t
|
static grub_envblk_t
|
||||||
open_envblk_file (const char *name)
|
open_envblk_file (const char *name)
|
||||||
{
|
{
|
||||||
@@ -176,10 +312,17 @@ static void
|
@@ -176,10 +313,17 @@ static void
|
||||||
list_variables (const char *name)
|
list_variables (const char *name)
|
||||||
{
|
{
|
||||||
grub_envblk_t envblk;
|
grub_envblk_t envblk;
|
||||||
@ -199,7 +200,7 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -202,6 +345,38 @@ write_envblk (const char *name, grub_env
|
@@ -202,6 +346,38 @@ write_envblk (const char *name, grub_env
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -238,7 +239,7 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
set_variables (const char *name, int argc, char *argv[])
|
set_variables (const char *name, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
grub_envblk_t envblk;
|
grub_envblk_t envblk;
|
||||||
@@ -217,8 +392,26 @@ set_variables (const char *name, int arg
|
@@ -217,8 +393,26 @@ set_variables (const char *name, int arg
|
||||||
|
|
||||||
*(p++) = 0;
|
*(p++) = 0;
|
||||||
|
|
||||||
@ -267,7 +268,7 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
@@ -226,26 +419,147 @@ set_variables (const char *name, int arg
|
@@ -226,26 +420,158 @@ set_variables (const char *name, int arg
|
||||||
|
|
||||||
write_envblk (name, envblk);
|
write_envblk (name, envblk);
|
||||||
grub_envblk_close (envblk);
|
grub_envblk_close (envblk);
|
||||||
@ -319,8 +320,8 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
+ {
|
+ {
|
||||||
+ have_abstraction = 1;
|
+ have_abstraction = 1;
|
||||||
+ }
|
+ }
|
||||||
+}
|
}
|
||||||
+
|
|
||||||
+static fs_envblk_t
|
+static fs_envblk_t
|
||||||
+probe_fs_envblk (fs_envblk_spec_t spec)
|
+probe_fs_envblk (fs_envblk_spec_t spec)
|
||||||
+{
|
+{
|
||||||
@ -338,6 +339,16 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
+
|
+
|
||||||
+ grub_util_biosdisk_init (DEFAULT_DEVICE_MAP);
|
+ grub_util_biosdisk_init (DEFAULT_DEVICE_MAP);
|
||||||
+ grub_init_all ();
|
+ grub_init_all ();
|
||||||
|
+ grub_gcry_init_all ();
|
||||||
|
+
|
||||||
|
+ grub_lvm_fini ();
|
||||||
|
+ grub_mdraid09_fini ();
|
||||||
|
+ grub_mdraid1x_fini ();
|
||||||
|
+ grub_diskfilter_fini ();
|
||||||
|
+ grub_diskfilter_init ();
|
||||||
|
+ grub_mdraid09_init ();
|
||||||
|
+ grub_mdraid1x_init ();
|
||||||
|
+ grub_lvm_init ();
|
||||||
+
|
+
|
||||||
+ grub_devices = grub_guess_root_devices (DEFAULT_DIRECTORY);
|
+ grub_devices = grub_guess_root_devices (DEFAULT_DIRECTORY);
|
||||||
+
|
+
|
||||||
@ -388,6 +399,7 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
+
|
+
|
||||||
+ free (grub_drives);
|
+ free (grub_drives);
|
||||||
+ grub_device_close (grub_dev);
|
+ grub_device_close (grub_dev);
|
||||||
|
+ grub_gcry_fini_all ();
|
||||||
+ grub_fini_all ();
|
+ grub_fini_all ();
|
||||||
+ grub_util_biosdisk_fini ();
|
+ grub_util_biosdisk_fini ();
|
||||||
+
|
+
|
||||||
@ -409,13 +421,13 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
}
|
+}
|
||||||
|
+
|
||||||
+
|
+
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -277,6 +591,9 @@ main (int argc, char *argv[])
|
@@ -277,6 +603,9 @@ main (int argc, char *argv[])
|
||||||
command = argv[curindex++];
|
command = argv[curindex++];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,10 +437,10 @@ Index: grub-2.02~beta2/util/grub-editenv.c
|
|||||||
if (strcmp (command, "create") == 0)
|
if (strcmp (command, "create") == 0)
|
||||||
grub_util_create_envblk_file (filename);
|
grub_util_create_envblk_file (filename);
|
||||||
else if (strcmp (command, "list") == 0)
|
else if (strcmp (command, "list") == 0)
|
||||||
Index: grub-2.02~beta2/util/grub.d/00_header.in
|
Index: grub-2.02~beta3/util/grub.d/00_header.in
|
||||||
===================================================================
|
===================================================================
|
||||||
--- grub-2.02~beta2.orig/util/grub.d/00_header.in
|
--- grub-2.02~beta3.orig/util/grub.d/00_header.in
|
||||||
+++ grub-2.02~beta2/util/grub.d/00_header.in
|
+++ grub-2.02~beta3/util/grub.d/00_header.in
|
||||||
@@ -46,6 +46,11 @@ cat << EOF
|
@@ -46,6 +46,11 @@ cat << EOF
|
||||||
if [ -s \$prefix/grubenv ]; then
|
if [ -s \$prefix/grubenv ]; then
|
||||||
load_env
|
load_env
|
||||||
|
@ -97,13 +97,19 @@ snapshot_submenu () {
|
|||||||
title="${important}${NAME} ${VERSION} ($full_desc)"
|
title="${important}${NAME} ${VERSION} ($full_desc)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$s390" = "1"; then
|
||||||
|
subvol="\$2"
|
||||||
|
else
|
||||||
|
subvol="\$3"
|
||||||
|
fi
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
if [ -f "${snapper_snapshot_path}/$num/snapshot/boot/grub2/grub.cfg" ]; then
|
if [ -f "${snapper_snapshot_path}/$num/snapshot/boot/grub2/grub.cfg" ]; then
|
||||||
snapshot_found=true
|
snapshot_found=true
|
||||||
saved_subvol=\$btrfs_subvol
|
saved_subvol=\$btrfs_subvol
|
||||||
menuentry `print_hotkey` "$title" "${snapper_snapshot_path}/$num/snapshot" "`$grub_mkrelpath ${snapper_snapshot_path}/${num}/snapshot`" {
|
menuentry `print_hotkey` "$title" "${snapper_snapshot_path}/$num/snapshot" "`$grub_mkrelpath ${snapper_snapshot_path}/${num}/snapshot`" {
|
||||||
btrfs_subvol="\$3"
|
btrfs_subvol="$subvol"
|
||||||
extra_cmdline="rootflags=subvol=\$3"
|
extra_cmdline="rootflags=subvol=\$3"
|
||||||
export extra_cmdline
|
export extra_cmdline
|
||||||
snapshot_num=$num
|
snapshot_num=$num
|
||||||
@ -157,7 +163,7 @@ ${cs}"
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
snapshot_cfg="${snapshot_cfg}
|
snapshot_cfg="${snapshot_cfg}
|
||||||
if [ -f \"$c/${snapshot_submenu_name}\"; then
|
if [ -f \"$c/${snapshot_submenu_name}\" ]; then
|
||||||
source \"$c/${snapshot_submenu_name}\"
|
source \"$c/${snapshot_submenu_name}\"
|
||||||
fi"
|
fi"
|
||||||
done
|
done
|
||||||
@ -226,6 +232,7 @@ machine=`uname -m`
|
|||||||
case "$machine" in
|
case "$machine" in
|
||||||
(s390|s390x)
|
(s390|s390x)
|
||||||
hotkey=1
|
hotkey=1
|
||||||
|
s390=1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
cmdline="$0 $* hotkey='$hotkey'"
|
cmdline="$0 $* hotkey='$hotkey'"
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jun 21 06:19:27 UTC 2016 - mchang@suse.com
|
||||||
|
|
||||||
|
- Fix grub2-editenv error on encrypted lvm installation (bsc#981621)
|
||||||
|
* modified grub2-btrfs-workaround-grub2-once.patch
|
||||||
|
- Add missing closing bracket in 'grub2-snapper-plugin.sh'.
|
||||||
|
- Fix snapshot booting on s390x (bsc#955115)
|
||||||
|
* modified grub2-snapper-plugin.sh
|
||||||
|
- Fallback to old subvol name scheme to support old snapshot config
|
||||||
|
(bsc#953538)
|
||||||
|
* added grub2-btrfs-07-subvol-fallback.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jun 2 19:25:58 UTC 2016 - arvidjaar@gmail.com
|
Thu Jun 2 19:25:58 UTC 2016 - arvidjaar@gmail.com
|
||||||
|
|
||||||
|
@ -193,6 +193,7 @@ Patch103: grub2-btrfs-03-follow_default.patch
|
|||||||
Patch104: grub2-btrfs-04-grub2-install.patch
|
Patch104: grub2-btrfs-04-grub2-install.patch
|
||||||
Patch105: grub2-btrfs-05-grub2-mkconfig.patch
|
Patch105: grub2-btrfs-05-grub2-mkconfig.patch
|
||||||
Patch106: grub2-btrfs-06-subvol-mount.patch
|
Patch106: grub2-btrfs-06-subvol-mount.patch
|
||||||
|
Patch107: grub2-btrfs-07-subvol-fallback.patch
|
||||||
# Support EFI xen loader
|
# Support EFI xen loader
|
||||||
Patch120: grub2-efi-xen-chainload.patch
|
Patch120: grub2-efi-xen-chainload.patch
|
||||||
Patch121: grub2-efi-chainloader-root.patch
|
Patch121: grub2-efi-chainloader-root.patch
|
||||||
@ -421,6 +422,7 @@ mv po/grub.pot po/%{name}.pot
|
|||||||
%patch104 -p1
|
%patch104 -p1
|
||||||
%patch105 -p1
|
%patch105 -p1
|
||||||
%patch106 -p1
|
%patch106 -p1
|
||||||
|
%patch107 -p1
|
||||||
%patch120 -p1
|
%patch120 -p1
|
||||||
%patch121 -p1
|
%patch121 -p1
|
||||||
%patch122 -p1
|
%patch122 -p1
|
||||||
|
Loading…
Reference in New Issue
Block a user