forked from pool/grub2
Accepting request 311115 from home:michael-chang:branches:Base:System
- Fix btrfs patch on BigEndian systems (bsc#933541) * modified grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch * modified grub2-btrfs-06-subvol-mount.patch OBS-URL: https://build.opensuse.org/request/show/311115 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=164
This commit is contained in:
parent
ed9d76e999
commit
47bb4fa7dc
@ -21,10 +21,10 @@ Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
|||||||
grub-core/fs/btrfs.c | 529 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
grub-core/fs/btrfs.c | 529 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
1 file changed, 518 insertions(+), 11 deletions(-)
|
1 file changed, 518 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
Index: grub-2.00/grub-core/fs/btrfs.c
|
Index: grub-2.02~beta2/grub-core/fs/btrfs.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- grub-2.00.orig/grub-core/fs/btrfs.c
|
--- grub-2.02~beta2.orig/grub-core/fs/btrfs.c
|
||||||
+++ grub-2.00/grub-core/fs/btrfs.c
|
+++ grub-2.02~beta2/grub-core/fs/btrfs.c
|
||||||
@@ -29,6 +29,9 @@
|
@@ -29,6 +29,9 @@
|
||||||
#include <minilzo.h>
|
#include <minilzo.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
@ -125,7 +125,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
+ if (err)
|
+ if (err)
|
||||||
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
|
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
|
||||||
+
|
+
|
||||||
+ if (key.object_id != GRUB_BTRFS_OBJECT_ID_CHUNK || tree == 0)
|
+ 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);
|
+ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path);
|
||||||
+
|
+
|
||||||
+ data->fs_tree = tree;
|
+ data->fs_tree = tree;
|
||||||
@ -164,7 +164,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1216,6 +1301,91 @@ get_root (struct grub_btrfs_data *data,
|
@@ -1226,6 +1311,91 @@ get_root (struct grub_btrfs_data *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
@ -217,21 +217,21 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
+ if (err)
|
+ if (err)
|
||||||
+ return grub_error(err, "read_logical caught %d\n", err);
|
+ return grub_error(err, "read_logical caught %d\n", err);
|
||||||
+
|
+
|
||||||
+ alloc += inode_ref->n + 2;
|
+ alloc += grub_le_to_cpu16 (inode_ref->n) + 2;
|
||||||
+ new = grub_malloc(alloc);
|
+ new = grub_malloc(alloc);
|
||||||
+ if (!new)
|
+ if (!new)
|
||||||
+ return grub_error(GRUB_ERR_OUT_OF_MEMORY,
|
+ return grub_error(GRUB_ERR_OUT_OF_MEMORY,
|
||||||
+ "couldn't allocate memory for name (%"PRIuGRUB_SIZE")\n", alloc);
|
+ "couldn't allocate memory for name (%"PRIuGRUB_SIZE")\n", alloc);
|
||||||
+
|
+
|
||||||
+ grub_memcpy(new, inode_ref->name, inode_ref->n);
|
+ grub_memcpy(new, inode_ref->name, grub_le_to_cpu16 (inode_ref->n));
|
||||||
+ if (p)
|
+ if (p)
|
||||||
+ {
|
+ {
|
||||||
+ new[inode_ref->n] = '/';
|
+ new[grub_le_to_cpu16 (inode_ref->n)] = '/';
|
||||||
+ grub_strcpy (new + inode_ref->n + 1, p);
|
+ grub_strcpy (new + grub_le_to_cpu16 (inode_ref->n) + 1, p);
|
||||||
+ grub_free(p);
|
+ grub_free(p);
|
||||||
+ }
|
+ }
|
||||||
+ else
|
+ else
|
||||||
+ new[inode_ref->n] = 0;
|
+ new[grub_le_to_cpu16 (inode_ref->n)] = 0;
|
||||||
+ grub_free(inode_ref);
|
+ grub_free(inode_ref);
|
||||||
+
|
+
|
||||||
+ p = new;
|
+ p = new;
|
||||||
@ -256,7 +256,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
find_path (struct grub_btrfs_data *data,
|
find_path (struct grub_btrfs_data *data,
|
||||||
const char *path, struct grub_btrfs_key *key,
|
const char *path, struct grub_btrfs_key *key,
|
||||||
grub_uint64_t *tree, grub_uint8_t *type)
|
grub_uint64_t *tree, grub_uint8_t *type)
|
||||||
@@ -1233,14 +1403,26 @@ find_path (struct grub_btrfs_data *data,
|
@@ -1243,14 +1413,26 @@ find_path (struct grub_btrfs_data *data,
|
||||||
char *origpath = NULL;
|
char *origpath = NULL;
|
||||||
unsigned symlinks_max = 32;
|
unsigned symlinks_max = 32;
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
while (path[0] == '/')
|
while (path[0] == '/')
|
||||||
@@ -1413,9 +1595,21 @@ find_path (struct grub_btrfs_data *data,
|
@@ -1423,9 +1605,21 @@ find_path (struct grub_btrfs_data *data,
|
||||||
path = path_alloc = tmp;
|
path = path_alloc = tmp;
|
||||||
if (path[0] == '/')
|
if (path[0] == '/')
|
||||||
{
|
{
|
||||||
@ -312,7 +312,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1656,6 +1850,20 @@ grub_btrfs_read (grub_file_t file, char
|
@@ -1666,6 +1860,20 @@ grub_btrfs_read (grub_file_t file, char
|
||||||
data->tree, file->offset, buf, len);
|
data->tree, file->offset, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_btrfs_uuid (grub_device_t device, char **uuid)
|
grub_btrfs_uuid (grub_device_t device, char **uuid)
|
||||||
{
|
{
|
||||||
@@ -1667,15 +1875,7 @@ grub_btrfs_uuid (grub_device_t device, c
|
@@ -1677,15 +1885,7 @@ grub_btrfs_uuid (grub_device_t device, c
|
||||||
if (!data)
|
if (!data)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
@ -350,7 +350,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
|
|
||||||
grub_btrfs_unmount (data);
|
grub_btrfs_unmount (data);
|
||||||
|
|
||||||
@@ -1732,6 +1932,242 @@ grub_btrfs_embed (grub_device_t device _
|
@@ -1742,6 +1942,242 @@ grub_btrfs_embed (grub_device_t device _
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
+ char *devname;
|
+ char *devname;
|
||||||
+ grub_uint64_t tree;
|
+ grub_uint64_t tree;
|
||||||
+ struct grub_btrfs_key key_in = {
|
+ struct grub_btrfs_key key_in = {
|
||||||
+ .object_id = grub_cpu_to_le64(GRUB_BTRFS_FS_TREE_OBJECTID),
|
+ .object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID),
|
||||||
+ .type = GRUB_BTRFS_ROOT_REF_KEY,
|
+ .type = GRUB_BTRFS_ROOT_REF_KEY,
|
||||||
+ .offset = 0,
|
+ .offset = 0,
|
||||||
+ }, key_out;
|
+ }, key_out;
|
||||||
@ -492,8 +492,8 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
+ if (!data)
|
+ if (!data)
|
||||||
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "could not open device");
|
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "could not open device");
|
||||||
+
|
+
|
||||||
+ tree = grub_le_to_cpu64(data->sblock.root_tree);
|
+ tree = data->sblock.root_tree;
|
||||||
+ err = get_fs_root(data, tree, grub_cpu_to_le64(GRUB_BTRFS_FS_TREE_OBJECTID),
|
+ err = get_fs_root(data, tree, grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID),
|
||||||
+ 0, &fs_root);
|
+ 0, &fs_root);
|
||||||
+ if (err)
|
+ if (err)
|
||||||
+ goto out;
|
+ goto out;
|
||||||
@ -593,7 +593,7 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
static struct grub_fs grub_btrfs_fs = {
|
static struct grub_fs grub_btrfs_fs = {
|
||||||
.name = "btrfs",
|
.name = "btrfs",
|
||||||
.dir = grub_btrfs_dir,
|
.dir = grub_btrfs_dir,
|
||||||
@@ -1747,12 +2183,88 @@ static struct grub_fs grub_btrfs_fs = {
|
@@ -1757,12 +2193,88 @@ static struct grub_fs grub_btrfs_fs = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -682,10 +682,10 @@ Index: grub-2.00/grub-core/fs/btrfs.c
|
|||||||
}
|
}
|
||||||
+
|
+
|
||||||
+// vim: si et sw=2:
|
+// vim: si et sw=2:
|
||||||
Index: grub-2.00/include/grub/btrfs.h
|
Index: grub-2.02~beta2/include/grub/btrfs.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- grub-2.00.orig/include/grub/btrfs.h
|
--- grub-2.02~beta2.orig/include/grub/btrfs.h
|
||||||
+++ grub-2.00/include/grub/btrfs.h
|
+++ grub-2.02~beta2/include/grub/btrfs.h
|
||||||
@@ -29,6 +29,7 @@ enum
|
@@ -29,6 +29,7 @@ enum
|
||||||
GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84,
|
GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84,
|
||||||
GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF = 0x90,
|
GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF = 0x90,
|
||||||
|
@ -185,7 +185,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c
|
|||||||
+ if (err)
|
+ if (err)
|
||||||
+ goto err_out;
|
+ goto err_out;
|
||||||
+
|
+
|
||||||
+ if (key_in.object_id != GRUB_BTRFS_OBJECT_ID_CHUNK || tree == 0)
|
+ if (key_in.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0)
|
||||||
+ {
|
+ {
|
||||||
+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol);
|
+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol);
|
||||||
+ goto err_out;
|
+ goto err_out;
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jun 5 03:46:33 UTC 2015 - mchang@suse.com
|
||||||
|
|
||||||
|
- Fix btrfs patch on BigEndian systems (bsc#933541)
|
||||||
|
* modified grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
|
||||||
|
* modified grub2-btrfs-06-subvol-mount.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jun 3 20:07:33 UTC 2015 - agraf@suse.com
|
Wed Jun 3 20:07:33 UTC 2015 - agraf@suse.com
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package grub2
|
# spec file for package grub2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
Loading…
Reference in New Issue
Block a user