From e8f11c7b71b81797bae025e1370e72a67b2d0d42eff758c6c7323d203061ecf8 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 22 Apr 2015 04:02:26 +0000 Subject: [PATCH 1/3] Accepting request 297069 from home:michael-chang:grub2-btrfs-mountpoint - Fix install into snapper controlled btrfs subvolume and can't load grub modules on separate subvolume (fate#318392) * added grub2-btrfs-06-btrfs-mount-subvol.patch OBS-URL: https://build.opensuse.org/request/show/297069 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=151 --- grub2-btrfs-06-btrfs-mount-subvol.patch | 507 ++++++++++++++++++++++++ grub2.changes | 7 + grub2.spec | 3 + 3 files changed, 517 insertions(+) create mode 100644 grub2-btrfs-06-btrfs-mount-subvol.patch diff --git a/grub2-btrfs-06-btrfs-mount-subvol.patch b/grub2-btrfs-06-btrfs-mount-subvol.patch new file mode 100644 index 0000000..f7d3336 --- /dev/null +++ b/grub2-btrfs-06-btrfs-mount-subvol.patch @@ -0,0 +1,507 @@ +From: Michael Chang +Subject: grub2/btrfs: Add ability to mount subvolumes in grub runtime +References: fate#318392 +Patch-Mainline: no + +At grub runtime, btrfs-mount-subvol can be used to mount a subvol to a +directory. This is needed for using path to a subvolume but wanting to access +file on the other. + +More specifically, we also have to take care of platform directory in +grub-install as it's created on a separate subvolume by design of btrfs +snapshot rollback. + +Index: grub-2.02~beta2/grub-core/fs/btrfs.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/fs/btrfs.c ++++ grub-2.02~beta2/grub-core/fs/btrfs.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -245,6 +246,12 @@ static grub_err_t + grub_btrfs_read_logical (struct grub_btrfs_data *data, + grub_disk_addr_t addr, void *buf, grub_size_t size, + int recursion_depth); ++static grub_err_t ++get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, ++ grub_uint64_t *tree, grub_uint8_t *type); ++ ++grub_uint64_t ++find_mtab_subvol_tree (const char *path, char **path_in_subvol); + + static grub_err_t + read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) +@@ -880,9 +887,20 @@ lookup_root_by_name(struct grub_btrfs_da + grub_err_t err; + grub_uint64_t tree = 0; + grub_uint8_t type; ++ grub_uint64_t saved_tree; + struct grub_btrfs_key key; + ++ err = get_root (data, &key, &tree, &type); ++ if (err) ++ return err; ++ ++ saved_tree = data->fs_tree; ++ data->fs_tree = tree; ++ + err = find_path (data, path, &key, &tree, &type); ++ ++ data->fs_tree = saved_tree; ++ + if (err) + return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); + +@@ -1751,11 +1769,20 @@ grub_btrfs_dir (grub_device_t device, co + int r = 0; + grub_uint64_t tree; + grub_uint8_t type; ++ char *new_path = NULL; + + if (!data) + return grub_errno; + +- err = find_path (data, path, &key_in, &tree, &type); ++ tree = find_mtab_subvol_tree (path, &new_path); ++ ++ if (tree) ++ data->fs_tree = tree; ++ ++ err = find_path (data, new_path ? new_path : path, &key_in, &tree, &type); ++ if (new_path) ++ grub_free (new_path); ++ + if (err) + { + grub_btrfs_unmount (data); +@@ -1857,11 +1884,21 @@ grub_btrfs_open (struct grub_file *file, + struct grub_btrfs_inode inode; + grub_uint8_t type; + struct grub_btrfs_key key_in; ++ grub_uint64_t tree; ++ char *new_path = NULL; + + if (!data) + return grub_errno; + +- err = find_path (data, name, &key_in, &data->tree, &type); ++ tree = find_mtab_subvol_tree (name, &new_path); ++ ++ if (tree) ++ data->fs_tree = tree; ++ ++ err = find_path (data, new_path ? new_path : name, &key_in, &data->tree, &type); ++ if (new_path) ++ grub_free (new_path); ++ + if (err) + { + grub_btrfs_unmount (data); +@@ -2032,6 +2069,150 @@ grub_cmd_btrfs_info (grub_command_t cmd + return 0; + } + ++struct grub_btrfs_mtab ++{ ++ struct grub_btrfs_mtab *next; ++ struct grub_btrfs_mtab **prev; ++ char *path; ++ char *subvol; ++ grub_uint64_t tree; ++}; ++ ++typedef struct grub_btrfs_mtab* grub_btrfs_mtab_t; ++ ++static struct grub_btrfs_mtab *btrfs_mtab; ++ ++#define FOR_GRUB_MTAB(var) FOR_LIST_ELEMENTS (var, btrfs_mtab) ++#define FOR_GRUB_MTAB_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), btrfs_mtab) ++ ++static void ++add_mountpoint (const char *path, const char *subvol, grub_uint64_t tree) ++{ ++ grub_btrfs_mtab_t m = grub_malloc (sizeof (*m)); ++ ++ m->path = grub_strdup (path); ++ m->subvol = grub_strdup (subvol); ++ m->tree = tree; ++ grub_list_push (GRUB_AS_LIST_P (&btrfs_mtab), GRUB_AS_LIST (m)); ++} ++ ++static grub_err_t ++grub_cmd_btrfs_mount_subvol (grub_command_t cmd __attribute__ ((unused)), int argc, ++ char **argv) ++{ ++ char *devname, *dirname, *subvol; ++ struct grub_btrfs_key key_in; ++ grub_uint8_t type; ++ grub_uint64_t tree; ++ grub_uint64_t saved_tree; ++ grub_err_t err; ++ struct grub_btrfs_data *data = NULL; ++ grub_device_t dev = NULL; ++ ++ if (argc < 3) ++ return grub_error (GRUB_ERR_BAD_ARGUMENT, "required and "); ++ ++ devname = grub_file_get_device_name(argv[0]); ++ dev = grub_device_open (devname); ++ grub_free (devname); ++ ++ if (!dev) ++ { ++ err = grub_errno; ++ goto err_out; ++ } ++ ++ dirname = argv[1]; ++ subvol = argv[2]; ++ ++ data = grub_btrfs_mount (dev); ++ if (!data) ++ { ++ err = grub_errno; ++ goto err_out; ++ } ++ ++ err = find_path (data, dirname, &key_in, &tree, &type); ++ if (err) ++ goto err_out; ++ ++ if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); ++ goto err_out; ++ } ++ ++ err = get_root (data, &key_in, &tree, &type); ++ ++ if (err) ++ goto err_out; ++ ++ saved_tree = data->fs_tree; ++ data->fs_tree = tree; ++ err = find_path (data, subvol, &key_in, &tree, &type); ++ data->fs_tree = saved_tree; ++ ++ if (err) ++ goto err_out; ++ ++ if (key_in.object_id != GRUB_BTRFS_OBJECT_ID_CHUNK || tree == 0) ++ { ++ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol); ++ goto err_out; ++ } ++ ++ grub_btrfs_unmount (data); ++ grub_device_close (dev); ++ add_mountpoint (dirname, subvol, tree); ++ ++ return GRUB_ERR_NONE; ++ ++err_out: ++ ++ if (data) ++ grub_btrfs_unmount (data); ++ ++ if (dev) ++ grub_device_close (dev); ++ ++ return err; ++} ++ ++grub_uint64_t ++find_mtab_subvol_tree (const char *path, char **path_in_subvol) ++{ ++ grub_btrfs_mtab_t m, cm; ++ grub_uint64_t tree; ++ ++ if (!path || !path_in_subvol) ++ return 0; ++ ++ *path_in_subvol = NULL; ++ tree = 0; ++ cm = NULL; ++ ++ FOR_GRUB_MTAB (m) ++ { ++ if (grub_strncmp (path, m->path, grub_strlen (m->path)) == 0) ++ { ++ if (!cm) ++ cm = m; ++ else ++ if (grub_strcmp (m->path, cm->path) > 0) ++ cm = m; ++ } ++ } ++ ++ if (cm) ++ { ++ const char *s = path + grub_strlen (cm->path); ++ *path_in_subvol = (s[0] == '\0') ? grub_strdup ("/") : grub_strdup (s); ++ tree = m->tree; ++ } ++ ++ return tree; ++} ++ + static grub_err_t + get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, + grub_uint64_t objectid, grub_uint64_t offset, +@@ -2238,6 +2419,7 @@ static struct grub_fs grub_btrfs_fs = { + }; + + static grub_command_t cmd_info; ++static grub_command_t cmd_mount_subvol; + static grub_extcmd_t cmd_list_subvols; + + static char * +@@ -2301,6 +2483,9 @@ GRUB_MOD_INIT (btrfs) + cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, + "DEVICE", + "Print BtrFS info about DEVICE."); ++ cmd_mount_subvol = grub_register_command("btrfs-mount-subvol", grub_cmd_btrfs_mount_subvol, ++ "DEVICE DIRECTORY SUBVOL", ++ "Set btrfs DEVICE the DIRECTORY a mountpoint of SUBVOL."); + cmd_list_subvols = grub_register_extcmd("btrfs-list-subvols", + grub_cmd_btrfs_list_subvols, 0, + "[-p|-n] [-o var] DEVICE", +Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c ++++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c +@@ -101,6 +101,14 @@ struct btrfs_ioctl_search_key + grub_uint32_t unused[9]; + }; + ++struct btrfs_ioctl_search_header { ++ grub_uint64_t transid; ++ grub_uint64_t objectid; ++ grub_uint64_t offset; ++ grub_uint32_t type; ++ grub_uint32_t len; ++}; ++ + struct btrfs_ioctl_search_args { + struct btrfs_ioctl_search_key key; + grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key)) +@@ -366,6 +374,105 @@ get_btrfs_fs_prefix (const char *mount_p + + int use_relative_path_on_btrfs = 0; + ++static char * ++get_btrfs_subvol (const char *path) ++{ ++ struct btrfs_ioctl_ino_lookup_args args; ++ grub_uint64_t tree_id; ++ int fd = -1; ++ char *ret = NULL; ++ ++ fd = open (path, O_RDONLY); ++ ++ if (fd < 0) ++ return NULL; ++ ++ memset (&args, 0, sizeof(args)); ++ args.objectid = GRUB_BTRFS_TREE_ROOT_OBJECTID; ++ ++ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) ++ goto error; ++ ++ tree_id = args.treeid; ++ ++ while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID) ++ { ++ struct btrfs_ioctl_search_args sargs; ++ struct grub_btrfs_root_backref *br; ++ struct btrfs_ioctl_search_header *search_header; ++ char *old; ++ ++ memset (&sargs, 0, sizeof(sargs)); ++ ++ sargs.key.tree_id = 1; ++ sargs.key.min_objectid = tree_id; ++ sargs.key.max_objectid = tree_id; ++ ++ sargs.key.min_offset = 0; ++ sargs.key.max_offset = ~0ULL; ++ sargs.key.min_transid = 0; ++ sargs.key.max_transid = ~0ULL; ++ sargs.key.min_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; ++ sargs.key.max_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; ++ ++ sargs.key.nr_items = 1; ++ ++ if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) ++ goto error; ++ ++ if (sargs.key.nr_items == 0) ++ goto error; ++ ++ search_header = (struct btrfs_ioctl_search_header *)sargs.buf; ++ br = (struct grub_btrfs_root_backref *) (search_header + 1); ++ ++ tree_id = search_header->offset; ++ ++ old = ret; ++ ret = malloc (br->n + 1); ++ memcpy (ret, br->name, br->n); ++ ret[br->n] = '\0'; ++ ++ if (br->inode_id != GRUB_BTRFS_TREE_ROOT_OBJECTID) ++ { ++ char *s; ++ ++ memset(&args, 0, sizeof(args)); ++ args.treeid = search_header->offset; ++ args.objectid = br->inode_id; ++ ++ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) ++ goto error; ++ ++ s = strdup (args.name); ++ strcat (s, ret); ++ free (ret); ++ ret = s; ++ } ++ ++ if (old) ++ { ++ strcat (ret, "/"); ++ strcat (ret, old); ++ free (old); ++ } ++ } ++ ++ close (fd); ++ return ret; ++ ++error: ++ ++ if (fd >= 0) ++ close (fd); ++ if (ret) ++ free (ret); ++ ++ return NULL; ++} ++ ++void (*grub_find_root_btrfs_mount_path_hook)(const char *mount_path); ++ + char ** + grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) + { +@@ -502,12 +609,15 @@ grub_find_root_devices_from_mountinfo (c + else if (grub_strcmp (entries[i].fstype, "btrfs") == 0) + { + ret = grub_find_root_devices_from_btrfs (dir); +- fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); + if (use_relative_path_on_btrfs) + { +- if (fs_prefix) +- free (fs_prefix); + fs_prefix = xstrdup ("/"); ++ if (grub_find_root_btrfs_mount_path_hook) ++ grub_find_root_btrfs_mount_path_hook (entries[i].enc_path); ++ } ++ else ++ { ++ fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); + } + } + if (!ret) +@@ -1094,6 +1204,34 @@ grub_util_get_grub_dev_os (const char *o + return grub_dev; + } + ++ ++char * ++grub_util_get_btrfs_subvol (const char *path, char **mount_path) ++{ ++ char *mp = NULL; ++ ++ if (mount_path) ++ *mount_path = NULL; ++ ++ auto void ++ mount_path_hook (const char *m) ++ { ++ mp = strdup (m); ++ } ++ ++ grub_find_root_btrfs_mount_path_hook = mount_path_hook; ++ grub_free (grub_find_root_devices_from_mountinfo (path, NULL)); ++ grub_find_root_btrfs_mount_path_hook = NULL; ++ ++ if (!mp) ++ return NULL; ++ ++ if (mount_path) ++ *mount_path = mp; ++ ++ return get_btrfs_subvol (mp); ++} ++ + char * + grub_make_system_path_relative_to_its_root_os (const char *path) + { +Index: grub-2.02~beta2/include/grub/emu/getroot.h +=================================================================== +--- grub-2.02~beta2.orig/include/grub/emu/getroot.h ++++ grub-2.02~beta2/include/grub/emu/getroot.h +@@ -53,6 +53,11 @@ char ** + grub_find_root_devices_from_mountinfo (const char *dir, char **relroot); + #endif + ++#ifdef __linux__ ++char * ++grub_util_get_btrfs_subvol (const char *path, char **mount_path); ++#endif ++ + /* Devmapper functions provided by getroot_devmapper.c. */ + void + grub_util_pull_devmapper (const char *os_dev); +Index: grub-2.02~beta2/util/grub-install.c +=================================================================== +--- grub-2.02~beta2.orig/util/grub-install.c ++++ grub-2.02~beta2/util/grub-install.c +@@ -1347,6 +1347,34 @@ main (int argc, char *argv[]) + load_cfg_f = grub_util_fopen (load_cfg, "wb"); + have_load_cfg = 1; + fprintf (load_cfg_f, "set btrfs_relative_path='y'\n"); ++ ++#ifdef __linux__ ++ ++ char *subvol = NULL; ++ char *mount_path = NULL; ++ ++ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path); ++ ++ if (subvol && mount_path) ++ { ++ char *def_subvol; ++ ++ def_subvol = grub_util_get_btrfs_subvol ("/", NULL); ++ ++ if (def_subvol) ++ { ++ if (grub_strcmp (subvol, def_subvol) != 0) ++ fprintf (load_cfg_f, "btrfs-mount-subvol ($root) %s %s\n", mount_path, subvol); ++ free (def_subvol); ++ } ++ } ++ ++ if (subvol) ++ free (subvol); ++ if (mount_path) ++ free (mount_path); ++ ++#endif + } + + char *prefix_drive = NULL; diff --git a/grub2.changes b/grub2.changes index 7918082..31542b5 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Apr 16 04:14:54 UTC 2015 - mchang@suse.com + +- Fix install into snapper controlled btrfs subvolume and can't + load grub modules on separate subvolume (fate#318392) + * added grub2-btrfs-06-btrfs-mount-subvol.patch + ------------------------------------------------------------------- Wed Apr 15 06:02:36 UTC 2015 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index 800b096..ba24260 100644 --- a/grub2.spec +++ b/grub2.spec @@ -201,6 +201,8 @@ Patch102: grub2-btrfs-02-export-subvolume-envvars.patch Patch103: grub2-btrfs-03-follow_default.patch Patch104: grub2-btrfs-04-grub2-install.patch Patch105: grub2-btrfs-05-grub2-mkconfig.patch +Patch106: grub2-btrfs-06-btrfs-mount-subvol.patch + # PowerPC LE support Patch201: grub2-ppc64le-01-Add-Little-Endian-support-for-Power64-to-the-build.patch Patch202: grub2-ppc64le-02-Build-grub-as-O1-until-we-add-savegpr-and-restgpr-ro.patch @@ -440,6 +442,7 @@ mv po/grub.pot po/%{name}.pot %patch103 -p1 %patch104 -p1 %patch105 -p1 +%patch106 -p1 %patch201 -p1 %patch202 -p1 %patch203 -p1 From 6e3c09f9a1476935b251dd3bb4d04cfd2557cbb35c445c08969d64e47af23f65 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 22 Apr 2015 05:15:44 +0000 Subject: [PATCH 2/3] Accepting request 298383 from home:michael-chang:branches:Base:System revoke previous accepted submitrequest, sorry about making the trouble, OBS-URL: https://build.opensuse.org/request/show/298383 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=152 --- grub2-btrfs-06-btrfs-mount-subvol.patch | 507 ------------------------ grub2.changes | 7 - grub2.spec | 3 - 3 files changed, 517 deletions(-) delete mode 100644 grub2-btrfs-06-btrfs-mount-subvol.patch diff --git a/grub2-btrfs-06-btrfs-mount-subvol.patch b/grub2-btrfs-06-btrfs-mount-subvol.patch deleted file mode 100644 index f7d3336..0000000 --- a/grub2-btrfs-06-btrfs-mount-subvol.patch +++ /dev/null @@ -1,507 +0,0 @@ -From: Michael Chang -Subject: grub2/btrfs: Add ability to mount subvolumes in grub runtime -References: fate#318392 -Patch-Mainline: no - -At grub runtime, btrfs-mount-subvol can be used to mount a subvol to a -directory. This is needed for using path to a subvolume but wanting to access -file on the other. - -More specifically, we also have to take care of platform directory in -grub-install as it's created on a separate subvolume by design of btrfs -snapshot rollback. - -Index: grub-2.02~beta2/grub-core/fs/btrfs.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/fs/btrfs.c -+++ grub-2.02~beta2/grub-core/fs/btrfs.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -245,6 +246,12 @@ static grub_err_t - grub_btrfs_read_logical (struct grub_btrfs_data *data, - grub_disk_addr_t addr, void *buf, grub_size_t size, - int recursion_depth); -+static grub_err_t -+get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, -+ grub_uint64_t *tree, grub_uint8_t *type); -+ -+grub_uint64_t -+find_mtab_subvol_tree (const char *path, char **path_in_subvol); - - static grub_err_t - read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) -@@ -880,9 +887,20 @@ lookup_root_by_name(struct grub_btrfs_da - grub_err_t err; - grub_uint64_t tree = 0; - grub_uint8_t type; -+ grub_uint64_t saved_tree; - struct grub_btrfs_key key; - -+ err = get_root (data, &key, &tree, &type); -+ if (err) -+ return err; -+ -+ saved_tree = data->fs_tree; -+ data->fs_tree = tree; -+ - err = find_path (data, path, &key, &tree, &type); -+ -+ data->fs_tree = saved_tree; -+ - if (err) - return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); - -@@ -1751,11 +1769,20 @@ grub_btrfs_dir (grub_device_t device, co - int r = 0; - grub_uint64_t tree; - grub_uint8_t type; -+ char *new_path = NULL; - - if (!data) - return grub_errno; - -- err = find_path (data, path, &key_in, &tree, &type); -+ tree = find_mtab_subvol_tree (path, &new_path); -+ -+ if (tree) -+ data->fs_tree = tree; -+ -+ err = find_path (data, new_path ? new_path : path, &key_in, &tree, &type); -+ if (new_path) -+ grub_free (new_path); -+ - if (err) - { - grub_btrfs_unmount (data); -@@ -1857,11 +1884,21 @@ grub_btrfs_open (struct grub_file *file, - struct grub_btrfs_inode inode; - grub_uint8_t type; - struct grub_btrfs_key key_in; -+ grub_uint64_t tree; -+ char *new_path = NULL; - - if (!data) - return grub_errno; - -- err = find_path (data, name, &key_in, &data->tree, &type); -+ tree = find_mtab_subvol_tree (name, &new_path); -+ -+ if (tree) -+ data->fs_tree = tree; -+ -+ err = find_path (data, new_path ? new_path : name, &key_in, &data->tree, &type); -+ if (new_path) -+ grub_free (new_path); -+ - if (err) - { - grub_btrfs_unmount (data); -@@ -2032,6 +2069,150 @@ grub_cmd_btrfs_info (grub_command_t cmd - return 0; - } - -+struct grub_btrfs_mtab -+{ -+ struct grub_btrfs_mtab *next; -+ struct grub_btrfs_mtab **prev; -+ char *path; -+ char *subvol; -+ grub_uint64_t tree; -+}; -+ -+typedef struct grub_btrfs_mtab* grub_btrfs_mtab_t; -+ -+static struct grub_btrfs_mtab *btrfs_mtab; -+ -+#define FOR_GRUB_MTAB(var) FOR_LIST_ELEMENTS (var, btrfs_mtab) -+#define FOR_GRUB_MTAB_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), btrfs_mtab) -+ -+static void -+add_mountpoint (const char *path, const char *subvol, grub_uint64_t tree) -+{ -+ grub_btrfs_mtab_t m = grub_malloc (sizeof (*m)); -+ -+ m->path = grub_strdup (path); -+ m->subvol = grub_strdup (subvol); -+ m->tree = tree; -+ grub_list_push (GRUB_AS_LIST_P (&btrfs_mtab), GRUB_AS_LIST (m)); -+} -+ -+static grub_err_t -+grub_cmd_btrfs_mount_subvol (grub_command_t cmd __attribute__ ((unused)), int argc, -+ char **argv) -+{ -+ char *devname, *dirname, *subvol; -+ struct grub_btrfs_key key_in; -+ grub_uint8_t type; -+ grub_uint64_t tree; -+ grub_uint64_t saved_tree; -+ grub_err_t err; -+ struct grub_btrfs_data *data = NULL; -+ grub_device_t dev = NULL; -+ -+ if (argc < 3) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "required and "); -+ -+ devname = grub_file_get_device_name(argv[0]); -+ dev = grub_device_open (devname); -+ grub_free (devname); -+ -+ if (!dev) -+ { -+ err = grub_errno; -+ goto err_out; -+ } -+ -+ dirname = argv[1]; -+ subvol = argv[2]; -+ -+ data = grub_btrfs_mount (dev); -+ if (!data) -+ { -+ err = grub_errno; -+ goto err_out; -+ } -+ -+ err = find_path (data, dirname, &key_in, &tree, &type); -+ if (err) -+ goto err_out; -+ -+ if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) -+ { -+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); -+ goto err_out; -+ } -+ -+ err = get_root (data, &key_in, &tree, &type); -+ -+ if (err) -+ goto err_out; -+ -+ saved_tree = data->fs_tree; -+ data->fs_tree = tree; -+ err = find_path (data, subvol, &key_in, &tree, &type); -+ data->fs_tree = saved_tree; -+ -+ if (err) -+ goto err_out; -+ -+ if (key_in.object_id != GRUB_BTRFS_OBJECT_ID_CHUNK || tree == 0) -+ { -+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol); -+ goto err_out; -+ } -+ -+ grub_btrfs_unmount (data); -+ grub_device_close (dev); -+ add_mountpoint (dirname, subvol, tree); -+ -+ return GRUB_ERR_NONE; -+ -+err_out: -+ -+ if (data) -+ grub_btrfs_unmount (data); -+ -+ if (dev) -+ grub_device_close (dev); -+ -+ return err; -+} -+ -+grub_uint64_t -+find_mtab_subvol_tree (const char *path, char **path_in_subvol) -+{ -+ grub_btrfs_mtab_t m, cm; -+ grub_uint64_t tree; -+ -+ if (!path || !path_in_subvol) -+ return 0; -+ -+ *path_in_subvol = NULL; -+ tree = 0; -+ cm = NULL; -+ -+ FOR_GRUB_MTAB (m) -+ { -+ if (grub_strncmp (path, m->path, grub_strlen (m->path)) == 0) -+ { -+ if (!cm) -+ cm = m; -+ else -+ if (grub_strcmp (m->path, cm->path) > 0) -+ cm = m; -+ } -+ } -+ -+ if (cm) -+ { -+ const char *s = path + grub_strlen (cm->path); -+ *path_in_subvol = (s[0] == '\0') ? grub_strdup ("/") : grub_strdup (s); -+ tree = m->tree; -+ } -+ -+ return tree; -+} -+ - static grub_err_t - get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, - grub_uint64_t objectid, grub_uint64_t offset, -@@ -2238,6 +2419,7 @@ static struct grub_fs grub_btrfs_fs = { - }; - - static grub_command_t cmd_info; -+static grub_command_t cmd_mount_subvol; - static grub_extcmd_t cmd_list_subvols; - - static char * -@@ -2301,6 +2483,9 @@ GRUB_MOD_INIT (btrfs) - cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, - "DEVICE", - "Print BtrFS info about DEVICE."); -+ cmd_mount_subvol = grub_register_command("btrfs-mount-subvol", grub_cmd_btrfs_mount_subvol, -+ "DEVICE DIRECTORY SUBVOL", -+ "Set btrfs DEVICE the DIRECTORY a mountpoint of SUBVOL."); - cmd_list_subvols = grub_register_extcmd("btrfs-list-subvols", - grub_cmd_btrfs_list_subvols, 0, - "[-p|-n] [-o var] DEVICE", -Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c -@@ -101,6 +101,14 @@ struct btrfs_ioctl_search_key - grub_uint32_t unused[9]; - }; - -+struct btrfs_ioctl_search_header { -+ grub_uint64_t transid; -+ grub_uint64_t objectid; -+ grub_uint64_t offset; -+ grub_uint32_t type; -+ grub_uint32_t len; -+}; -+ - struct btrfs_ioctl_search_args { - struct btrfs_ioctl_search_key key; - grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key)) -@@ -366,6 +374,105 @@ get_btrfs_fs_prefix (const char *mount_p - - int use_relative_path_on_btrfs = 0; - -+static char * -+get_btrfs_subvol (const char *path) -+{ -+ struct btrfs_ioctl_ino_lookup_args args; -+ grub_uint64_t tree_id; -+ int fd = -1; -+ char *ret = NULL; -+ -+ fd = open (path, O_RDONLY); -+ -+ if (fd < 0) -+ return NULL; -+ -+ memset (&args, 0, sizeof(args)); -+ args.objectid = GRUB_BTRFS_TREE_ROOT_OBJECTID; -+ -+ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) -+ goto error; -+ -+ tree_id = args.treeid; -+ -+ while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID) -+ { -+ struct btrfs_ioctl_search_args sargs; -+ struct grub_btrfs_root_backref *br; -+ struct btrfs_ioctl_search_header *search_header; -+ char *old; -+ -+ memset (&sargs, 0, sizeof(sargs)); -+ -+ sargs.key.tree_id = 1; -+ sargs.key.min_objectid = tree_id; -+ sargs.key.max_objectid = tree_id; -+ -+ sargs.key.min_offset = 0; -+ sargs.key.max_offset = ~0ULL; -+ sargs.key.min_transid = 0; -+ sargs.key.max_transid = ~0ULL; -+ sargs.key.min_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; -+ sargs.key.max_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; -+ -+ sargs.key.nr_items = 1; -+ -+ if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) -+ goto error; -+ -+ if (sargs.key.nr_items == 0) -+ goto error; -+ -+ search_header = (struct btrfs_ioctl_search_header *)sargs.buf; -+ br = (struct grub_btrfs_root_backref *) (search_header + 1); -+ -+ tree_id = search_header->offset; -+ -+ old = ret; -+ ret = malloc (br->n + 1); -+ memcpy (ret, br->name, br->n); -+ ret[br->n] = '\0'; -+ -+ if (br->inode_id != GRUB_BTRFS_TREE_ROOT_OBJECTID) -+ { -+ char *s; -+ -+ memset(&args, 0, sizeof(args)); -+ args.treeid = search_header->offset; -+ args.objectid = br->inode_id; -+ -+ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) -+ goto error; -+ -+ s = strdup (args.name); -+ strcat (s, ret); -+ free (ret); -+ ret = s; -+ } -+ -+ if (old) -+ { -+ strcat (ret, "/"); -+ strcat (ret, old); -+ free (old); -+ } -+ } -+ -+ close (fd); -+ return ret; -+ -+error: -+ -+ if (fd >= 0) -+ close (fd); -+ if (ret) -+ free (ret); -+ -+ return NULL; -+} -+ -+void (*grub_find_root_btrfs_mount_path_hook)(const char *mount_path); -+ - char ** - grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) - { -@@ -502,12 +609,15 @@ grub_find_root_devices_from_mountinfo (c - else if (grub_strcmp (entries[i].fstype, "btrfs") == 0) - { - ret = grub_find_root_devices_from_btrfs (dir); -- fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); - if (use_relative_path_on_btrfs) - { -- if (fs_prefix) -- free (fs_prefix); - fs_prefix = xstrdup ("/"); -+ if (grub_find_root_btrfs_mount_path_hook) -+ grub_find_root_btrfs_mount_path_hook (entries[i].enc_path); -+ } -+ else -+ { -+ fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); - } - } - if (!ret) -@@ -1094,6 +1204,34 @@ grub_util_get_grub_dev_os (const char *o - return grub_dev; - } - -+ -+char * -+grub_util_get_btrfs_subvol (const char *path, char **mount_path) -+{ -+ char *mp = NULL; -+ -+ if (mount_path) -+ *mount_path = NULL; -+ -+ auto void -+ mount_path_hook (const char *m) -+ { -+ mp = strdup (m); -+ } -+ -+ grub_find_root_btrfs_mount_path_hook = mount_path_hook; -+ grub_free (grub_find_root_devices_from_mountinfo (path, NULL)); -+ grub_find_root_btrfs_mount_path_hook = NULL; -+ -+ if (!mp) -+ return NULL; -+ -+ if (mount_path) -+ *mount_path = mp; -+ -+ return get_btrfs_subvol (mp); -+} -+ - char * - grub_make_system_path_relative_to_its_root_os (const char *path) - { -Index: grub-2.02~beta2/include/grub/emu/getroot.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/getroot.h -+++ grub-2.02~beta2/include/grub/emu/getroot.h -@@ -53,6 +53,11 @@ char ** - grub_find_root_devices_from_mountinfo (const char *dir, char **relroot); - #endif - -+#ifdef __linux__ -+char * -+grub_util_get_btrfs_subvol (const char *path, char **mount_path); -+#endif -+ - /* Devmapper functions provided by getroot_devmapper.c. */ - void - grub_util_pull_devmapper (const char *os_dev); -Index: grub-2.02~beta2/util/grub-install.c -=================================================================== ---- grub-2.02~beta2.orig/util/grub-install.c -+++ grub-2.02~beta2/util/grub-install.c -@@ -1347,6 +1347,34 @@ main (int argc, char *argv[]) - load_cfg_f = grub_util_fopen (load_cfg, "wb"); - have_load_cfg = 1; - fprintf (load_cfg_f, "set btrfs_relative_path='y'\n"); -+ -+#ifdef __linux__ -+ -+ char *subvol = NULL; -+ char *mount_path = NULL; -+ -+ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path); -+ -+ if (subvol && mount_path) -+ { -+ char *def_subvol; -+ -+ def_subvol = grub_util_get_btrfs_subvol ("/", NULL); -+ -+ if (def_subvol) -+ { -+ if (grub_strcmp (subvol, def_subvol) != 0) -+ fprintf (load_cfg_f, "btrfs-mount-subvol ($root) %s %s\n", mount_path, subvol); -+ free (def_subvol); -+ } -+ } -+ -+ if (subvol) -+ free (subvol); -+ if (mount_path) -+ free (mount_path); -+ -+#endif - } - - char *prefix_drive = NULL; diff --git a/grub2.changes b/grub2.changes index 31542b5..7918082 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,10 +1,3 @@ -------------------------------------------------------------------- -Thu Apr 16 04:14:54 UTC 2015 - mchang@suse.com - -- Fix install into snapper controlled btrfs subvolume and can't - load grub modules on separate subvolume (fate#318392) - * added grub2-btrfs-06-btrfs-mount-subvol.patch - ------------------------------------------------------------------- Wed Apr 15 06:02:36 UTC 2015 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index ba24260..800b096 100644 --- a/grub2.spec +++ b/grub2.spec @@ -201,8 +201,6 @@ Patch102: grub2-btrfs-02-export-subvolume-envvars.patch Patch103: grub2-btrfs-03-follow_default.patch Patch104: grub2-btrfs-04-grub2-install.patch Patch105: grub2-btrfs-05-grub2-mkconfig.patch -Patch106: grub2-btrfs-06-btrfs-mount-subvol.patch - # PowerPC LE support Patch201: grub2-ppc64le-01-Add-Little-Endian-support-for-Power64-to-the-build.patch Patch202: grub2-ppc64le-02-Build-grub-as-O1-until-we-add-savegpr-and-restgpr-ro.patch @@ -442,7 +440,6 @@ mv po/grub.pot po/%{name}.pot %patch103 -p1 %patch104 -p1 %patch105 -p1 -%patch106 -p1 %patch201 -p1 %patch202 -p1 %patch203 -p1 From 98fc6f4774b12d29e8e6cb0bbfb59ad2a68bfbb18c97f9d49108fecad417d11f Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 29 Apr 2015 13:20:46 +0000 Subject: [PATCH 3/3] - fix grub2-mkconfig-aarch64.patch: fix arch detection broken by malformed patch rediffing OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=153 --- ...INE_LINUX_RECOVERY-for-recovery-mode.patch | 16 ++-- grub2-efi-xen-chainload.patch | 14 +-- ...x-error-terminal-gfxterm-isn-t-found.patch | 13 +-- grub2-mkconfig-aarch64.patch | 2 +- grub2-ppc-terminfo.patch | 19 ++-- ...-files-added-in-order-to-allow-s390x.patch | 91 +++++++++---------- ...2-s390x-02-kexec-module-added-to-emu.patch | 46 +++++++--- grub2-s390x-04-grub2-install.patch | 70 +++++++++----- grub2-s390x-05-grub2-mkconfig.patch | 20 ++-- grub2-secureboot-add-linuxefi.patch | 30 +++--- grub2-secureboot-chainloader.patch | 24 ++--- ...ot-use-linuxefi-on-uefi-in-os-prober.patch | 10 +- grub2.changes | 6 ++ grub2.spec | 2 +- 14 files changed, 201 insertions(+), 162 deletions(-) diff --git a/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch b/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch index 4e0f5b9..859e688 100644 --- a/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch +++ b/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch @@ -17,11 +17,11 @@ GRUB_CMDLINE_LINUX_RECOVERY. util/grub.d/10_linux.in | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) -Index: grub-2.00/util/grub-mkconfig.in +Index: grub-2.02~beta2/util/grub-mkconfig.in =================================================================== ---- grub-2.00.orig/util/grub-mkconfig.in -+++ grub-2.00/util/grub-mkconfig.in -@@ -217,7 +217,8 @@ export GRUB_DEFAULT \ +--- grub-2.02~beta2.orig/util/grub-mkconfig.in ++++ grub-2.02~beta2/util/grub-mkconfig.in +@@ -224,7 +224,8 @@ export GRUB_DEFAULT \ GRUB_ENABLE_CRYPTODISK \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ @@ -31,11 +31,11 @@ Index: grub-2.00/util/grub-mkconfig.in if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" -Index: grub-2.00/util/grub.d/10_linux.in +Index: grub-2.02~beta2/util/grub.d/10_linux.in =================================================================== ---- grub-2.00.orig/util/grub.d/10_linux.in -+++ grub-2.00/util/grub.d/10_linux.in -@@ -244,7 +244,7 @@ while [ "x$list" != "x" ] ; do +--- grub-2.02~beta2.orig/util/grub.d/10_linux.in ++++ grub-2.02~beta2/util/grub.d/10_linux.in +@@ -238,7 +238,7 @@ while [ "x$list" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" recovery \ diff --git a/grub2-efi-xen-chainload.patch b/grub2-efi-xen-chainload.patch index b88dd09..6702593 100644 --- a/grub2-efi-xen-chainload.patch +++ b/grub2-efi-xen-chainload.patch @@ -24,8 +24,10 @@ V2: util/grub.d/20_linux_xen.in | 88 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) ---- a/util/grub.d/20_linux_xen.in -+++ b/util/grub.d/20_linux_xen.in +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 @@ -21,6 +21,8 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" datarootdir="@datarootdir@" @@ -80,7 +82,7 @@ V2: linux_entry () { os="$1" -@@ -113,6 +142,40 @@ linux_entry () +@@ -118,6 +147,40 @@ linux_entry () save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/" fi @@ -121,7 +123,7 @@ V2: if [ -z "${prepare_boot_cache}" ]; then prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" fi -@@ -220,6 +283,24 @@ while [ "x${xen_list}" != "x" ] ; do +@@ -225,6 +288,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"` @@ -146,7 +148,7 @@ V2: if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -284,7 +365,6 @@ while [ "x${xen_list}" != "x" ] ; do +@@ -289,7 +370,6 @@ while [ "x${xen_list}" != "x" ] ; do if [ x"$is_top_level" != xtrue ]; then echo ' }' fi @@ -154,7 +156,7 @@ V2: done # If at least one kernel was found, then we need to -@@ -294,3 +374,7 @@ if [ x"$is_top_level" != xtrue ]; then +@@ -299,3 +379,7 @@ if [ x"$is_top_level" != xtrue ]; then fi echo "$title_correction_code" diff --git a/grub2-fix-error-terminal-gfxterm-isn-t-found.patch b/grub2-fix-error-terminal-gfxterm-isn-t-found.patch index e150f88..e9e9bd8 100644 --- a/grub2-fix-error-terminal-gfxterm-isn-t-found.patch +++ b/grub2-fix-error-terminal-gfxterm-isn-t-found.patch @@ -14,11 +14,11 @@ fixes the issue by not setting it. util/grub-mkconfig.in | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) -diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in -index f61796f..ca62e9f 100644 ---- a/util/grub-mkconfig.in -+++ b/util/grub-mkconfig.in -@@ -146,7 +146,11 @@ fi +Index: grub-2.02~beta2/util/grub-mkconfig.in +=================================================================== +--- grub-2.02~beta2.orig/util/grub-mkconfig.in ++++ grub-2.02~beta2/util/grub-mkconfig.in +@@ -150,7 +150,11 @@ fi # XXX: should this be deprecated at some point? if [ "x${GRUB_TERMINAL}" != "x" ] ; then @@ -31,6 +31,3 @@ index f61796f..ca62e9f 100644 GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}" fi --- -1.7.3.4 - diff --git a/grub2-mkconfig-aarch64.patch b/grub2-mkconfig-aarch64.patch index f8da33d..ad304aa 100644 --- a/grub2-mkconfig-aarch64.patch +++ b/grub2-mkconfig-aarch64.patch @@ -8,7 +8,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in machine=`uname -m` case "$machine" in i?86 | x86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; -+ xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; ++ aarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; s390 | s390x) klist="/boot/image-* /boot/kernel-*" ;; *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ /boot/kernel-*" ;; diff --git a/grub2-ppc-terminfo.patch b/grub2-ppc-terminfo.patch index f9768b6..066f495 100644 --- a/grub2-ppc-terminfo.patch +++ b/grub2-ppc-terminfo.patch @@ -12,11 +12,11 @@ maximum screen size so that text is not overwritten. 2 files changed, 121 insertions(+), 0 deletions(-) create mode 100644 util/grub.d/20_ppc_terminfo.in -diff --git a/Makefile.util.def b/Makefile.util.def -index c41b76e..b349758 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -423,6 +423,13 @@ script = { +Index: grub-2.02~beta2/Makefile.util.def +=================================================================== +--- grub-2.02~beta2.orig/Makefile.util.def ++++ grub-2.02~beta2/Makefile.util.def +@@ -485,6 +485,13 @@ script = { }; script = { @@ -30,11 +30,10 @@ index c41b76e..b349758 100644 name = '30_os-prober'; common = util/grub.d/30_os-prober.in; installdir = grubconf; -diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in -new file mode 100644 -index 0000000..10d6658 +Index: grub-2.02~beta2/util/grub.d/20_ppc_terminfo.in +=================================================================== --- /dev/null -+++ b/util/grub.d/20_ppc_terminfo.in ++++ grub-2.02~beta2/util/grub.d/20_ppc_terminfo.in @@ -0,0 +1,114 @@ +#! /bin/sh +set -e @@ -150,5 +149,3 @@ index 0000000..10d6658 +cat << EOF + terminfo -g ${X}x${Y} ${TERMINAL} +EOF --- -1.7.7.2 diff --git a/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch b/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch index 1535cae..9c2ebe2 100644 --- a/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch +++ b/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch @@ -21,11 +21,11 @@ Subject: [PATCH 1/3] - Changes made and files added in order to allow s390x create mode 100644 include/grub/s390x/time.h create mode 100644 include/grub/s390x/types.h -diff --git a/grub-core/kern/emu/cache_s.S b/grub-core/kern/emu/cache_s.S -index 8ca695c..83e52d6 100644 ---- a/grub-core/kern/emu/cache_s.S -+++ b/grub-core/kern/emu/cache_s.S -@@ -24,6 +24,7 @@ FUNCTION (grub_arch_sync_caches) +Index: grub-2.02~beta2/grub-core/kern/emu/cache_s.S +=================================================================== +--- grub-2.02~beta2.orig/grub-core/kern/emu/cache_s.S ++++ grub-2.02~beta2/grub-core/kern/emu/cache_s.S +@@ -9,6 +9,7 @@ #elif defined(__powerpc__) #include "../powerpc/cache.S" #elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) @@ -33,11 +33,11 @@ index 8ca695c..83e52d6 100644 #else #error "No target cpu type is defined" #endif -diff --git a/grub-core/kern/emu/lite.c b/grub-core/kern/emu/lite.c -index 947c669..4e15872 100644 ---- a/grub-core/kern/emu/lite.c -+++ b/grub-core/kern/emu/lite.c -@@ -17,6 +17,8 @@ +Index: grub-2.02~beta2/grub-core/kern/emu/lite.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/kern/emu/lite.c ++++ grub-2.02~beta2/grub-core/kern/emu/lite.c +@@ -24,6 +24,8 @@ #elif defined(__aarch64__) #include "../arm64/dl_helper.c" #include "../arm64/dl.c" @@ -46,10 +46,11 @@ index 947c669..4e15872 100644 #else #error "No target cpu type is defined" #endif -diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c ---- a/grub-core/kern/dl.c -+++ b/grub-core/kern/dl.c -@@ -229,7 +229,7 @@ +Index: grub-2.02~beta2/grub-core/kern/dl.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/kern/dl.c ++++ grub-2.02~beta2/grub-core/kern/dl.c +@@ -229,7 +229,7 @@ grub_dl_load_segments (grub_dl_t mod, co unsigned i; const Elf_Shdr *s; grub_size_t tsize = 0, talign = 1; @@ -58,7 +59,7 @@ diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c grub_size_t tramp; grub_size_t got; grub_err_t err; -@@ -245,7 +245,7 @@ +@@ -245,7 +245,7 @@ grub_dl_load_segments (grub_dl_t mod, co talign = s->sh_addralign; } @@ -67,7 +68,7 @@ diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got); if (err) return err; -@@ -308,7 +308,7 @@ +@@ -308,7 +308,7 @@ grub_dl_load_segments (grub_dl_t mod, co mod->segment = seg; } } @@ -76,11 +77,10 @@ diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN); mod->tramp = ptr; mod->trampptr = ptr; -diff --git a/grub-core/kern/s390x/dl.c b/grub-core/kern/s390x/dl.c -new file mode 100644 -index 0000000..9be5a9e +Index: grub-2.02~beta2/grub-core/kern/s390x/dl.c +=================================================================== --- /dev/null -+++ b/grub-core/kern/s390x/dl.c ++++ grub-2.02~beta2/grub-core/kern/s390x/dl.c @@ -0,0 +1,40 @@ +/* dl.c - arch-dependent part of loadable module support */ +/* @@ -122,11 +122,10 @@ index 0000000..9be5a9e + (void)(seg); + return GRUB_ERR_BUG; +} -diff --git a/grub-core/lib/s390x/setjmp.S b/grub-core/lib/s390x/setjmp.S -new file mode 100644 -index 0000000..a3ae29b +Index: grub-2.02~beta2/grub-core/lib/s390x/setjmp.S +=================================================================== --- /dev/null -+++ b/grub-core/lib/s390x/setjmp.S ++++ grub-2.02~beta2/grub-core/lib/s390x/setjmp.S @@ -0,0 +1,46 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -174,11 +173,11 @@ index 0000000..a3ae29b + lmg %r11,%r15,0(%r2) + lgr %r2,%r3 + br %r14 -diff --git a/grub-core/lib/setjmp.S b/grub-core/lib/setjmp.S -index 2e49742..0b6fb93 100644 ---- a/grub-core/lib/setjmp.S -+++ b/grub-core/lib/setjmp.S -@@ -11,6 +11,8 @@ +Index: grub-2.02~beta2/grub-core/lib/setjmp.S +=================================================================== +--- grub-2.02~beta2.orig/grub-core/lib/setjmp.S ++++ grub-2.02~beta2/grub-core/lib/setjmp.S +@@ -15,6 +15,8 @@ #include "./arm/setjmp.S" #elif defined(__aarch64__) #include "./arm64/setjmp.S" @@ -187,11 +186,11 @@ index 2e49742..0b6fb93 100644 #else #error "Unknown target cpu type" #endif -diff --git a/include/grub/cache.h b/include/grub/cache.h -index 2928305..9f8e42b 100644 ---- a/include/grub/cache.h -+++ b/include/grub/cache.h -@@ -27,7 +27,7 @@ +Index: grub-2.02~beta2/include/grub/cache.h +=================================================================== +--- grub-2.02~beta2.orig/include/grub/cache.h ++++ grub-2.02~beta2/include/grub/cache.h +@@ -23,7 +23,7 @@ #include #include @@ -200,11 +199,10 @@ index 2928305..9f8e42b 100644 static inline void grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) -diff --git a/include/grub/s390x/setjmp.h b/include/grub/s390x/setjmp.h -new file mode 100644 -index 0000000..5ed87ed +Index: grub-2.02~beta2/include/grub/s390x/setjmp.h +=================================================================== --- /dev/null -+++ b/include/grub/s390x/setjmp.h ++++ grub-2.02~beta2/include/grub/s390x/setjmp.h @@ -0,0 +1,29 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -235,11 +233,10 @@ index 0000000..5ed87ed +void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); + +#endif /* ! GRUB_SETJMP_CPU_HEADER */ -diff --git a/include/grub/s390x/time.h b/include/grub/s390x/time.h -new file mode 100644 -index 0000000..1af9274 +Index: grub-2.02~beta2/include/grub/s390x/time.h +=================================================================== --- /dev/null -+++ b/include/grub/s390x/time.h ++++ grub-2.02~beta2/include/grub/s390x/time.h @@ -0,0 +1,27 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -268,11 +265,10 @@ index 0000000..1af9274 +} + +#endif /* ! KERNEL_CPU_TIME_HEADER */ -diff --git a/include/grub/s390x/types.h b/include/grub/s390x/types.h -new file mode 100644 -index 0000000..249ca8a +Index: grub-2.02~beta2/include/grub/s390x/types.h +=================================================================== --- /dev/null -+++ b/include/grub/s390x/types.h ++++ grub-2.02~beta2/include/grub/s390x/types.h @@ -0,0 +1,32 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -306,6 +302,3 @@ index 0000000..249ca8a + + +#endif /* ! GRUB_TYPES_CPU_HEADER */ --- -1.7.12.4 - diff --git a/grub2-s390x-02-kexec-module-added-to-emu.patch b/grub2-s390x-02-kexec-module-added-to-emu.patch index 7fc6ce4..fd97f6e 100644 --- a/grub2-s390x-02-kexec-module-added-to-emu.patch +++ b/grub2-s390x-02-kexec-module-added-to-emu.patch @@ -9,8 +9,10 @@ include/grub/emu/misc.h | 3 8 files changed, 204 insertions(+), 4 deletions(-) ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def +Index: grub-2.02~beta2/grub-core/Makefile.core.def +=================================================================== +--- grub-2.02~beta2.orig/grub-core/Makefile.core.def ++++ grub-2.02~beta2/grub-core/Makefile.core.def @@ -1674,9 +1674,9 @@ module = { arm = loader/arm/linux.c; arm64 = loader/arm64/linux.c; @@ -22,8 +24,10 @@ }; module = { +Index: grub-2.02~beta2/grub-core/loader/emu/linux.c +=================================================================== --- /dev/null -+++ b/grub-core/loader/emu/linux.c ++++ grub-2.02~beta2/grub-core/loader/emu/linux.c @@ -0,0 +1,173 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -198,8 +202,10 @@ + grub_unregister_command (cmd_linux); + grub_unregister_command (cmd_initrd); +} ---- a/include/grub/emu/hostfile.h -+++ b/include/grub/emu/hostfile.h +Index: grub-2.02~beta2/include/grub/emu/hostfile.h +=================================================================== +--- grub-2.02~beta2.orig/include/grub/emu/hostfile.h ++++ grub-2.02~beta2/include/grub/emu/hostfile.h @@ -22,6 +22,7 @@ #include #include @@ -217,8 +223,10 @@ char * grub_util_path_concat (size_t n, ...); ---- a/include/grub/emu/exec.h -+++ b/include/grub/emu/exec.h +Index: grub-2.02~beta2/include/grub/emu/exec.h +=================================================================== +--- grub-2.02~beta2.orig/include/grub/emu/exec.h ++++ grub-2.02~beta2/include/grub/emu/exec.h @@ -23,6 +23,8 @@ #include @@ -237,8 +245,10 @@ int grub_util_exec_redirect (const char *const *argv, const char *stdin_file, const char *stdout_file); ---- a/grub-core/Makefile.am -+++ b/grub-core/Makefile.am +Index: grub-2.02~beta2/grub-core/Makefile.am +=================================================================== +--- grub-2.02~beta2.orig/grub-core/Makefile.am ++++ grub-2.02~beta2/grub-core/Makefile.am @@ -243,6 +243,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h @@ -247,8 +257,10 @@ if COND_GRUB_EMU_SDL KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h endif ---- a/grub-core/kern/emu/main.c -+++ b/grub-core/kern/emu/main.c +Index: grub-2.02~beta2/grub-core/kern/emu/main.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/kern/emu/main.c ++++ grub-2.02~beta2/grub-core/kern/emu/main.c @@ -95,6 +95,7 @@ static struct argp_option options[] = { N_("use GRUB files in the directory DIR [default=%s]"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, @@ -267,8 +279,10 @@ case ARGP_KEY_ARG: { ---- a/grub-core/kern/emu/misc.c -+++ b/grub-core/kern/emu/misc.c +Index: grub-2.02~beta2/grub-core/kern/emu/misc.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/kern/emu/misc.c ++++ grub-2.02~beta2/grub-core/kern/emu/misc.c @@ -38,6 +38,7 @@ #include @@ -312,8 +326,10 @@ +{ + return kexecute; +} ---- a/include/grub/emu/misc.h -+++ b/include/grub/emu/misc.h +Index: grub-2.02~beta2/include/grub/emu/misc.h +=================================================================== +--- grub-2.02~beta2.orig/include/grub/emu/misc.h ++++ grub-2.02~beta2/include/grub/emu/misc.h @@ -59,6 +59,9 @@ void EXPORT_FUNC(grub_util_warn) (const void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn)); diff --git a/grub2-s390x-04-grub2-install.patch b/grub2-s390x-04-grub2-install.patch index b2f3fc7..3145d78 100644 --- a/grub2-s390x-04-grub2-install.patch +++ b/grub2-s390x-04-grub2-install.patch @@ -58,8 +58,10 @@ V14: util/s390x/zipl2grub.pl.in | 424 +++++++++++++++++++++++++++++++++++ 13 files changed, 698 insertions(+), 4 deletions(-) ---- a/Makefile.util.def -+++ b/Makefile.util.def +Index: grub-2.02~beta2/Makefile.util.def +=================================================================== +--- grub-2.02~beta2.orig/Makefile.util.def ++++ grub-2.02~beta2/Makefile.util.def @@ -350,6 +350,7 @@ program = { ldadd = grub-core/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; @@ -148,8 +150,10 @@ V14: }; program = { ---- a/configure.ac -+++ b/configure.ac +Index: grub-2.02~beta2/configure.ac +=================================================================== +--- grub-2.02~beta2.orig/configure.ac ++++ grub-2.02~beta2/configure.ac @@ -177,9 +177,9 @@ if test x$platform != xemu ; then esac fi @@ -173,8 +177,10 @@ V14: AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def +Index: grub-2.02~beta2/grub-core/Makefile.core.def +=================================================================== +--- grub-2.02~beta2.orig/grub-core/Makefile.core.def ++++ grub-2.02~beta2/grub-core/Makefile.core.def @@ -1064,6 +1064,7 @@ module = { module = { name = videotest; @@ -229,8 +235,10 @@ V14: }; module = { ---- a/grub-core/osdep/basic/no_platform.c -+++ b/grub-core/osdep/basic/no_platform.c +Index: grub-2.02~beta2/grub-core/osdep/basic/no_platform.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/osdep/basic/no_platform.c ++++ grub-2.02~beta2/grub-core/osdep/basic/no_platform.c @@ -44,3 +44,10 @@ grub_install_sgi_setup (const char *inst { grub_util_error ("%s", _("no SGI routines are available for your platform")); @@ -242,8 +250,10 @@ V14: + grub_util_error ("%s", _("no zIPL routines are available for your platform")); +} + ---- a/grub-core/osdep/unix/platform.c -+++ b/grub-core/osdep/unix/platform.c +Index: grub-2.02~beta2/grub-core/osdep/unix/platform.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/osdep/unix/platform.c ++++ grub-2.02~beta2/grub-core/osdep/unix/platform.c @@ -233,3 +233,14 @@ grub_install_sgi_setup (const char *inst imgfile, destname, NULL }); grub_util_warn ("%s", _("You will have to set `SystemPartition' and `OSLoader' manually.")); @@ -259,8 +269,10 @@ V14: + "-z", dest, NULL })) + grub_util_error (_("`%s' failed.\n"), PACKAGE"-zipl-setup"); +} ---- a/grub-core/osdep/windows/platform.c -+++ b/grub-core/osdep/windows/platform.c +Index: grub-2.02~beta2/grub-core/osdep/windows/platform.c +=================================================================== +--- grub-2.02~beta2.orig/grub-core/osdep/windows/platform.c ++++ grub-2.02~beta2/grub-core/osdep/windows/platform.c @@ -422,3 +422,9 @@ grub_install_sgi_setup (const char *inst { grub_util_error ("%s", _("no SGI routines are available for your platform")); @@ -271,8 +283,10 @@ V14: +{ + grub_util_error ("%s", _("no zIPL routines are available for your platform")); +} ---- a/include/grub/util/install.h -+++ b/include/grub/util/install.h +Index: grub-2.02~beta2/include/grub/util/install.h +=================================================================== +--- grub-2.02~beta2.orig/include/grub/util/install.h ++++ grub-2.02~beta2/include/grub/util/install.h @@ -99,6 +99,7 @@ enum grub_install_plat GRUB_INSTALL_PLATFORM_I386_XEN, GRUB_INSTALL_PLATFORM_X86_64_XEN, @@ -291,8 +305,10 @@ V14: int grub_install_compress_gzip (const char *src, const char *dest); int ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c +Index: grub-2.02~beta2/util/grub-install-common.c +=================================================================== +--- grub-2.02~beta2.orig/util/grub-install-common.c ++++ grub-2.02~beta2/util/grub-install-common.c @@ -665,6 +665,7 @@ static struct [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, @@ -301,8 +317,10 @@ V14: }; char * ---- a/util/grub-install.c -+++ b/util/grub-install.c +Index: grub-2.02~beta2/util/grub-install.c +=================================================================== +--- grub-2.02~beta2.orig/util/grub-install.c ++++ grub-2.02~beta2/util/grub-install.c @@ -66,6 +66,7 @@ static int force_file_id = 0; static char *disk_module = NULL; static char *efidir = NULL; @@ -444,8 +462,10 @@ V14: case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: +Index: grub-2.02~beta2/util/s390x/dracut-grub2.sh.in +=================================================================== --- /dev/null -+++ b/util/s390x/dracut-grub2.sh.in ++++ grub-2.02~beta2/util/s390x/dracut-grub2.sh.in @@ -0,0 +1,106 @@ +#!/bin/sh +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- @@ -553,8 +573,10 @@ V14: + fi +fi + +Index: grub-2.02~beta2/util/s390x/dracut-module-setup.sh.in +=================================================================== --- /dev/null -+++ b/util/s390x/dracut-module-setup.sh.in ++++ grub-2.02~beta2/util/s390x/dracut-module-setup.sh.in @@ -0,0 +1,19 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- @@ -575,8 +597,10 @@ V14: + #inst_multiple grub2-emu kexec +} + +Index: grub-2.02~beta2/util/s390x/zipl2grub.conf.in +=================================================================== --- /dev/null -+++ b/util/s390x/zipl2grub.conf.in ++++ grub-2.02~beta2/util/s390x/zipl2grub.conf.in @@ -0,0 +1,26 @@ +## This is the template for '@zipldir@/config' and is subject to +## rpm's %config file handling in case of grub2-s390x-emu package update. @@ -604,8 +628,10 @@ V14: + 1 = grub2 + 2 = skip-grub2 + +Index: grub-2.02~beta2/util/s390x/zipl2grub.pl.in +=================================================================== --- /dev/null -+++ b/util/s390x/zipl2grub.pl.in ++++ grub-2.02~beta2/util/s390x/zipl2grub.pl.in @@ -0,0 +1,424 @@ +#!/usr/bin/perl +use strict; diff --git a/grub2-s390x-05-grub2-mkconfig.patch b/grub2-s390x-05-grub2-mkconfig.patch index 18dd274..0bf6b81 100644 --- a/grub2-s390x-05-grub2-mkconfig.patch +++ b/grub2-s390x-05-grub2-mkconfig.patch @@ -14,8 +14,10 @@ V4: util/grub.d/10_linux.in | 63 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 12 deletions(-) ---- a/util/grub.d/10_linux.in -+++ b/util/grub.d/10_linux.in +Index: grub-2.02~beta2/util/grub.d/10_linux.in +=================================================================== +--- grub-2.02~beta2.orig/util/grub.d/10_linux.in ++++ grub-2.02~beta2/util/grub.d/10_linux.in @@ -51,6 +51,10 @@ else LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} fi @@ -49,7 +51,7 @@ V4: linux_entry () { os="$1" -@@ -90,9 +109,11 @@ linux_entry () +@@ -96,9 +115,11 @@ linux_entry () title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" fi @@ -63,7 +65,7 @@ V4: fi if [ x$type != xrecovery ] ; then save_default_entry | grub_add_tab -@@ -115,6 +136,7 @@ linux_entry () +@@ -121,6 +142,7 @@ linux_entry () echo " insmod gzio" | sed "s/^/$submenu_indentation/" @@ -71,7 +73,7 @@ V4: if [ x$dirname = x/ ]; then if [ -z "${prepare_root_cache}" ]; then prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)" -@@ -126,6 +148,7 @@ linux_entry () +@@ -132,6 +154,7 @@ linux_entry () fi printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" fi @@ -79,7 +81,7 @@ V4: message="$(gettext_printf "Loading Linux %s ..." ${version})" if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then sed "s/^/$submenu_indentation/" << EOF -@@ -159,16 +182,17 @@ EOF +@@ -165,16 +188,17 @@ EOF } machine=`uname -m` @@ -106,7 +108,7 @@ V4: case "$machine" in i?86) GENKERNEL_ARCH="x86" ;; -@@ -178,6 +202,15 @@ case "$machine" in +@@ -184,6 +208,15 @@ case "$machine" in *) GENKERNEL_ARCH="$machine" ;; esac @@ -122,7 +124,7 @@ V4: prepare_boot_cache= prepare_root_cache= boot_device_id= -@@ -194,6 +227,11 @@ while [ "x$list" != "x" ] ; do +@@ -200,6 +233,11 @@ while [ "x$list" != "x" ] ; do basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -134,7 +136,7 @@ V4: version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" -@@ -278,7 +316,8 @@ while [ "x$list" != "x" ] ; do +@@ -284,7 +322,8 @@ while [ "x$list" != "x" ] ; do boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi # TRANSLATORS: %s is replaced with an OS name diff --git a/grub2-secureboot-add-linuxefi.patch b/grub2-secureboot-add-linuxefi.patch index 6378ccd..0b8ffda 100644 --- a/grub2-secureboot-add-linuxefi.patch +++ b/grub2-secureboot-add-linuxefi.patch @@ -15,11 +15,11 @@ Signed-off-by: Michael Chang 5 files changed, 415 insertions(+), 0 deletions(-) create mode 100644 grub-core/loader/i386/efi/linux.c -Index: grub-2.02~beta1/grub-core/Makefile.core.def +Index: grub-2.02~beta2/grub-core/Makefile.core.def =================================================================== ---- grub-2.02~beta1.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta1/grub-core/Makefile.core.def -@@ -1705,6 +1705,14 @@ module = { +--- grub-2.02~beta2.orig/grub-core/Makefile.core.def ++++ grub-2.02~beta2/grub-core/Makefile.core.def +@@ -1706,6 +1706,14 @@ module = { }; module = { @@ -34,10 +34,10 @@ Index: grub-2.02~beta1/grub-core/Makefile.core.def name = chain; efi = loader/efi/chainloader.c; i386_pc = loader/i386/pc/chainloader.c; -Index: grub-2.02~beta1/grub-core/kern/efi/mm.c +Index: grub-2.02~beta2/grub-core/kern/efi/mm.c =================================================================== ---- grub-2.02~beta1.orig/grub-core/kern/efi/mm.c -+++ grub-2.02~beta1/grub-core/kern/efi/mm.c +--- grub-2.02~beta2.orig/grub-core/kern/efi/mm.c ++++ grub-2.02~beta2/grub-core/kern/efi/mm.c @@ -49,6 +49,38 @@ static grub_efi_uintn_t finish_desc_size static grub_efi_uint32_t finish_desc_version; int grub_efi_is_finished = 0; @@ -77,10 +77,10 @@ Index: grub-2.02~beta1/grub-core/kern/efi/mm.c /* Allocate pages. Return the pointer to the first of allocated pages. */ void * grub_efi_allocate_pages (grub_efi_physical_address_t address, -Index: grub-2.02~beta1/grub-core/loader/i386/efi/linux.c +Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c =================================================================== --- /dev/null -+++ grub-2.02~beta1/grub-core/loader/i386/efi/linux.c ++++ grub-2.02~beta2/grub-core/loader/i386/efi/linux.c @@ -0,0 +1,371 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -453,10 +453,10 @@ Index: grub-2.02~beta1/grub-core/loader/i386/efi/linux.c + grub_unregister_command (cmd_linux); + grub_unregister_command (cmd_initrd); +} -Index: grub-2.02~beta1/include/grub/efi/efi.h +Index: grub-2.02~beta2/include/grub/efi/efi.h =================================================================== ---- grub-2.02~beta1.orig/include/grub/efi/efi.h -+++ grub-2.02~beta1/include/grub/efi/efi.h +--- grub-2.02~beta2.orig/include/grub/efi/efi.h ++++ grub-2.02~beta2/include/grub/efi/efi.h @@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_e void * EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address, @@ -467,10 +467,10 @@ Index: grub-2.02~beta1/include/grub/efi/efi.h void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address, grub_efi_uintn_t pages); int -Index: grub-2.02~beta1/include/grub/i386/linux.h +Index: grub-2.02~beta2/include/grub/i386/linux.h =================================================================== ---- grub-2.02~beta1.orig/include/grub/i386/linux.h -+++ grub-2.02~beta1/include/grub/i386/linux.h +--- grub-2.02~beta2.orig/include/grub/i386/linux.h ++++ grub-2.02~beta2/include/grub/i386/linux.h @@ -139,6 +139,7 @@ struct linux_kernel_header grub_uint64_t setup_data; grub_uint64_t pref_address; diff --git a/grub2-secureboot-chainloader.patch b/grub2-secureboot-chainloader.patch index c0e2a14..ab3d694 100644 --- a/grub2-secureboot-chainloader.patch +++ b/grub2-secureboot-chainloader.patch @@ -21,10 +21,10 @@ Signed-off-by: Michael Chang grub-core/loader/efi/chainloader.c | 538 +++++++++++++++++++++++++++++++++-- 1 files changed, 507 insertions(+), 31 deletions(-) -Index: grub-2.00/grub-core/loader/efi/chainloader.c +Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c =================================================================== ---- grub-2.00.orig/grub-core/loader/efi/chainloader.c -+++ grub-2.00/grub-core/loader/efi/chainloader.c +--- grub-2.02~beta2.orig/grub-core/loader/efi/chainloader.c ++++ grub-2.02~beta2/grub-core/loader/efi/chainloader.c @@ -40,15 +40,31 @@ #include #endif @@ -65,7 +65,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c grub_dl_unref (my_mod); return GRUB_ERR_NONE; -@@ -190,12 +207,460 @@ make_file_path (grub_efi_device_path_t * +@@ -187,12 +204,460 @@ make_file_path (grub_efi_device_path_t * return file_path; } @@ -527,7 +527,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c grub_efi_status_t status; grub_efi_boot_services_t *b; grub_device_t dev = 0; -@@ -203,7 +668,6 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -200,7 +665,6 @@ grub_cmd_chainloader (grub_command_t cmd grub_efi_loaded_image_t *loaded_image; char *filename; void *boot_image = 0; @@ -535,7 +535,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -215,9 +679,36 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -212,9 +676,36 @@ grub_cmd_chainloader (grub_command_t cmd address = 0; image_handle = 0; file_path = 0; @@ -572,7 +572,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c file = grub_file_open (filename); if (! file) goto fail; -@@ -263,14 +754,14 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -260,14 +751,14 @@ grub_cmd_chainloader (grub_command_t cmd grub_printf ("file path: "); grub_efi_print_device_path (file_path); @@ -590,7 +590,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -284,7 +775,7 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -281,7 +772,7 @@ grub_cmd_chainloader (grub_command_t cmd } boot_image = (void *) ((grub_addr_t) address); @@ -599,7 +599,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -294,7 +785,7 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -291,7 +782,7 @@ grub_cmd_chainloader (grub_command_t cmd } #if defined (__i386__) || defined (__x86_64__) @@ -608,7 +608,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -317,20 +808,30 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -314,20 +805,30 @@ grub_cmd_chainloader (grub_command_t cmd > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -642,7 +642,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c &image_handle); if (status != GRUB_EFI_SUCCESS) { -@@ -355,33 +856,10 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -352,33 +853,10 @@ grub_cmd_chainloader (grub_command_t cmd grub_file_close (file); @@ -678,7 +678,7 @@ Index: grub-2.00/grub-core/loader/efi/chainloader.c } grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); -@@ -400,6 +878,9 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -397,6 +875,9 @@ grub_cmd_chainloader (grub_command_t cmd if (address) efi_call_2 (b->free_pages, address, pages); diff --git a/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch b/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch index 67e8afa..8f073e4 100644 --- a/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch +++ b/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch @@ -4,10 +4,10 @@ Reference: bnc#810912 Emit linuxefi/initrdefi for os-prober detected Linux installations if secure boot is enabled. -Index: grub-2.00/util/grub.d/30_os-prober.in +Index: grub-2.02~beta2/util/grub.d/30_os-prober.in =================================================================== ---- grub-2.00.orig/util/grub.d/30_os-prober.in -+++ grub-2.00/util/grub.d/30_os-prober.in +--- grub-2.02~beta2.orig/util/grub.d/30_os-prober.in ++++ grub-2.02~beta2/util/grub.d/30_os-prober.in @@ -41,6 +41,15 @@ if [ -z "${OSPROBED}" ] ; then exit 0 fi @@ -24,7 +24,7 @@ Index: grub-2.00/util/grub.d/30_os-prober.in osx_entry() { if [ x$2 = x32 ]; then # TRANSLATORS: it refers to kernel architecture (32-bit) -@@ -216,11 +225,11 @@ EOF +@@ -234,11 +243,11 @@ EOF save_default_entry | grub_add_tab printf '%s\n' "${prepare_boot_cache}" cat << EOF @@ -38,7 +38,7 @@ Index: grub-2.00/util/grub.d/30_os-prober.in EOF fi cat << EOF -@@ -236,11 +245,11 @@ EOF +@@ -254,11 +263,11 @@ EOF save_default_entry | sed -e "s/^/$grub_tab$grub_tab/" printf '%s\n' "${prepare_boot_cache}" | grub_add_tab cat << EOF diff --git a/grub2.changes b/grub2.changes index 7918082..8c02419 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 29 13:20:20 UTC 2015 - dmueller@suse.com + +- fix grub2-mkconfig-aarch64.patch: fix arch detection broken + by malformed patch rediffing + ------------------------------------------------------------------- Wed Apr 15 06:02:36 UTC 2015 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index 800b096..1b773fb 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,7 +1,7 @@ # # spec file for package grub2 # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 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