Accepting request 743951 from home:michael-chang:branches:Base:System
- Disable btrfs zstd support for i386-pc to workaround core.img too large to be embedded in btrfs bootloader area or MBR gap (boo#1154809) * 0001-btrfs-disable-zstd-support-for-i386-pc.patch OBS-URL: https://build.opensuse.org/request/show/743951 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=343
This commit is contained in:
parent
d4f499662c
commit
5d1d201c64
135
0001-btrfs-disable-zstd-support-for-i386-pc.patch
Normal file
135
0001-btrfs-disable-zstd-support-for-i386-pc.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From adf02937d4859495aab539818a116efa23505eaa Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Mon, 28 Oct 2019 05:48:11 -0400
|
||||
Subject: [PATCH] btrfs: disable zstd support for i386-pc
|
||||
|
||||
The zstd support in btrfs has dependenciy to zstd module and core.img
|
||||
grows its size significantly to 75KB on my system. The resulted image
|
||||
cannot be installed into btrfs bootloader area in the size of 64KB and
|
||||
eventually fails with following message.
|
||||
|
||||
/usr/sbin/grub-install: warning: your core.img is unusually large. It
|
||||
won't fit in the embedding area.
|
||||
/usr/sbin/grub-install: error: filesystem `btrfs' doesn't support
|
||||
blocklists.
|
||||
|
||||
The patch disabled the zstd support of btrfs in pc-bios platform to
|
||||
avoid the regression. The resulting size is 56KB, albeit a bit too close
|
||||
to the 64KB but works. This is simple workaround until a proper fix
|
||||
landed upstream.
|
||||
---
|
||||
grub-core/fs/btrfs.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
|
||||
index eed7099d8..21a7641c0 100644
|
||||
--- a/grub-core/fs/btrfs.c
|
||||
+++ b/grub-core/fs/btrfs.c
|
||||
@@ -17,6 +17,7 @@
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
/*
|
||||
* Tell zstd to expose functions that aren't part of the stable API, which
|
||||
* aren't safe to use when linking against a dynamic library. We vendor in a
|
||||
@@ -24,6 +25,7 @@
|
||||
* functions to provide our own allocator, which uses grub_malloc(), to zstd.
|
||||
*/
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
+#endif
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/file.h>
|
||||
@@ -35,7 +37,9 @@
|
||||
#include <grub/lib/crc.h>
|
||||
#include <grub/deflate.h>
|
||||
#include <minilzo.h>
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
#include <zstd.h>
|
||||
+#endif
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/btrfs.h>
|
||||
#include <grub/crypto.h>
|
||||
@@ -60,8 +64,10 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
#define GRUB_BTRFS_LZO_BLOCK_MAX_CSIZE (GRUB_BTRFS_LZO_BLOCK_SIZE + \
|
||||
(GRUB_BTRFS_LZO_BLOCK_SIZE / 16) + 64 + 3)
|
||||
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
#define ZSTD_BTRFS_MAX_WINDOWLOG 17
|
||||
#define ZSTD_BTRFS_MAX_INPUT (1 << ZSTD_BTRFS_MAX_WINDOWLOG)
|
||||
+#endif
|
||||
|
||||
typedef grub_uint8_t grub_btrfs_checksum_t[0x20];
|
||||
typedef grub_uint16_t grub_btrfs_uuid_t[8];
|
||||
@@ -244,7 +250,9 @@ struct grub_btrfs_extent_data
|
||||
#define GRUB_BTRFS_COMPRESSION_NONE 0
|
||||
#define GRUB_BTRFS_COMPRESSION_ZLIB 1
|
||||
#define GRUB_BTRFS_COMPRESSION_LZO 2
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
#define GRUB_BTRFS_COMPRESSION_ZSTD 3
|
||||
+#endif
|
||||
|
||||
#define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100
|
||||
|
||||
@@ -1372,6 +1380,7 @@ grub_btrfs_read_inode (struct grub_btrfs_data *data,
|
||||
return grub_btrfs_read_logical (data, elemaddr, inode, sizeof (*inode), 0);
|
||||
}
|
||||
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
static void *grub_zstd_malloc (void *state __attribute__((unused)), size_t size)
|
||||
{
|
||||
return grub_malloc (size);
|
||||
@@ -1461,6 +1470,7 @@ err:
|
||||
|
||||
return ret;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static grub_ssize_t
|
||||
grub_btrfs_lzo_decompress(char *ibuf, grub_size_t isize, grub_off_t off,
|
||||
@@ -1637,8 +1647,12 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
|
||||
|
||||
if (data->extent->compression != GRUB_BTRFS_COMPRESSION_NONE
|
||||
&& data->extent->compression != GRUB_BTRFS_COMPRESSION_ZLIB
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
&& data->extent->compression != GRUB_BTRFS_COMPRESSION_LZO
|
||||
&& data->extent->compression != GRUB_BTRFS_COMPRESSION_ZSTD)
|
||||
+#else
|
||||
+ && data->extent->compression != GRUB_BTRFS_COMPRESSION_LZO)
|
||||
+#endif
|
||||
{
|
||||
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"compression type 0x%x not supported",
|
||||
@@ -1678,6 +1692,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
|
||||
!= (grub_ssize_t) csize)
|
||||
return -1;
|
||||
}
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
else if (data->extent->compression == GRUB_BTRFS_COMPRESSION_ZSTD)
|
||||
{
|
||||
if (grub_btrfs_zstd_decompress (data->extent->inl, data->extsize -
|
||||
@@ -1687,6 +1702,7 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
|
||||
!= (grub_ssize_t) csize)
|
||||
return -1;
|
||||
}
|
||||
+#endif
|
||||
else
|
||||
grub_memcpy (buf, data->extent->inl + extoff, csize);
|
||||
break;
|
||||
@@ -1724,10 +1740,12 @@ grub_btrfs_extent_read (struct grub_btrfs_data *data,
|
||||
ret = grub_btrfs_lzo_decompress (tmp, zsize, extoff
|
||||
+ grub_le_to_cpu64 (data->extent->offset),
|
||||
buf, csize);
|
||||
+#ifndef GRUB_MACHINE_PCBIOS
|
||||
else if (data->extent->compression == GRUB_BTRFS_COMPRESSION_ZSTD)
|
||||
ret = grub_btrfs_zstd_decompress (tmp, zsize, extoff
|
||||
+ grub_le_to_cpu64 (data->extent->offset),
|
||||
buf, csize);
|
||||
+#endif
|
||||
else
|
||||
ret = -1;
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 30 06:26:33 UTC 2019 - Michael Chang <mchang@suse.com>
|
||||
|
||||
- Disable btrfs zstd support for i386-pc to workaround core.img too large to be
|
||||
embedded in btrfs bootloader area or MBR gap (boo#1154809)
|
||||
* 0001-btrfs-disable-zstd-support-for-i386-pc.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 28 11:52:19 UTC 2019 - Bernhard Wiedemann <bwiedemann@suse.com>
|
||||
|
||||
|
@ -233,6 +233,7 @@ Patch107: grub2-btrfs-07-subvol-fallback.patch
|
||||
Patch108: grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch
|
||||
Patch109: grub2-btrfs-09-get-default-subvolume.patch
|
||||
Patch110: grub2-btrfs-10-config-directory.patch
|
||||
Patch111: 0001-btrfs-disable-zstd-support-for-i386-pc.patch
|
||||
# Support EFI xen loader
|
||||
Patch120: grub2-efi-xen-chainload.patch
|
||||
Patch121: grub2-efi-chainloader-root.patch
|
||||
@ -515,6 +516,7 @@ swap partition while in resuming
|
||||
%patch108 -p1
|
||||
%patch109 -p1
|
||||
%patch110 -p1
|
||||
%patch111 -p1
|
||||
%patch120 -p1
|
||||
%patch121 -p1
|
||||
%patch122 -p1
|
||||
|
Loading…
Reference in New Issue
Block a user