Skip to content

Commit

Permalink
version 1.3
Browse files Browse the repository at this point in the history
* Fix F2FS packing bug and other potential issues linked to packing
  • Loading branch information
pbatard committed Apr 25, 2018
1 parent eb5e1b0 commit fc762f0
Show file tree
Hide file tree
Showing 45 changed files with 190 additions and 73 deletions.
166 changes: 138 additions & 28 deletions 0000-GRUB-fixes-for-MSVC.patch
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
From 4be36971af43b4ce24d73338deecb6b8508745d0 Mon Sep 17 00:00:00 2001
From aa95de270929a8932884cff75d54f9347bdd76bd Mon Sep 17 00:00:00 2001
From: Pete Batard <[email protected]>
Date: Wed, 11 Apr 2018 11:22:40 +1000
Date: Tue, 24 Apr 2018 00:55:25 +0100
Subject: [PATCH] GRUB fixes for MSVC

---
grub-core/fs/affs.c | 2 ++
grub-core/fs/bfs.c | 2 ++
grub-core/fs/btrfs.c | 16 ++++++++++-----
grub-core/fs/fat.c | 8 ++++++--
grub-core/fs/btrfs.c | 16 +++++++++-----
grub-core/fs/f2fs.c | 2 ++
grub-core/fs/fat.c | 8 +++++--
grub-core/fs/hfs.c | 6 ++++++
grub-core/fs/hfsplus.c | 2 ++
grub-core/fs/hfspluscomp.c | 5 +++++
grub-core/fs/iso9660.c | 36 ++++++++++++++++++++++-----------
grub-core/fs/iso9660.c | 36 ++++++++++++++++++++-----------
grub-core/fs/jfs.c | 2 ++
grub-core/fs/nilfs2.c | 4 +++-
grub-core/fs/ntfs.c | 2 ++
grub-core/fs/reiserfs.c | 16 ++++++++++++++-
grub-core/fs/reiserfs.c | 16 +++++++++++++-
grub-core/fs/sfs.c | 4 +++-
grub-core/fs/udf.c | 2 ++
grub-core/fs/ufs.c | 2 ++
grub-core/fs/xfs.c | 3 +++
grub-core/fs/xfs.c | 2 ++
grub-core/fs/zfs/zfs.c | 4 ++--
grub-core/fs/zfs/zfs_lz4.c | 2 ++
grub-core/kern/misc.c | 6 +++---
grub-core/lib/minilzo/lzodefs.h | 3 +++
include/grub/arm64/types.h | 4 ++++
include/grub/btrfs.h | 3 +++
include/grub/exfat.h | 2 ++
include/grub/fat.h | 2 ++
include/grub/hfs.h | 2 ++
include/grub/hfsplus.h | 6 ++++++
include/grub/misc.h | 10 +++++++++
include/grub/ntfs.h | 2 ++
include/grub/term.h | 4 ++--
include/grub/types.h | 36 +++++++++++++++++++++++----------
include/grub/types.h | 38 +++++++++++++++++++++++----------
include/grub/unicode.h | 2 ++
include/grub/x86_64/types.h | 2 +-
include/grub/zfs/zap_leaf.h | 17 +++++++++++++---
include/grub/zfs/zap_leaf.h | 17 ++++++++++++---
include/grub/zfs/zio.h | 2 ++
30 files changed, 169 insertions(+), 44 deletions(-)
35 files changed, 180 insertions(+), 44 deletions(-)

diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c
index f673897e0..84247ca9f 100644
Expand Down Expand Up @@ -77,7 +82,7 @@ index d2b490bce..8d78fd6c2 100644
struct grub_bfs_data
{
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index be195448d..ba8c3c77d 100644
index be195448d..65ceda7da 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -48,6 +48,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
Expand Down Expand Up @@ -112,14 +117,14 @@ index be195448d..ba8c3c77d 100644

struct grub_btrfs_leaf_descriptor
{
@@ -177,6 +181,7 @@ struct grub_btrfs_time
grub_uint32_t nanosec;
} GRUB_PACKED;
@@ -171,6 +175,7 @@ struct grub_btrfs_leaf_descriptor
} *data;
};

+PRAGMA_BEGIN_PACKED
struct grub_btrfs_inode
struct grub_btrfs_time
{
grub_uint8_t dummy1[0x10];
grub_int64_t sec;
@@ -205,6 +210,7 @@ struct grub_btrfs_extent_data
};
};
Expand Down Expand Up @@ -164,6 +169,26 @@ index be195448d..ba8c3c77d 100644
&stripen);
stripen *= nsubstripes;
redundancy = nsubstripes;
diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c
index 1cad2615f..35c822ce0 100644
--- a/grub-core/fs/f2fs.c
+++ b/grub-core/fs/f2fs.c
@@ -131,6 +131,7 @@ enum FILE_TYPE
F2FS_FT_SYMLINK = 7
};

+PRAGMA_BEGIN_PACKED
struct grub_f2fs_superblock
{
grub_uint32_t magic;
@@ -281,6 +282,7 @@ struct grub_f2fs_node
};
grub_uint8_t dummy[40];
} GRUB_PACKED;
+PRAGMA_END_PACKED

struct grub_fshelp_node
{
diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c
index 8d8dc35ce..f3b571760 100644
--- a/grub-core/fs/fat.c
Expand Down Expand Up @@ -623,26 +648,18 @@ index 293f027aa..3babbce5f 100644
/* Information about a "mounted" ufs filesystem. */
struct grub_ufs_data
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
index c6031bd3f..98bd44d07 100644
index c6031bd3f..373deb146 100644
--- a/grub-core/fs/xfs.c
+++ b/grub-core/fs/xfs.c
@@ -59,6 +59,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
XFS_SB_VERSION_DIRV2BIT | \
XFS_SB_VERSION_MOREBITSBIT)

+PRAGMA_BEGIN_PACKED
/* Recognized xfs format versions */
#define XFS_SB_VERSION_4 4 /* Good old XFS filesystem */
#define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */
@@ -84,6 +85,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
@@ -84,6 +84,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
(XFS_SB_FEAT_INCOMPAT_FTYPE | \
XFS_SB_FEAT_INCOMPAT_META_UUID)

+PRAGMA_BEGIN_PACKED
struct grub_xfs_sblock
{
grub_uint8_t magic[4];
@@ -200,6 +202,7 @@ struct grub_xfs_dirblock_tail
@@ -200,6 +201,7 @@ struct grub_xfs_dirblock_tail
grub_uint32_t leaf_count;
grub_uint32_t leaf_stale;
} GRUB_PACKED;
Expand Down Expand Up @@ -672,6 +689,26 @@ index 6e1fff9e9..b1589a031 100644
chunk != CHAIN_END; chunk = grub_zfs_to_cpu16 (le->le_next, endian))
{

diff --git a/grub-core/fs/zfs/zfs_lz4.c b/grub-core/fs/zfs/zfs_lz4.c
index 5453822d0..873445803 100644
--- a/grub-core/fs/zfs/zfs_lz4.c
+++ b/grub-core/fs/zfs/zfs_lz4.c
@@ -74,6 +74,7 @@ static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
#define S32 grub_int32_t
#define U64 grub_uint64_t

+PRAGMA_BEGIN_PACKED
typedef struct _U16_S {
U16 v;
} GRUB_PACKED U16_S;
@@ -83,6 +84,7 @@ typedef struct _U32_S {
typedef struct _U64_S {
U64 v;
} GRUB_PACKED U64_S;
+PRAGMA_END_PACKED

#define A64(x) (((U64_S *)(x))->v)
#define A32(x) (((U32_S *)(x))->v)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 3b633d51f..1eed48883 100644
--- a/grub-core/kern/misc.c
Expand Down Expand Up @@ -760,6 +797,46 @@ index 9d93fb6c1..f62312c04 100644


struct grub_btrfs_root_backref
diff --git a/include/grub/exfat.h b/include/grub/exfat.h
index 2b8009cee..b7654d0aa 100644
--- a/include/grub/exfat.h
+++ b/include/grub/exfat.h
@@ -21,6 +21,7 @@

#include <grub/types.h>

+PRAGMA_BEGIN_PACKED
struct grub_exfat_bpb
{
grub_uint8_t jmp_boot[3];
@@ -42,6 +43,7 @@ struct grub_exfat_bpb
grub_uint8_t num_ph_drive;
grub_uint8_t reserved[8];
} GRUB_PACKED;
+PRAGMA_END_PACKED

#ifdef GRUB_UTIL
#include <grub/disk.h>
diff --git a/include/grub/fat.h b/include/grub/fat.h
index 8d7e4a1e5..bf4441479 100644
--- a/include/grub/fat.h
+++ b/include/grub/fat.h
@@ -21,6 +21,7 @@

#include <grub/types.h>

+PRAGMA_BEGIN_PACKED
struct grub_fat_bpb
{
grub_uint8_t jmp_boot[3];
@@ -66,6 +67,7 @@ struct grub_fat_bpb
} GRUB_PACKED fat32;
} GRUB_PACKED version_specific;
} GRUB_PACKED;
+PRAGMA_END_PACKED

#ifdef GRUB_UTIL
#include <grub/disk.h>
diff --git a/include/grub/hfs.h b/include/grub/hfs.h
index d935f5005..beeca5df5 100644
--- a/include/grub/hfs.h
Expand Down Expand Up @@ -898,7 +975,7 @@ index 8117e2a24..f87c0d022 100644

static inline struct grub_term_coordinate
diff --git a/include/grub/types.h b/include/grub/types.h
index b93e48201..395a3bf0d 100644
index b93e48201..63ba96426 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -26,10 +26,20 @@
Expand Down Expand Up @@ -974,6 +1051,39 @@ index b93e48201..395a3bf0d 100644

typedef struct grub_unaligned_uint16 grub_unaligned_uint16_t;
typedef struct grub_unaligned_uint32 grub_unaligned_uint32_t;
@@ -306,10 +320,12 @@ static inline grub_uint64_t grub_get_unaligned64 (const void *ptr)

static inline void grub_set_unaligned64 (void *ptr, grub_uint64_t val)
{
+ PRAGMA_BEGIN_PACKED
struct grub_unaligned_uint64_t
{
grub_uint64_t d;
} GRUB_PACKED;
+ PRAGMA_END_PACKED
struct grub_unaligned_uint64_t *dd = (struct grub_unaligned_uint64_t *) ptr;
dd->d = val;
}
diff --git a/include/grub/unicode.h b/include/grub/unicode.h
index a0403e91f..5984982fe 100644
--- a/include/grub/unicode.h
+++ b/include/grub/unicode.h
@@ -29,6 +29,7 @@ struct grub_unicode_bidi_pair
grub_uint32_t replace;
};

+PRAGMA_BEGIN_PACKED
struct grub_unicode_compact_range
{
unsigned start:21;
@@ -38,6 +39,7 @@ struct grub_unicode_compact_range
unsigned bidi_mirror:1;
unsigned join_type:3;
} GRUB_PACKED;
+PRAGMA_END_PACKED

/* Old-style Arabic shaping. Used for "visual UTF-8" and
in grub-mkfont to find variant glyphs in absence of GPOS tables. */
diff --git a/include/grub/x86_64/types.h b/include/grub/x86_64/types.h
index 0bbdc6d01..eefa80847 100644
--- a/include/grub/x86_64/types.h
Expand Down
6 changes: 6 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
For detailed information about the changes below, please see the git log or
visit: https://github.com/pbatard/efifs

v1.3 (2018.04.25)
* Fix F2FS driver bug (MSVC only) that was introduced in v1.2
* Remove custom EDK2 patches for VS2017 and ARM/ARM64 support (now integrated upstream)
* Remove custom GRUB patches for F2FS support (now integrated upstream)
* Update GRUB and gnu-efi to latest

v1.2 (2017.11.14)
* Add EDK2 compilation support
* Add Visual Studio 2017 ARM64 compilation support
Expand Down
4 changes: 2 additions & 2 deletions EfiFsPkg.dec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## @file
# EfiFs Package
#
# Copyright (c) 2017, Pete Batard <[email protected]>
# Copyright (c) 2017-2018, Pete Batard <[email protected]>
#
##

Expand All @@ -10,7 +10,7 @@
PACKAGE_NAME = EfiFsPkg
PACKAGE_UNI_FILE = EfiFsPkg.uni
PACKAGE_GUID = D65E40B8-BC4B-4625-9E5C-17C5726C39C3
PACKAGE_VERSION = 1.2
PACKAGE_VERSION = 1.3

[UserExtensions.TianoCore."ExtraFiles"]
EfiFsPkgExtra.uni
Expand Down
4 changes: 2 additions & 2 deletions EfiFsPkg.dsc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## @file
# EfiFs Driver Modules
#
# Copyright (c) 2017, Pete Batard <[email protected]>
# Copyright (c) 2017-2018, Pete Batard <[email protected]>
#
##

[Defines]
PLATFORM_NAME = EfiFs
PLATFORM_GUID = 700d6096-1578-409e-a6c7-9acdf9f565b3
PLATFORM_VERSION = 1.2
PLATFORM_VERSION = 1.3
DSC_SPECIFICATION = 0x00010005
SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64
OUTPUT_DIRECTORY = Build/EfiFs
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Affs.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = affs
FILE_GUID = BD873114-A318-48C4-AEF9-6C9E43A50FFA
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Afs.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = afs
FILE_GUID = DEFE2F9E-38C4-4278-AB7D-3BCC7B3C9292
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Bfs.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = bfs
FILE_GUID = 7686EACB-461E-417F-BB6B-0C5DBA8B4087
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Btrfs.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = btrfs
FILE_GUID = E4FD4F23-5515-434C-9F19-59CA8B122825
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Cbfs.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = cbfs
FILE_GUID = DEEC0FF0-64AE-4B2D-A9D1-87057258854C
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Cpio.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = cpio
FILE_GUID = FE902772-06CD-40E4-B35B-0E760C5E9C1A
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/CpioBe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = cpio_be
FILE_GUID = A3853AE0-E77D-405E-8A75-16333DE1632C
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/ExFat.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = exfat
FILE_GUID = 2920E524-AD21-499E-9F4A-466BFDC3BFFB
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
2 changes: 1 addition & 1 deletion EfiFsPkg/Ext2.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_NAME = ext2
FILE_GUID = 7DDA7772-B8F5-4859-9DBA-0D6F2DBA4AF1
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.2
VERSION_STRING = 1.3
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FSDriverInstall
Expand Down
Loading

0 comments on commit fc762f0

Please sign in to comment.