grub2 2.04-2 (aarch64) 2019-8245
-9999

Status rejected
Submitter angrypenguinpoland [@T] gmail.com
Platform rolling
Repository main
URL https://abf.openmandriva.org/build_lists/638703
Packages
grub2-2.04-2.aarch64.binary
grub2-2.04-2.aarch64.source
grub2-doc-2.04-2.aarch64.binary
grub2-efi-2.04-2.aarch64.binary
grub2-extra-2.04-2.aarch64.binary
grub2-starfield-theme-2.04-2.aarch64.binary
Build Date 2019-11-03 16:42:12 +0000 UTC
Last Updated 2019-11-04 03:31:31.864066576 +0000 UTC
$ git diff --patch-with-stat --summary 0e605701bbddb5f8230865a3e126a68336068b7a..8f8d15fdf92d56c8bfa0991a699b2db522e16e2c

 .abf.yml                                           |    6 +-
 grub-2.00-autoreconf-sucks.patch                   |   25 +-
 grub-2.00-ignore-gnulib-gets-stupidity.patch       |   26 -
 grub-2.00-try-link-against-libncursesw-also.patch  |   12 -
 grub-2.02-20180620-disable-docs.patch              |   16 +-
 grub-2.02-fuse3.patch                              |   63 +-
 grub-2.02-load-microcode.patch                     |   26 -
 ...2-remove-efivar-kernel-module-requirement.patch |   19 -
 grub-2.04-grub-extras-lua-fix.patch                |   33 +
 grub-add-f2fs-support-2017_05.patch                | 1480 --------------------
 grub-fix-texinfo-page.patch                        |   12 -
 grub2-10_linux.patch                               |   11 -
 grub2-2.02-fix-grub-gen-asciih.patch               |   10 -
 grub2-2.02-unity-mkrescue-use-grub2-dir.patch      |   69 +-
 grub2-mkfont-fix.patch                             |   12 -
 grub2-move-terminal.patch                          |   29 -
 grub2-name-corrections.patch                       |   45 -
 ...2-setup-try-fs-embed-if-mbr-gap-too-small.patch |   61 -
 grub2-theme-not_selected_item_box.patch            |  112 --
 grub2.spec                                         |   71 +-
 linguas.sh                                         |   22 -
 21 files changed, 155 insertions(+), 2005 deletions(-)
 delete mode 100644 grub-2.00-ignore-gnulib-gets-stupidity.patch
 delete mode 100644 grub-2.00-try-link-against-libncursesw-also.patch
 delete mode 100644 grub-2.02-load-microcode.patch
 delete mode 100644 grub-2.02-remove-efivar-kernel-module-requirement.patch
 create mode 100644 grub-2.04-grub-extras-lua-fix.patch
 delete mode 100644 grub-add-f2fs-support-2017_05.patch
 delete mode 100644 grub-fix-texinfo-page.patch
 delete mode 100644 grub2-10_linux.patch
 delete mode 100644 grub2-2.02-fix-grub-gen-asciih.patch
 delete mode 100644 grub2-mkfont-fix.patch
 delete mode 100644 grub2-move-terminal.patch
 delete mode 100644 grub2-name-corrections.patch
 delete mode 100644 grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch
 delete mode 100644 grub2-theme-not_selected_item_box.patch
 delete mode 100755 linguas.sh

diff --git a/.abf.yml b/.abf.yml
index fba7397..5ec6943 100644
--- a/.abf.yml
+++ b/.abf.yml
@@ -1,7 +1,5 @@
 sources:
   DroidSansMono.ttf: 4d3d8054231ec4e9bfc14a46ad4d60c575fbfeec
-  grub-2.02-20180928.tar.xz: 42d1dec4d1dd291d6980359e148647e84a404943
-  grub-lua-rev30.tar.xz: b84af78af1d2736dc43c477afa814b20f40fddf0
-  grub2-po-update.tar.gz: ba7b6ed09fe79b9447b046d2d667b87441489900
+  grub-2.04.tar.xz: 3ed21de7be5970d7638b9f526bca3292af78e0fc
+  grub-extras-20191024.tar.xz: 9a645b510ff092ae4c23215964eb1305fd9b5c78
   grub_guide.tar.gz: f300e9f0c86512bb90f5e82fa65636fcb5d644a7
-  linguas.tar.xz: 84812bf833c899dc49e85b9985e3c11f2386192f
diff --git a/grub-2.00-autoreconf-sucks.patch b/grub-2.00-autoreconf-sucks.patch
index aa09564..52110ac 100644
--- a/grub-2.00-autoreconf-sucks.patch
+++ b/grub-2.00-autoreconf-sucks.patch
@@ -1,12 +1,15 @@
---- grub-2.00/autogen.sh.bero	2013-05-15 17:50:19.615056873 +0200
-+++ grub-2.00/autogen.sh	2013-05-15 17:50:33.350885151 +0200
-@@ -67,5 +67,8 @@ echo "Saving timestamps..."
- echo timestamp > stamp-h.in
+diff -Naur grub-2.04/autogen.sh grub-2.04.tpg/autogen.sh
+--- grub-2.04/autogen.sh	2019-04-23 08:54:47.000000000 +0000
++++ grub-2.04.tpg/autogen.sh	2019-07-31 12:27:37.806744262 +0000
+@@ -96,7 +96,10 @@
+   # gnulib.git.
+   echo "Running autoreconf..."
+   cp -a INSTALL INSTALL.grub
+-  autoreconf -vif
++  autoheader
++  aclocal -I m4 --dont-fix
++  automake -a
++  autoconf
+   mv INSTALL.grub INSTALL
+ fi
  
- echo "Running autoreconf..."
--autoreconf -vi
-+autoheader
-+aclocal -I m4 --dont-fix
-+automake -a
-+autoconf
- exit 0
diff --git a/grub-2.00-ignore-gnulib-gets-stupidity.patch b/grub-2.00-ignore-gnulib-gets-stupidity.patch
deleted file mode 100644
index 345c19d..0000000
--- a/grub-2.00-ignore-gnulib-gets-stupidity.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From f66d54b934710f54999debb72e8b7c620edece1d Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Fri, 25 May 2012 15:28:19 -0400
-Subject: [PATCH] gnulib accused in build breaking shocker.
-
----
- grub-core/gnulib/stdio.in.h |    2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/grub-core/gnulib/stdio.in.h b/grub-core/gnulib/stdio.in.h
-index 80b9dbf..69932d9 100644
---- a/grub-core/gnulib/stdio.in.h
-+++ b/grub-core/gnulib/stdio.in.h
-@@ -141,7 +141,9 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
-    so any use of gets warrants an unconditional warning.  Assume it is
-    always declared, since it is required by C89.  */
- #undef gets
-+#if 0
- _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
-+#endif
- 
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
--- 
-1.7.10.1
-
diff --git a/grub-2.00-try-link-against-libncursesw-also.patch b/grub-2.00-try-link-against-libncursesw-also.patch
deleted file mode 100644
index 5d75ccd..0000000
--- a/grub-2.00-try-link-against-libncursesw-also.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- grub-2.00/configure.ac~	2012-12-21 10:31:28.227181112 +0100
-+++ grub-2.00/configure.ac	2012-12-21 10:31:31.074226776 +0100
-@@ -791,7 +791,8 @@ if test "$platform" = emu; then
- [# Check for curses libraries.]
-   AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
-     [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
--      [missing_ncurses=[true]])])
-+      [AC_CHECK_LIB([ncursesw], [wgetch], [LIBCURSES="-lncursesw"],
-+        [missing_ncurses=[true]])])])
-   AC_SUBST([LIBCURSES])
- [if [ x"$missing_ncurses" = x ]; then ]
-   [# Check for headers.]
diff --git a/grub-2.02-20180620-disable-docs.patch b/grub-2.02-20180620-disable-docs.patch
index bb87fa5..d83adb2 100644
--- a/grub-2.02-20180620-disable-docs.patch
+++ b/grub-2.02-20180620-disable-docs.patch
@@ -1,6 +1,6 @@
-diff -Naur grub-2.02-20180620/Makefile.am grub-2.02-20180620.tpg/Makefile.am
---- grub-2.02-20180620/Makefile.am	2018-06-05 11:04:04.000000000 +0000
-+++ grub-2.02-20180620.tpg/Makefile.am	2018-06-22 14:54:26.954840507 +0000
+diff -Naur grub-2.04/Makefile.am grub-2.04.tpg/Makefile.am
+--- grub-2.04/Makefile.am	2019-10-24 08:49:04.756376834 +0000
++++ grub-2.04.tpg/Makefile.am	2019-10-24 08:50:49.812385345 +0000
 @@ -5,7 +5,7 @@
  if COND_real_platform
  SUBDIRS += grub-core
@@ -10,12 +10,12 @@ diff -Naur grub-2.02-20180620/Makefile.am grub-2.02-20180620.tpg/Makefile.am
  
  include $(top_srcdir)/conf/Makefile.common
  include $(top_srcdir)/conf/Makefile.extra-dist
-diff -Naur grub-2.02-20180620/configure.ac grub-2.02-20180620.tpg/configure.ac
---- grub-2.02-20180620/configure.ac	2018-06-22 14:52:27.335848000 +0000
-+++ grub-2.02-20180620.tpg/configure.ac	2018-06-22 14:55:10.959837626 +0000
-@@ -2000,7 +2000,6 @@
+diff -Naur grub-2.04/configure.ac grub-2.04.tpg/configure.ac
+--- grub-2.04/configure.ac	2019-10-24 08:49:04.740376832 +0000
++++ grub-2.04.tpg/configure.ac	2019-10-24 08:51:16.409387500 +0000
+@@ -2017,7 +2017,6 @@
  AC_CONFIG_FILES([grub-core/Makefile])
- AC_CONFIG_FILES([grub-core/gnulib/Makefile])
+ AC_CONFIG_FILES([grub-core/lib/gnulib/Makefile])
  AC_CONFIG_FILES([po/Makefile.in])
 -AC_CONFIG_FILES([docs/Makefile])
  AC_CONFIG_FILES([util/bash-completion.d/Makefile])
diff --git a/grub-2.02-fuse3.patch b/grub-2.02-fuse3.patch
index dbd2223..ea03825 100644
--- a/grub-2.02-fuse3.patch
+++ b/grub-2.02-fuse3.patch
@@ -1,12 +1,35 @@
---- grub-2.02/configure.ac.0006~	2017-04-24 13:30:15.000000000 +0200
-+++ grub-2.02/configure.ac	2017-12-01 15:27:59.375189898 +0100
-@@ -1684,15 +1684,15 @@ if test x"$enable_grub_mount" = xno ; th
+diff -Naur grub-2.04/Makefile.util.def grub-2.04.tpg/Makefile.util.def
+--- grub-2.04/Makefile.util.def	2019-04-23 08:54:47.000000000 +0000
++++ grub-2.04.tpg/Makefile.util.def	2019-10-24 19:53:30.639332085 +0000
+@@ -194,7 +194,7 @@
+   common = util/config.c;
+ 
+   extra_dist = util/grub-mkimagexx.c;
+-
++  cppflags = '-I/usr/include/fuse3';
+   ldadd = libgrubmods.a;
+   ldadd = libgrubgcry.a;
+   ldadd = libgrubkern.a;
+@@ -301,7 +301,7 @@
+   ldadd = libgrubgcry.a;
+   ldadd = libgrubkern.a;
+   ldadd = grub-core/lib/gnulib/libgnu.a;
+-  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) -lfuse';
++  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) -lfuse3';
+   condition = COND_GRUB_MOUNT;
+ };
+ 
+diff -Naur grub-2.04/configure.ac grub-2.04.tpg/configure.ac
+--- grub-2.04/configure.ac	2019-07-03 15:25:10.000000000 +0000
++++ grub-2.04.tpg/configure.ac	2019-10-24 19:53:30.639332085 +0000
+@@ -1711,16 +1711,16 @@
  fi
  
  if test x"$grub_mount_excuse" = x ; then
 -  AC_CHECK_LIB([fuse], [fuse_main_real], [],
+-               [grub_mount_excuse="need FUSE library"])
 +  AC_CHECK_LIB([fuse3], [fuse_main_real], [],
-                [grub_mount_excuse="need FUSE library"])
++               [grub_mount_excuse="need FUSE3 library"])
  fi
  
  if test x"$grub_mount_excuse" = x ; then
@@ -14,30 +37,16 @@
    SAVED_CPPFLAGS="$CPPFLAGS"
 -  CPPFLAGS="$CPPFLAGS -DFUSE_USE_VERSION=26"
 -  AC_CHECK_HEADERS([fuse/fuse.h], [],
+-  	[grub_mount_excuse=["need FUSE headers"]])
 +  CPPFLAGS="$CPPFLAGS -I/usr/include/fuse3 -DFUSE_USE_VERSION=30"
-+  AC_CHECK_HEADERS([fuse.h], [],
-   	[grub_mount_excuse=["need FUSE headers"]])
++  AC_CHECK_HEADERS([fuse3/fuse.h], [],
++  	[grub_mount_excuse=["need FUSE3 headers"]])
    CPPFLAGS="$SAVED_CPPFLAGS"
  fi
---- grub-2.02/Makefile.util.def.0006~	2017-12-01 15:27:59.376189901 +0100
-+++ grub-2.02/Makefile.util.def	2017-12-01 15:28:28.166275641 +0100
-@@ -287,11 +287,13 @@ program = {
-   common = grub-core/disk/host.c;
-   common = grub-core/osdep/init.c;
- 
-+  cppflags = '-I/usr/include/fuse3';
-+
-   ldadd = libgrubmods.a;
-   ldadd = libgrubgcry.a;
-   ldadd = libgrubkern.a;
-   ldadd = grub-core/gnulib/libgnu.a;
--  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) -lfuse';
-+  ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) -lfuse3';
-   condition = COND_GRUB_MOUNT;
- };
  
---- grub-2.02/util/grub-mount.c.0006~	2017-04-24 11:16:00.000000000 +0200
-+++ grub-2.02/util/grub-mount.c	2017-12-01 15:27:59.376189901 +0100
+diff -Naur grub-2.04/util/grub-mount.c grub-2.04.tpg/util/grub-mount.c
+--- grub-2.04/util/grub-mount.c	2019-04-23 08:54:47.000000000 +0000
++++ grub-2.04.tpg/util/grub-mount.c	2019-10-24 19:56:57.405201664 +0000
 @@ -16,7 +16,7 @@
   *  You should have received a copy of the GNU General Public License
   *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
@@ -52,11 +61,11 @@
  #include <grub/zfs/zfs.h>
  #include <grub/i18n.h>
 -#include <fuse/fuse.h>
-+#include <fuse.h>
++#include <fuse3/fuse.h>
  
  #include <stdio.h>
  #include <unistd.h>
-@@ -147,7 +147,7 @@ fuse_getattr_find_file (const char *cur_
+@@ -147,7 +147,7 @@
  }
  
  static int
@@ -65,7 +74,7 @@
  {
    struct fuse_getattr_ctx ctx;
    char *pathname, *path2;
-@@ -330,13 +330,13 @@ fuse_readdir_call_fill (const char *file
+@@ -330,13 +330,13 @@
    st.st_blocks = (st.st_size + 511) >> 9;
    st.st_atime = st.st_mtime = st.st_ctime
      = info->mtimeset ? info->mtime : 0;
diff --git a/grub-2.02-load-microcode.patch b/grub-2.02-load-microcode.patch
deleted file mode 100644
index 5fb1fb3..0000000
--- a/grub-2.02-load-microcode.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- grub-2.02/util/grub.d/10_linux.in.omv~	2017-04-26 21:58:22.019911399 +0200
-+++ grub-2.02/util/grub.d/10_linux.in	2017-04-26 21:59:39.240275051 +0200
-@@ -133,12 +133,22 @@ linux_entry ()
- 	echo	'$(echo "$message" | grub_quote)'
- 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
- EOF
-+  microcode_name=""
-+  if [ -e /boot/microcode.img ]; then
-+    microcode_name=`make_system_path_relative_to_its_root /boot/microcode.img`
-+  fi
-   if test -n "${initrd}" ; then
-     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
-     message="$(gettext_printf "Loading initial ramdisk ...")"
-     sed "s/^/$submenu_indentation/" << EOF
- 	echo	'$(echo "$message" | grub_quote)'
--	initrd	${rel_dirname}/${initrd}
-+	initrd	${microcode_name} ${rel_dirname}/${initrd}
-+EOF
-+  elif test -n "${microcode_name}" ; then
-+    message="$(gettext_printf "Loading CPU microcode ...")"
-+    sed "s/^/$submenu_indentation/" << EOF
-+	echo    '$(echo "$message" | grub_quote)'
-+	initrd  ${microcode_name}
- EOF
-   fi
-   sed "s/^/$submenu_indentation/" << EOF
diff --git a/grub-2.02-remove-efivar-kernel-module-requirement.patch b/grub-2.02-remove-efivar-kernel-module-requirement.patch
deleted file mode 100644
index edae973..0000000
--- a/grub-2.02-remove-efivar-kernel-module-requirement.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c
-index ca448bc..2899c50 100644
---- a/grub-core/osdep/unix/platform.c
-+++ b/grub-core/osdep/unix/platform.c
-@@ -149,10 +149,12 @@ grub_install_register_efi (grub_device_t efidir_grub_dev,
-       grub_util_error (_("%s: not found"), "efibootmgr");
-     }
- 
--  /* On Linux, we need the efivars kernel modules.  */
-+  /* Openmandriva uses the latest kernel interface so the efi
-+   * module is not required */
-+  /* On Linux, we need the efivars kernel modules.
- #ifdef __linux__
-   grub_util_exec ((const char * []){ "modprobe", "-q", "efivars", NULL });
--#endif
-+#endif */
-   /* Delete old entries from the same distributor.  */
-   ret = grub_install_remove_efi_entries_by_distributor (efi_distributor);
-   if (ret)
diff --git a/grub-2.04-grub-extras-lua-fix.patch b/grub-2.04-grub-extras-lua-fix.patch
new file mode 100644
index 0000000..8d3e073
--- /dev/null
+++ b/grub-2.04-grub-extras-lua-fix.patch
@@ -0,0 +1,33 @@
+diff -Naur grub-2.04/grub-extras/lua/grub_lib.c grub-2.04.tpg/grub-extras/lua/grub_lib.c
+--- grub-2.04/grub-extras/lua/grub_lib.c	2019-05-04 22:05:56.000000000 +0000
++++ grub-2.04.tpg/grub-extras/lua/grub_lib.c	2019-10-24 21:21:37.371838656 +0000
+@@ -328,7 +328,7 @@
+   const char *name;
+ 
+   name = luaL_checkstring (state, 1);
+-  file = grub_file_open (name);
++  file = grub_file_open (name, 0);
+   save_errno (state);
+ 
+   if (! file)
+@@ -465,7 +465,7 @@
+ 
+   result = 0;
+   name = luaL_checkstring (state, 1);
+-  file = grub_file_open (name);
++  file = grub_file_open (name, 0);
+   if (file)
+     {
+       result++;
+diff -Naur grub-2.04/grub-extras/lua/lauxlib.c grub-2.04.tpg/grub-extras/lua/lauxlib.c
+--- grub-2.04/grub-extras/lua/lauxlib.c	2019-05-04 22:05:56.000000000 +0000
++++ grub-2.04.tpg/grub-extras/lua/lauxlib.c	2019-10-24 21:21:19.904978383 +0000
+@@ -591,7 +591,7 @@
+   }
+   else {
+     lua_pushfstring(L, "@%s", filename);
+-    lf.f = grub_file_open(filename);
++    lf.f = grub_file_open(filename, 0);
+     if (lf.f == NULL) return errfile(L, "open", fnameindex);
+   }
+ 
diff --git a/grub-add-f2fs-support-2017_05.patch b/grub-add-f2fs-support-2017_05.patch
deleted file mode 100644
index 9440386..0000000
--- a/grub-add-f2fs-support-2017_05.patch
+++ /dev/null
@@ -1,1480 +0,0 @@
-"F2FS (Flash-Friendly File System) is flash-friendly file system which was merged
-into Linux kernel v3.8 in 2013.
-
-The motive for F2FS was to build a file system that from the start, takes into
-account the characteristics of NAND flash memory-based storage devices (such as
-solid-state disks, eMMC, and SD cards).
-
-F2FS was designed on a basis of a log-structured file system approach, which
-remedies some known issues of the older log structured file systems, such as
-the snowball effect of wandering trees and high cleaning overhead. In addition,
-since a NAND-based storage device shows different characteristics according to
-its internal geometry or flash memory management scheme (such as the Flash
-Translation Layer or FTL), it supports various parameters not only for
-configuring on-disk layout, but also for selecting allocation and cleaning
-algorithm.", quote by https://en.wikipedia.org/wiki/F2FS.
-
-The source codes for F2FS are available from:
-
-http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs.git
-http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-tools.git
-
-Update:
- - This patch has been integrated in OpenMandriva Lx 3.
-   https://www.openmandriva.org/
-
-Acked-by: Andrei Borzenkov <arvidjaar@gmail.com>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
----
- Makefile.util.def            |    7 +
- docs/grub.texi               |    5 +-
- grub-core/Makefile.core.def  |    5 +
- grub-core/fs/f2fs.c          | 1289 ++++++++++++++++++++++++++++++++++++++++++
- po/exclude.pot               |    1 +
- tests/f2fs_test.in           |   19 +
- tests/util/grub-fs-tester.in |   10 +-
- 7 files changed, 1332 insertions(+), 4 deletions(-)
-# create mode 100644 grub-core/fs/f2fs.c
-# create mode 100644 tests/f2fs_test.in
-
-diff --git a/Makefile.util.def b/Makefile.util.def
-index f9caccb97..3180ac880 100644
---- a/Makefile.util.def
-+++ b/Makefile.util.def
-@@ -99,6 +99,7 @@ library = {
-   common = grub-core/fs/ext2.c;
-   common = grub-core/fs/fat.c;
-   common = grub-core/fs/exfat.c;
-+  common = grub-core/fs/f2fs.c;
-   common = grub-core/fs/fshelp.c;
-   common = grub-core/fs/hfs.c;
-   common = grub-core/fs/hfsplus.c;
-@@ -776,6 +777,12 @@ script = {
- 
- script = {
-   testcase;
-+  name = f2fs_test;
-+  common = tests/f2fs_test.in;
-+};
-+
-+script = {
-+  testcase;
-   name = nilfs2_test;
-   common = tests/nilfs2_test.in;
- };
-diff --git a/docs/grub.texi b/docs/grub.texi
-index e935af33e..7137d6d0d 100644
---- a/docs/grub.texi
-+++ b/docs/grub.texi
-@@ -360,7 +360,8 @@ blocklist notation. The currently supported filesystem types are @dfn{Amiga
- Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS},
- @dfn{BtrFS} (including raid0, raid1, raid10, gzip and lzo),
- @dfn{cpio} (little- and big-endian bin, odc and newc variants),
--@dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{exFAT}, @dfn{HFS},
-+@dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{exFAT},
-+@dfn{f2fs}, @dfn{HFS},
- @dfn{HFS+}, @dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files),
- @dfn{JFS}, @dfn{Minix fs} (versions 1, 2 and 3), @dfn{nilfs2},
- @dfn{NTFS} (including compression), @dfn{ReiserFS}, @dfn{ROMFS},
-@@ -5368,7 +5369,7 @@ NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
- ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
- as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
- minix2, minix3, ROMFS, ReiserFS, XFS, ext2, ext3, ext4, FAT (short names),
--RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
-+f2fs, RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
- to be UTF-8. This might be false on systems configured with legacy charset
- but as long as the charset used is superset of ASCII you should be able to
- access ASCII-named files. And it's recommended to configure your system to use
-diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
-index 2dfa22a92..7f084d466 100644
---- a/grub-core/Makefile.core.def
-+++ b/grub-core/Makefile.core.def
-@@ -1291,6 +1291,11 @@ module = {
- };
- 
- module = {
-+  name = f2fs;
-+  common = fs/f2fs.c;
-+};
-+
-+module = {
-   name = fshelp;
-   common = fs/fshelp.c;
- };
-diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c
-#new file mode 100644
-index 000000000..7fb256f20
---- /dev/null
-+++ b/grub-core/fs/f2fs.c
-@@ -0,0 +1,1289 @@
-+/*
-+ *  f2fs.c - Flash-Friendly File System
-+ *
-+ *  Written by Jaegeuk Kim <jaegeuk@kernel.org>
-+ *
-+ *  Copyright (C) 2015  Free Software Foundation, Inc.
-+ *
-+ *  GRUB is free software: you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation, either version 3 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  GRUB is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <grub/err.h>
-+#include <grub/file.h>
-+#include <grub/mm.h>
-+#include <grub/misc.h>
-+#include <grub/disk.h>
-+#include <grub/dl.h>
-+#include <grub/types.h>
-+#include <grub/charset.h>
-+#include <grub/fshelp.h>
-+
-+GRUB_MOD_LICENSE ("GPLv3+");
-+
-+/* F2FS Magic Number */
-+#define F2FS_SUPER_MAGIC	0xF2F52010
-+#define CHECKSUM_OFFSET		4092		/* must be aligned 4 bytes */
-+#define U32_CHECKSUM_OFFSET	(CHECKSUM_OFFSET >> 2)
-+
-+/* byte-size offset */
-+#define F2FS_SUPER_OFFSET	((grub_disk_addr_t)1024)
-+#define F2FS_SUPER_OFFSET0	(F2FS_SUPER_OFFSET >> GRUB_DISK_SECTOR_BITS)
-+#define F2FS_SUPER_OFFSET1	((F2FS_SUPER_OFFSET + F2FS_BLKSIZE) >>	\
-+						GRUB_DISK_SECTOR_BITS)
-+
-+/* 9 bits for 512 bytes */
-+#define F2FS_MIN_LOG_SECTOR_SIZE	9
-+
-+/* support only 4KB block */
-+#define F2FS_BLK_BITS	12
-+#define F2FS_BLKSIZE	(1 << F2FS_BLK_BITS)
-+#define F2FS_BLK_SEC_BITS	(F2FS_BLK_BITS - GRUB_DISK_SECTOR_BITS)
-+
-+#define VERSION_LEN	256
-+#define F2FS_MAX_EXTENSION	64
-+
-+#define CP_COMPACT_SUM_FLAG	0x00000004
-+#define CP_UMOUNT_FLAG	0x00000001
-+
-+#define MAX_ACTIVE_LOGS	16
-+#define MAX_ACTIVE_NODE_LOGS	8
-+#define MAX_ACTIVE_DATA_LOGS	8
-+#define	NR_CURSEG_DATA_TYPE	3
-+#define NR_CURSEG_NODE_TYPE	3
-+#define NR_CURSEG_TYPE	(NR_CURSEG_DATA_TYPE + NR_CURSEG_NODE_TYPE)
-+
-+#define ENTRIES_IN_SUM	512
-+#define	SUMMARY_SIZE	7
-+#define	SUM_FOOTER_SIZE	5
-+#define JENTRY_SIZE	(sizeof(struct grub_f2fs_nat_jent))
-+#define SUM_ENTRIES_SIZE	(SUMMARY_SIZE * ENTRIES_IN_SUM)
-+#define SUM_JOURNAL_SIZE	(F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
-+				SUM_ENTRIES_SIZE)
-+#define NAT_JOURNAL_ENTRIES	((SUM_JOURNAL_SIZE - 2) / JENTRY_SIZE)
-+#define NAT_JOURNAL_RESERVED	((SUM_JOURNAL_SIZE - 2) % JENTRY_SIZE)
-+
-+#define NAT_ENTRY_SIZE (sizeof(struct grub_f2fs_nat_entry))
-+#define NAT_ENTRY_PER_BLOCK (F2FS_BLKSIZE / NAT_ENTRY_SIZE)
-+
-+#define F2FS_NAME_LEN	255
-+#define F2FS_SLOT_LEN	8
-+#define NR_DENTRY_IN_BLOCK	214
-+#define SIZE_OF_DIR_ENTRY	11	/* by byte */
-+#define BITS_PER_BYTE	8
-+#define SIZE_OF_DENTRY_BITMAP	((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
-+				BITS_PER_BYTE)
-+#define SIZE_OF_RESERVED	(F2FS_BLKSIZE - ((SIZE_OF_DIR_ENTRY + \
-+				F2FS_SLOT_LEN) * \
-+				NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
-+
-+#define F2FS_INLINE_XATTR_ADDRS	50	/* 200 bytes for inline xattrs */
-+#define DEF_ADDRS_PER_INODE	923	/* Address Pointers in an Inode */
-+
-+#define ADDRS_PER_BLOCK	1018	/* Address Pointers in a Direct Block */
-+#define NIDS_PER_BLOCK	1018	/* Node IDs in an Indirect Block */
-+#define	NODE_DIR1_BLOCK	(DEF_ADDRS_PER_INODE + 1)
-+#define	NODE_DIR2_BLOCK	(DEF_ADDRS_PER_INODE + 2)
-+#define	NODE_IND1_BLOCK	(DEF_ADDRS_PER_INODE + 3)
-+#define	NODE_IND2_BLOCK	(DEF_ADDRS_PER_INODE + 4)
-+#define	NODE_DIND_BLOCK	(DEF_ADDRS_PER_INODE + 5)
-+
-+#define MAX_INLINE_DATA	(4 * (DEF_ADDRS_PER_INODE - \
-+			F2FS_INLINE_XATTR_ADDRS - 1))
-+#define NR_INLINE_DENTRY	(MAX_INLINE_DATA * BITS_PER_BYTE / \
-+			((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
-+			 BITS_PER_BYTE + 1))
-+#define INLINE_DENTRY_BITMAP_SIZE	((NR_INLINE_DENTRY + \
-+			BITS_PER_BYTE - 1) / BITS_PER_BYTE)
-+#define INLINE_RESERVED_SIZE	(MAX_INLINE_DATA - \
-+			((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
-+			 NR_INLINE_DENTRY + INLINE_DENTRY_BITMAP_SIZE))
-+#define CURSEG_HOT_DATA	0
-+
-+#define CKPT_FLAG_SET(ckpt, f)	\
-+		(ckpt)->ckpt_flags & grub_cpu_to_le32_compile_time (f)
-+
-+#define F2FS_INLINE_XATTR	0x01	/* file inline xattr flag */
-+#define F2FS_INLINE_DATA	0x02	/* file inline data flag */
-+#define F2FS_INLINE_DENTRY	0x04	/* file inline dentry flag */
-+#define F2FS_DATA_EXIST		0x08	/* file inline data exist flag */
-+#define F2FS_INLINE_DOTS	0x10	/* file having implicit dot dentries */
-+
-+enum FILE_TYPE
-+{
-+  F2FS_FT_UNKNOWN,
-+  F2FS_FT_REG_FILE = 1,
-+  F2FS_FT_DIR = 2,
-+  F2FS_FT_SYMLINK = 7,
-+};
-+
-+#define MAX_VOLUME_NAME		512
-+
-+struct grub_f2fs_superblock
-+{
-+  grub_uint32_t magic;
-+  grub_uint16_t dummy1[2];
-+  grub_uint32_t log_sectorsize;
-+  grub_uint32_t log_sectors_per_block;
-+  grub_uint32_t log_blocksize;
-+  grub_uint32_t log_blocks_per_seg;
-+  grub_uint32_t segs_per_sec;
-+  grub_uint32_t secs_per_zone;
-+  grub_uint32_t checksum_offset;
-+  grub_uint8_t dummy2[40];
-+  grub_uint32_t cp_blkaddr;
-+  grub_uint32_t sit_blkaddr;
-+  grub_uint32_t nat_blkaddr;
-+  grub_uint32_t ssa_blkaddr;
-+  grub_uint32_t main_blkaddr;
-+  grub_uint32_t root_ino;
-+  grub_uint32_t node_ino;
-+  grub_uint32_t meta_ino;
-+  grub_uint8_t uuid[16];
-+  grub_uint16_t volume_name[MAX_VOLUME_NAME];
-+  grub_uint32_t extension_count;
-+  grub_uint8_t extension_list[F2FS_MAX_EXTENSION][8];
-+  grub_uint32_t cp_payload;
-+  grub_uint8_t version[VERSION_LEN];
-+  grub_uint8_t init_version[VERSION_LEN];
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_checkpoint
-+{
-+  grub_uint64_t checkpoint_ver;
-+  grub_uint64_t user_block_count;
-+  grub_uint64_t valid_block_count;
-+  grub_uint32_t rsvd_segment_count;
-+  grub_uint32_t overprov_segment_count;
-+  grub_uint32_t free_segment_count;
-+  grub_uint32_t cur_node_segno[MAX_ACTIVE_NODE_LOGS];
-+  grub_uint16_t cur_node_blkoff[MAX_ACTIVE_NODE_LOGS];
-+  grub_uint32_t cur_data_segno[MAX_ACTIVE_DATA_LOGS];
-+  grub_uint16_t cur_data_blkoff[MAX_ACTIVE_DATA_LOGS];
-+  grub_uint32_t ckpt_flags;
-+  grub_uint32_t cp_pack_total_block_count;
-+  grub_uint32_t cp_pack_start_sum;
-+  grub_uint32_t valid_node_count;
-+  grub_uint32_t valid_inode_count;
-+  grub_uint32_t next_free_nid;
-+  grub_uint32_t sit_ver_bitmap_bytesize;
-+  grub_uint32_t nat_ver_bitmap_bytesize;
-+  grub_uint32_t checksum_offset;
-+  grub_uint64_t elapsed_time;
-+  grub_uint8_t alloc_type[MAX_ACTIVE_LOGS];
-+  grub_uint8_t sit_nat_version_bitmap[3900];
-+  grub_uint32_t checksum;
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_nat_entry {
-+  grub_uint8_t version;
-+  grub_uint32_t ino;
-+  grub_uint32_t block_addr;
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_nat_jent
-+{
-+  grub_uint32_t nid;
-+  struct grub_f2fs_nat_entry ne;
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_nat_journal {
-+  grub_uint16_t n_nats;
-+  struct grub_f2fs_nat_jent entries[NAT_JOURNAL_ENTRIES];
-+  grub_uint8_t reserved[NAT_JOURNAL_RESERVED];
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_nat_block {
-+  struct grub_f2fs_nat_entry ne[NAT_ENTRY_PER_BLOCK];
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_dir_entry
-+{
-+  grub_uint32_t hash_code;
-+  grub_uint32_t ino;
-+  grub_uint16_t name_len;
-+  grub_uint8_t file_type;
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_inline_dentry
-+{
-+  grub_uint8_t dentry_bitmap[INLINE_DENTRY_BITMAP_SIZE];
-+  grub_uint8_t reserved[INLINE_RESERVED_SIZE];
-+  struct grub_f2fs_dir_entry dentry[NR_INLINE_DENTRY];
-+  grub_uint8_t filename[NR_INLINE_DENTRY][F2FS_SLOT_LEN];
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_dentry_block {
-+  grub_uint8_t dentry_bitmap[SIZE_OF_DENTRY_BITMAP];
-+  grub_uint8_t reserved[SIZE_OF_RESERVED];
-+  struct grub_f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK];
-+  grub_uint8_t filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN];
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_inode
-+{
-+  grub_uint16_t i_mode;
-+  grub_uint8_t i_advise;
-+  grub_uint8_t i_inline;
-+  grub_uint32_t i_uid;
-+  grub_uint32_t i_gid;
-+  grub_uint32_t i_links;
-+  grub_uint64_t i_size;
-+  grub_uint64_t i_blocks;
-+  grub_uint64_t i_atime;
-+  grub_uint64_t i_ctime;
-+  grub_uint64_t i_mtime;
-+  grub_uint32_t i_atime_nsec;
-+  grub_uint32_t i_ctime_nsec;
-+  grub_uint32_t i_mtime_nsec;
-+  grub_uint32_t i_generation;
-+  grub_uint32_t i_current_depth;
-+  grub_uint32_t i_xattr_nid;
-+  grub_uint32_t i_flags;
-+  grub_uint32_t i_pino;
-+  grub_uint32_t i_namelen;
-+  grub_uint8_t i_name[F2FS_NAME_LEN];
-+  grub_uint8_t i_dir_level;
-+  grub_uint8_t i_ext[12];
-+  grub_uint32_t i_addr[DEF_ADDRS_PER_INODE];
-+  grub_uint32_t i_nid[5];
-+} GRUB_PACKED;
-+
-+struct grub_direct_node {
-+  grub_uint32_t addr[ADDRS_PER_BLOCK];
-+} GRUB_PACKED;
-+
-+struct grub_indirect_node {
-+  grub_uint32_t nid[NIDS_PER_BLOCK];
-+} GRUB_PACKED;
-+
-+struct grub_f2fs_node
-+{
-+  union
-+  {
-+    struct grub_f2fs_inode i;
-+    struct grub_direct_node dn;
-+    struct grub_indirect_node in;
-+    char buf[F2FS_BLKSIZE - 40];	/* Should occupy F2FS_BLKSIZE totally */
-+  };
-+  grub_uint8_t dummy[40];
-+} GRUB_PACKED;
-+
-+struct grub_fshelp_node
-+{
-+  struct grub_f2fs_data *data;
-+  struct grub_f2fs_node inode;
-+  grub_uint32_t ino;
-+  int inode_read;
-+};
-+
-+struct grub_f2fs_data
-+{
-+  struct grub_f2fs_superblock sblock;
-+  struct grub_f2fs_checkpoint ckpt;
-+
-+  grub_uint32_t root_ino;
-+  grub_uint32_t blocks_per_seg;
-+  grub_uint32_t cp_blkaddr;
-+  grub_uint32_t nat_blkaddr;
-+
-+  struct grub_f2fs_nat_journal nat_j;
-+  char *nat_bitmap;
-+
-+  grub_disk_t disk;
-+  struct grub_f2fs_node *inode;
-+  struct grub_fshelp_node diropen;
-+};
-+
-+struct grub_f2fs_dir_iter_ctx
-+{
-+  struct grub_f2fs_data *data;
-+  grub_fshelp_iterate_dir_hook_t hook;
-+  void *hook_data;
-+  grub_uint8_t *bitmap;
-+  grub_uint8_t (*filename)[F2FS_SLOT_LEN];
-+  struct grub_f2fs_dir_entry *dentry;
-+  int max;
-+};
-+
-+struct grub_f2fs_dir_ctx
-+{
-+  grub_fs_dir_hook_t hook;
-+  void *hook_data;
-+  struct grub_f2fs_data *data;
-+};
-+
-+static grub_dl_t my_mod;
-+
-+static inline int
-+grub_f2fs_test_bit_le (int nr, const grub_uint8_t *addr)
-+{
-+  return addr[nr >> 3] & (1 << (nr & 7));
-+}
-+
-+static inline char *
-+__inline_addr (struct grub_f2fs_inode *inode)
-+{
-+  return (char *)&inode->i_addr[1];
-+}
-+
-+static inline grub_uint64_t
-+grub_f2fs_file_size (struct grub_f2fs_inode *inode)
-+{
-+  return grub_le_to_cpu64 (inode->i_size);
-+}
-+
-+static inline grub_uint32_t
-+__start_cp_addr (struct grub_f2fs_data *data)
-+{
-+  struct grub_f2fs_checkpoint *ckpt = &data->ckpt;
-+  grub_uint32_t start_addr = data->cp_blkaddr;
-+
-+  if (!(ckpt->checkpoint_ver & grub_cpu_to_le64_compile_time(1)))
-+    return start_addr + data->blocks_per_seg;
-+  return start_addr;
-+}
-+
-+static inline grub_uint32_t
-+__start_sum_block (struct grub_f2fs_data *data)
-+{
-+  struct grub_f2fs_checkpoint *ckpt = &data->ckpt;
-+
-+  return __start_cp_addr (data) + grub_le_to_cpu32 (ckpt->cp_pack_start_sum);
-+}
-+
-+static inline grub_uint32_t
-+__sum_blk_addr (struct grub_f2fs_data *data, int base, int type)
-+{
-+  struct grub_f2fs_checkpoint *ckpt = &data->ckpt;
-+
-+  return __start_cp_addr (data) +
-+	grub_le_to_cpu32 (ckpt->cp_pack_total_block_count)
-+	- (base + 1) + type;
-+}
-+
-+static inline void *
-+__nat_bitmap_ptr (struct grub_f2fs_data *data)
-+{
-+  struct grub_f2fs_checkpoint *ckpt = &data->ckpt;
-+  grub_uint32_t offset;
-+
-+  if (grub_le_to_cpu32 (data->sblock.cp_payload) > 0)
-+    return ckpt->sit_nat_version_bitmap;
-+
-+  offset = grub_le_to_cpu32 (ckpt->sit_ver_bitmap_bytesize);
-+  return ckpt->sit_nat_version_bitmap + offset;
-+}
-+
-+static inline grub_uint32_t
-+__get_node_id (struct grub_f2fs_node *rn, int off, int inode_block)
-+{
-+  if (inode_block)
-+    return grub_le_to_cpu32 (rn->i.i_nid[off - NODE_DIR1_BLOCK]);
-+  return grub_le_to_cpu32 (rn->in.nid[off]);
-+}
-+
-+static inline grub_err_t
-+grub_f2fs_block_read (struct grub_f2fs_data *data, grub_uint32_t blkaddr, void *buf)
-+{
-+  return grub_disk_read (data->disk,
-+		((grub_disk_addr_t)blkaddr) << F2FS_BLK_SEC_BITS,
-+		0, F2FS_BLKSIZE, buf);
-+}
-+
-+/*
-+ * CRC32
-+*/
-+#define CRCPOLY_LE 0xedb88320
-+
-+static inline grub_uint32_t
-+grub_f2fs_cal_crc32 (const void *buf, const grub_uint32_t len)
-+{
-+  grub_uint32_t crc = F2FS_SUPER_MAGIC;
-+  unsigned char *p = (unsigned char *)buf;
-+  grub_uint32_t tmp = len;
-+  int i;
-+
-+  while (tmp--)
-+    {
-+      crc ^= *p++;
-+      for (i = 0; i < 8; i++)
-+        crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
-+    }
-+  return crc;
-+}
-+
-+static inline int
-+grub_f2fs_crc_valid (grub_uint32_t blk_crc, void *buf, const grub_uint32_t len)
-+{
-+  grub_uint32_t cal_crc = 0;
-+
-+  cal_crc = grub_f2fs_cal_crc32 (buf, len);
-+
-+  return (cal_crc == blk_crc) ? 1 : 0;
-+}
-+
-+static inline int
-+grub_f2fs_test_bit (grub_uint32_t nr, const char *p)
-+{
-+  int mask;
-+
-+  p += (nr >> 3);
-+  mask = 1 << (7 - (nr & 0x07));
-+  return mask & *p;
-+}
-+
-+static int
-+grub_f2fs_sanity_check_sb (struct grub_f2fs_superblock *sb)
-+{
-+  grub_uint32_t log_sectorsize, log_sectors_per_block;
-+
-+  if (sb->magic != grub_cpu_to_le32_compile_time (F2FS_SUPER_MAGIC))
-+    return -1;
-+
-+  if (sb->log_blocksize != grub_cpu_to_le32_compile_time (F2FS_BLK_BITS))
-+    return -1;
-+
-+  log_sectorsize = grub_le_to_cpu32 (sb->log_sectorsize);
-+  log_sectors_per_block = grub_le_to_cpu32 (sb->log_sectors_per_block);
-+
-+  if (log_sectorsize > F2FS_BLK_BITS)
-+    return -1;
-+
-+  if (log_sectorsize < F2FS_MIN_LOG_SECTOR_SIZE)
-+    return -1;
-+
-+  if (log_sectors_per_block + log_sectorsize != F2FS_BLK_BITS)
-+    return -1;
-+
-+  return 0;
-+}
-+
-+static int
-+grub_f2fs_read_sb (struct grub_f2fs_data *data, grub_disk_addr_t offset)
-+{
-+  grub_disk_t disk = data->disk;
-+  grub_err_t err;
-+
-+  /* Read first super block. */
-+  err = grub_disk_read (disk, offset, 0, sizeof (data->sblock), &data->sblock);
-+  if (err)
-+    return -1;
-+
-+  return grub_f2fs_sanity_check_sb (&data->sblock);
-+}
-+
-+static void *
-+validate_checkpoint (struct grub_f2fs_data *data, grub_uint32_t cp_addr,
-+	grub_uint64_t *version)
-+{
-+  grub_uint32_t *cp_page_1, *cp_page_2;
-+  struct grub_f2fs_checkpoint *cp_block;
-+  grub_uint64_t cur_version = 0, pre_version = 0;
-+  grub_uint32_t crc = 0;
-+  grub_uint32_t crc_offset;
-+  grub_err_t err;
-+
-+  /* Read the 1st cp block in this CP pack */
-+  cp_page_1 = grub_malloc (F2FS_BLKSIZE);
-+  if (!cp_page_1)
-+    return NULL;
-+
-+  err = grub_f2fs_block_read (data, cp_addr, cp_page_1);
-+  if (err)
-+    goto invalid_cp1;
-+
-+  cp_block = (struct grub_f2fs_checkpoint *)cp_page_1;
-+  crc_offset = grub_le_to_cpu32 (cp_block->checksum_offset);
-+  if (crc_offset != CHECKSUM_OFFSET)
-+    goto invalid_cp1;
-+
-+  crc = grub_le_to_cpu32 (*(cp_page_1 + U32_CHECKSUM_OFFSET));
-+  if (!grub_f2fs_crc_valid (crc, cp_block, crc_offset))
-+    goto invalid_cp1;
-+
-+  pre_version = grub_le_to_cpu64 (cp_block->checkpoint_ver);
-+
-+  /* Read the 2nd cp block in this CP pack */
-+  cp_page_2 = grub_malloc (F2FS_BLKSIZE);
-+  if (!cp_page_2)
-+    goto invalid_cp1;
-+
-+  cp_addr += grub_le_to_cpu32 (cp_block->cp_pack_total_block_count) - 1;
-+
-+  err = grub_f2fs_block_read (data, cp_addr, cp_page_2);
-+  if (err)
-+    goto invalid_cp2;
-+
-+  cp_block = (struct grub_f2fs_checkpoint *)cp_page_2;
-+  crc_offset = grub_le_to_cpu32 (cp_block->checksum_offset);
-+  if (crc_offset != CHECKSUM_OFFSET)
-+    goto invalid_cp2;
-+
-+  crc = grub_le_to_cpu32 (*(cp_page_2 + U32_CHECKSUM_OFFSET));
-+  if (!grub_f2fs_crc_valid (crc, cp_block, crc_offset))
-+    goto invalid_cp2;
-+
-+  cur_version = grub_le_to_cpu64 (cp_block->checkpoint_ver);
-+  if (cur_version == pre_version)
-+    {
-+      *version = cur_version;
-+      grub_free (cp_page_2);
-+      return cp_page_1;
-+    }
-+
-+invalid_cp2:
-+  grub_free (cp_page_2);
-+invalid_cp1:
-+  grub_free (cp_page_1);
-+  return NULL;
-+}
-+
-+static grub_err_t
-+grub_f2fs_read_cp (struct grub_f2fs_data *data)
-+{
-+  void *cp1, *cp2, *cur_page;
-+  grub_uint64_t cp1_version = 0, cp2_version = 0;
-+  grub_uint64_t cp_start_blk_no;
-+
-+  /*
-+   * Finding out valid cp block involves read both
-+   * sets (cp pack1 and cp pack 2)
-+   */
-+  cp_start_blk_no = data->cp_blkaddr;
-+  cp1 = validate_checkpoint (data, cp_start_blk_no, &cp1_version);
-+  if (!cp1 && grub_errno)
-+    return grub_errno;
-+
-+  /* The second checkpoint pack should start at the next segment */
-+  cp_start_blk_no += data->blocks_per_seg;
-+  cp2 = validate_checkpoint (data, cp_start_blk_no, &cp2_version);
-+  if (!cp2 && grub_errno)
-+    {
-+      grub_free (cp1);
-+      return grub_errno;
-+    }
-+
-+  if (cp1 && cp2)
-+    cur_page = (cp2_version > cp1_version) ? cp2 : cp1;
-+  else if (cp1)
-+    cur_page = cp1;
-+  else if (cp2)
-+    cur_page = cp2;
-+  else
-+    return grub_error (GRUB_ERR_BAD_FS, "no checkpoints");
-+
-+  grub_memcpy (&data->ckpt, cur_page, F2FS_BLKSIZE);
-+
-+  grub_free (cp1);
-+  grub_free (cp2);
-+  return 0;
-+}
-+
-+static grub_err_t
-+get_nat_journal (struct grub_f2fs_data *data)
-+{
-+  grub_uint32_t block;
-+  char *buf;
-+  grub_err_t err;
-+
-+  buf = grub_malloc (F2FS_BLKSIZE);
-+  if (!buf)
-+    return grub_errno;
-+
-+  if (CKPT_FLAG_SET(&data->ckpt, CP_COMPACT_SUM_FLAG))
-+    block = __start_sum_block (data);
-+  else if (CKPT_FLAG_SET (&data->ckpt, CP_UMOUNT_FLAG))
-+    block = __sum_blk_addr (data, NR_CURSEG_TYPE, CURSEG_HOT_DATA);
-+  else
-+    block = __sum_blk_addr (data, NR_CURSEG_DATA_TYPE, CURSEG_HOT_DATA);
-+
-+  err = grub_f2fs_block_read (data, block, buf);
-+  if (err)
-+    goto fail;
-+
-+  if (CKPT_FLAG_SET (&data->ckpt, CP_COMPACT_SUM_FLAG))
-+    grub_memcpy (&data->nat_j, buf, SUM_JOURNAL_SIZE);
-+  else
-+    grub_memcpy (&data->nat_j, buf + SUM_ENTRIES_SIZE, SUM_JOURNAL_SIZE);
-+
-+fail:
-+  grub_free (buf);
-+  return err;
-+}
-+
-+static grub_uint32_t
-+get_blkaddr_from_nat_journal (struct grub_f2fs_data *data, grub_uint32_t nid)
-+{
-+  grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats);
-+  grub_uint32_t blkaddr = 0;
-+  grub_uint16_t i;
-+
-+  for (i = 0; i < n; i++)
-+    {
-+      if (grub_le_to_cpu32 (data->nat_j.entries[i].nid) == nid)
-+        {
-+          blkaddr = grub_le_to_cpu32 (data->nat_j.entries[i].ne.block_addr);
-+          break;
-+        }
-+    }
-+  return blkaddr;
-+}
-+
-+static grub_uint32_t
-+get_node_blkaddr (struct grub_f2fs_data *data, grub_uint32_t nid)
-+{
-+  struct grub_f2fs_nat_block *nat_block;
-+  grub_uint32_t seg_off, block_off, entry_off, block_addr;
-+  grub_uint32_t blkaddr;
-+  grub_err_t err;
-+
-+  blkaddr = get_blkaddr_from_nat_journal (data, nid);
-+  if (blkaddr)
-+    return blkaddr;
-+
-+  nat_block = grub_malloc (F2FS_BLKSIZE);
-+  if (!nat_block)
-+    return 0;
-+
-+  block_off = nid / NAT_ENTRY_PER_BLOCK;
-+  entry_off = nid % NAT_ENTRY_PER_BLOCK;
-+
-+  seg_off = block_off / data->blocks_per_seg;
-+  block_addr = data->nat_blkaddr +
-+	((seg_off * data->blocks_per_seg) << 1) +
-+	(block_off & (data->blocks_per_seg - 1));
-+
-+  if (grub_f2fs_test_bit (block_off, data->nat_bitmap))
-+    block_addr += data->blocks_per_seg;
-+
-+  err = grub_f2fs_block_read (data, block_addr, nat_block);
-+  if (err)
-+    {
-+      grub_free (nat_block);
-+      return 0;
-+    }
-+
-+  blkaddr = grub_le_to_cpu32 (nat_block->ne[entry_off].block_addr);
-+
-+  grub_free (nat_block);
-+
-+  return blkaddr;
-+}
-+
-+static int
-+grub_get_node_path (struct grub_f2fs_inode *inode, grub_uint32_t block,
-+	grub_uint32_t offset[4], grub_uint32_t noffset[4])
-+{
-+  grub_uint32_t direct_blks = ADDRS_PER_BLOCK;
-+  grub_uint32_t dptrs_per_blk = NIDS_PER_BLOCK;
-+  grub_uint32_t indirect_blks = ADDRS_PER_BLOCK * NIDS_PER_BLOCK;
-+  grub_uint32_t dindirect_blks = indirect_blks * NIDS_PER_BLOCK;
-+  grub_uint32_t direct_index = DEF_ADDRS_PER_INODE;
-+  int n = 0;
-+  int level = 0;
-+
-+  if (inode->i_inline & F2FS_INLINE_XATTR)
-+    direct_index -= F2FS_INLINE_XATTR_ADDRS;
-+
-+  noffset[0] = 0;
-+
-+  if (block < direct_index)
-+    {
-+      offset[n] = block;
-+      goto got;
-+    }
-+
-+  block -= direct_index;
-+  if (block < direct_blks)
-+    {
-+      offset[n++] = NODE_DIR1_BLOCK;
-+      noffset[n] = 1;
-+      offset[n] = block;
-+      level = 1;
-+      goto got;
-+    }
-+
-+  block -= direct_blks;
-+  if (block < direct_blks)
-+    {
-+      offset[n++] = NODE_DIR2_BLOCK;
-+      noffset[n] = 2;
-+      offset[n] = block;
-+      level = 1;
-+      goto got;
-+    }
-+
-+  block -= direct_blks;
-+  if (block < indirect_blks)
-+    {
-+      offset[n++] = NODE_IND1_BLOCK;
-+      noffset[n] = 3;
-+      offset[n++] = block / direct_blks;
-+      noffset[n] = 4 + offset[n - 1];
-+      offset[n] = block % direct_blks;
-+      level = 2;
-+      goto got;
-+    }
-+
-+  block -= indirect_blks;
-+  if (block < indirect_blks)
-+    {
-+      offset[n++] = NODE_IND2_BLOCK;
-+      noffset[n] = 4 + dptrs_per_blk;
-+      offset[n++] = block / direct_blks;
-+      noffset[n] = 5 + dptrs_per_blk + offset[n - 1];
-+      offset[n] = block % direct_blks;
-+      level = 2;
-+      goto got;
-+    }
-+
-+  block -= indirect_blks;
-+  if (block < dindirect_blks)
-+    {
-+      offset[n++] = NODE_DIND_BLOCK;
-+      noffset[n] = 5 + (dptrs_per_blk * 2);
-+      offset[n++] = block / indirect_blks;
-+      noffset[n] = 6 + (dptrs_per_blk * 2) +
-+      offset[n - 1] * (dptrs_per_blk + 1);
-+      offset[n++] = (block / direct_blks) % dptrs_per_blk;
-+      noffset[n] = 7 + (dptrs_per_blk * 2) +
-+		offset[n - 2] * (dptrs_per_blk + 1) + offset[n - 1];
-+      offset[n] = block % direct_blks;
-+      level = 3;
-+      goto got;
-+    }
-+got:
-+  return level;
-+}
-+
-+static grub_err_t
-+grub_f2fs_read_node (struct grub_f2fs_data *data,
-+	grub_uint32_t nid, struct grub_f2fs_node *np)
-+{
-+  grub_uint32_t blkaddr;
-+
-+  blkaddr = get_node_blkaddr (data, nid);
-+  if (!blkaddr)
-+    return grub_errno;
-+
-+  return grub_f2fs_block_read (data, blkaddr, np);
-+}
-+
-+static struct grub_f2fs_data *
-+grub_f2fs_mount (grub_disk_t disk)
-+{
-+  struct grub_f2fs_data *data;
-+  grub_err_t err;
-+
-+  data = grub_malloc (sizeof (*data));
-+  if (!data)
-+    return NULL;
-+
-+  data->disk = disk;
-+
-+  if (grub_f2fs_read_sb (data, F2FS_SUPER_OFFSET0))
-+    {
-+      if (grub_f2fs_read_sb (data, F2FS_SUPER_OFFSET1))
-+        {
-+          if (grub_errno == GRUB_ERR_NONE)
-+            grub_error (GRUB_ERR_BAD_FS,
-+			"not a F2FS filesystem (no superblock)");
-+          goto fail;
-+        }
-+    }
-+
-+  data->root_ino = grub_le_to_cpu32 (data->sblock.root_ino);
-+  data->cp_blkaddr = grub_le_to_cpu32 (data->sblock.cp_blkaddr);
-+  data->nat_blkaddr = grub_le_to_cpu32 (data->sblock.nat_blkaddr);
-+  data->blocks_per_seg = 1 <<
-+	grub_le_to_cpu32 (data->sblock.log_blocks_per_seg);
-+
-+  err = grub_f2fs_read_cp (data);
-+  if (err)
-+    goto fail;
-+
-+  data->nat_bitmap = __nat_bitmap_ptr (data);
-+
-+  err = get_nat_journal (data);
-+  if (err)
-+    goto fail;
-+
-+  data->diropen.data = data;
-+  data->diropen.ino = data->root_ino;
-+  data->diropen.inode_read = 1;
-+  data->inode = &data->diropen.inode;
-+
-+  err = grub_f2fs_read_node (data, data->root_ino, data->inode);
-+  if (err)
-+    goto fail;
-+
-+  return data;
-+
-+fail:
-+  grub_free (data);
-+  return NULL;
-+}
-+
-+/* guarantee inline_data was handled by caller */
-+static grub_disk_addr_t
-+grub_f2fs_get_block (grub_fshelp_node_t node, grub_disk_addr_t block_ofs)
-+{
-+  struct grub_f2fs_data *data = node->data;
-+  struct grub_f2fs_inode *inode = &node->inode.i;
-+  grub_uint32_t offset[4], noffset[4], nids[4];
-+  struct grub_f2fs_node *node_block;
-+  grub_uint32_t block_addr = -1;
-+  int level, i;
-+
-+  level = grub_get_node_path (inode, block_ofs, offset, noffset);
-+  if (level == 0)
-+    return grub_le_to_cpu32 (inode->i_addr[offset[0]]);
-+
-+  node_block = grub_malloc (F2FS_BLKSIZE);
-+  if (!node_block)
-+    return -1;
-+
-+  nids[1] = __get_node_id (&node->inode, offset[0], 1);
-+
-+  /* get indirect or direct nodes */
-+  for (i = 1; i <= level; i++)
-+    {
-+      grub_f2fs_read_node (data, nids[i], node_block);
-+      if (grub_errno)
-+        goto fail;
-+
-+      if (i < level)
-+        nids[i + 1] = __get_node_id (node_block, offset[i], 0);
-+    }
-+
-+  block_addr = grub_le_to_cpu32 (node_block->dn.addr[offset[level]]);
-+fail:
-+  grub_free (node_block);
-+  return block_addr;
-+}
-+
-+static grub_ssize_t
-+grub_f2fs_read_file (grub_fshelp_node_t node,
-+		grub_disk_read_hook_t read_hook, void *read_hook_data,
-+		grub_off_t pos, grub_size_t len, char *buf)
-+{
-+  struct grub_f2fs_inode *inode = &node->inode.i;
-+  grub_off_t filesize = grub_f2fs_file_size (inode);
-+  char *inline_addr = __inline_addr (inode);
-+
-+  if (inode->i_inline & F2FS_INLINE_DATA)
-+    {
-+      if (filesize > MAX_INLINE_DATA)
-+        return -1;
-+      if (len > filesize - pos)
-+        len = filesize - pos;
-+
-+      grub_memcpy (buf, inline_addr + pos, len);
-+      return len;
-+    }
-+
-+  return grub_fshelp_read_file (node->data->disk, node,
-+			read_hook, read_hook_data,
-+			pos, len, buf, grub_f2fs_get_block,
-+			filesize,
-+			F2FS_BLK_SEC_BITS, 0);
-+}
-+
-+static char *
-+grub_f2fs_read_symlink (grub_fshelp_node_t node)
-+{
-+  char *symlink;
-+  struct grub_fshelp_node *diro = node;
-+  grub_uint64_t filesize;
-+
-+  if (!diro->inode_read)
-+    {
-+      grub_f2fs_read_node (diro->data, diro->ino, &diro->inode);
-+      if (grub_errno)
-+        return 0;
-+    }
-+
-+  filesize = grub_f2fs_file_size(&diro->inode.i);
-+
-+  symlink = grub_malloc (filesize + 1);
-+  if (!symlink)
-+    return 0;
-+
-+  grub_f2fs_read_file (diro, 0, 0, 0, filesize, symlink);
-+  if (grub_errno)
-+    {
-+      grub_free (symlink);
-+      return 0;
-+    }
-+
-+  symlink[filesize] = '\0';
-+  return symlink;
-+}
-+
-+static int
-+grub_f2fs_check_dentries (struct grub_f2fs_dir_iter_ctx *ctx)
-+{
-+  struct grub_fshelp_node *fdiro;
-+  int i;
-+
-+  for (i = 0; i < ctx->max;)
-+    {
-+      char *filename;
-+      enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN;
-+      enum FILE_TYPE ftype;
-+      int name_len;
-+      int ret;
-+
-+      if (grub_f2fs_test_bit_le (i, ctx->bitmap) == 0)
-+        {
-+          i++;
-+          continue;
-+        }
-+
-+      ftype = ctx->dentry[i].file_type;
-+      name_len = grub_le_to_cpu16 (ctx->dentry[i].name_len);
-+      filename = grub_malloc (name_len + 1);
-+      if (!filename)
-+        return 0;
-+
-+      grub_memcpy (filename, ctx->filename[i], name_len);
-+      filename[name_len] = 0;
-+
-+      fdiro = grub_malloc (sizeof (struct grub_fshelp_node));
-+      if (!fdiro)
-+        {
-+          grub_free(filename);
-+          return 0;
-+        }
-+
-+      if (ftype == F2FS_FT_DIR)
-+        type = GRUB_FSHELP_DIR;
-+      else if (ftype == F2FS_FT_SYMLINK)
-+        type = GRUB_FSHELP_SYMLINK;
-+      else if (ftype == F2FS_FT_REG_FILE)
-+        type = GRUB_FSHELP_REG;
-+
-+      fdiro->data = ctx->data;
-+      fdiro->ino = grub_le_to_cpu32 (ctx->dentry[i].ino);
-+      fdiro->inode_read = 0;
-+
-+      ret = ctx->hook (filename, type, fdiro, ctx->hook_data);
-+      grub_free(filename);
-+      if (ret)
-+        return 1;
-+
-+      i += (name_len + F2FS_SLOT_LEN - 1) / F2FS_SLOT_LEN;
-+    }
-+    return 0;
-+}
-+
-+static int
-+grub_f2fs_iterate_inline_dir (struct grub_f2fs_inode *dir,
-+	struct grub_f2fs_dir_iter_ctx *ctx)
-+{
-+  struct grub_f2fs_inline_dentry *de_blk;
-+
-+  de_blk = (struct grub_f2fs_inline_dentry *) __inline_addr (dir);
-+
-+  ctx->bitmap = de_blk->dentry_bitmap;
-+  ctx->dentry = de_blk->dentry;
-+  ctx->filename = de_blk->filename;
-+  ctx->max = NR_INLINE_DENTRY;
-+
-+  return grub_f2fs_check_dentries (ctx);
-+}
-+
-+static int
-+grub_f2fs_iterate_dir (grub_fshelp_node_t dir,
-+	grub_fshelp_iterate_dir_hook_t hook, void *hook_data)
-+{
-+  struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir;
-+  struct grub_f2fs_inode *inode;
-+  struct grub_f2fs_dir_iter_ctx ctx = {
-+    .data = diro->data,
-+    .hook = hook,
-+    .hook_data = hook_data
-+  };
-+  grub_off_t fpos = 0;
-+
-+  if (!diro->inode_read)
-+    {
-+      grub_f2fs_read_node (diro->data, diro->ino, &diro->inode);
-+      if (grub_errno)
-+	return 0;
-+    }
-+
-+  inode = &diro->inode.i;
-+
-+  if (inode->i_inline & F2FS_INLINE_DENTRY)
-+    return grub_f2fs_iterate_inline_dir (inode, &ctx);
-+
-+  while (fpos < grub_f2fs_file_size (inode))
-+    {
-+      struct grub_f2fs_dentry_block *de_blk;
-+      char *buf;
-+      int ret;
-+
-+      buf = grub_zalloc (F2FS_BLKSIZE);
-+      if (!buf)
-+        return 0;
-+
-+      grub_f2fs_read_file (diro, 0, 0, fpos, F2FS_BLKSIZE, buf);
-+      if (grub_errno)
-+        {
-+          grub_free (buf);
-+          return 0;
-+        }
-+
-+      de_blk = (struct grub_f2fs_dentry_block *) buf;
-+
-+      ctx.bitmap = de_blk->dentry_bitmap;
-+      ctx.dentry = de_blk->dentry;
-+      ctx.filename = de_blk->filename;
-+      ctx.max = NR_DENTRY_IN_BLOCK;
-+
-+      ret = grub_f2fs_check_dentries (&ctx);
-+      grub_free (buf);
-+      if (ret)
-+        return 1;
-+
-+      fpos += F2FS_BLKSIZE;
-+    }
-+  return 0;
-+}
-+
-+static int
-+grub_f2fs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
-+	      grub_fshelp_node_t node, void *data)
-+{
-+  struct grub_f2fs_dir_ctx *ctx = data;
-+  struct grub_dirhook_info info;
-+
-+  grub_memset (&info, 0, sizeof (info));
-+  if (!node->inode_read)
-+    {
-+      grub_f2fs_read_node (ctx->data, node->ino, &node->inode);
-+      if (!grub_errno)
-+        node->inode_read = 1;
-+      grub_errno = GRUB_ERR_NONE;
-+    }
-+  if (node->inode_read)
-+    {
-+      info.mtimeset = 1;
-+      info.mtime = grub_le_to_cpu64 (node->inode.i.i_mtime);
-+    }
-+
-+  info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
-+  grub_free (node);
-+  return ctx->hook (filename, &info, ctx->hook_data);
-+}
-+
-+static grub_err_t
-+grub_f2fs_dir (grub_device_t device, const char *path,
-+	grub_fs_dir_hook_t hook, void *hook_data)
-+{
-+  struct grub_f2fs_dir_ctx ctx = {
-+    .hook = hook,
-+    .hook_data = hook_data
-+  };
-+  struct grub_fshelp_node *fdiro = 0;
-+
-+  grub_dl_ref (my_mod);
-+
-+  ctx.data = grub_f2fs_mount (device->disk);
-+  if (!ctx.data)
-+    goto fail;
-+
-+  grub_fshelp_find_file (path, &ctx.data->diropen, &fdiro,
-+		grub_f2fs_iterate_dir, grub_f2fs_read_symlink,
-+		GRUB_FSHELP_DIR);
-+  if (grub_errno)
-+    goto fail;
-+
-+  grub_f2fs_iterate_dir (fdiro, grub_f2fs_dir_iter, &ctx);
-+
-+fail:
-+  if (fdiro != &ctx.data->diropen)
-+    grub_free (fdiro);
-+ grub_free (ctx.data);
-+ grub_dl_unref (my_mod);
-+ return grub_errno;
-+}
-+
-+
-+/* Open a file named NAME and initialize FILE.  */
-+static grub_err_t
-+grub_f2fs_open (struct grub_file *file, const char *name)
-+{
-+  struct grub_f2fs_data *data = NULL;
-+  struct grub_fshelp_node *fdiro = 0;
-+  struct grub_f2fs_inode *inode;
-+
-+  grub_dl_ref (my_mod);
-+
-+  data = grub_f2fs_mount (file->device->disk);
-+  if (!data)
-+    goto fail;
-+
-+  grub_fshelp_find_file (name, &data->diropen, &fdiro,
-+			grub_f2fs_iterate_dir, grub_f2fs_read_symlink,
-+			GRUB_FSHELP_REG);
-+  if (grub_errno)
-+    goto fail;
-+
-+  if (!fdiro->inode_read)
-+    {
-+      grub_f2fs_read_node (data, fdiro->ino, &fdiro->inode);
-+      if (grub_errno)
-+	goto fail;
-+    }
-+
-+  grub_memcpy (data->inode, &fdiro->inode, sizeof (*data->inode));
-+  grub_free (fdiro);
-+
-+  inode = &(data->inode->i);
-+  file->size = grub_f2fs_file_size (inode);
-+  file->data = data;
-+  file->offset = 0;
-+
-+  if (inode->i_inline & F2FS_INLINE_DATA && file->size > MAX_INLINE_DATA)
-+    grub_error (GRUB_ERR_BAD_FS, "corrupted inline_data: need fsck");
-+  return 0;
-+
-+fail:
-+  if (fdiro != &data->diropen)
-+    grub_free (fdiro);
-+  grub_free (data);
-+
-+  grub_dl_unref (my_mod);
-+
-+  return grub_errno;
-+}
-+
-+static grub_ssize_t
-+grub_f2fs_read (grub_file_t file, char *buf, grub_size_t len)
-+{
-+  struct grub_f2fs_data *data = (struct grub_f2fs_data *) file->data;
-+
-+  return grub_f2fs_read_file (&data->diropen,
-+		file->read_hook, file->read_hook_data,
-+		file->offset, len, buf);
-+}
-+
-+static grub_err_t
-+grub_f2fs_close (grub_file_t file)
-+{
-+  struct grub_f2fs_data *data = (struct grub_f2fs_data *) file->data;
-+
-+  grub_free (data);
-+
-+  grub_dl_unref (my_mod);
-+
-+  return GRUB_ERR_NONE;
-+}
-+
-+static grub_uint8_t *
-+grub_f2fs_utf16_to_utf8 (grub_uint16_t *in_buf_le)
-+{
-+  grub_uint16_t in_buf[MAX_VOLUME_NAME];
-+  grub_uint8_t *out_buf;
-+  int len = 0;
-+
-+  out_buf = grub_malloc (MAX_VOLUME_NAME * GRUB_MAX_UTF8_PER_UTF16 + 1);
-+  if (!out_buf)
-+    return NULL;
-+
-+  while (*in_buf_le != 0 && len < MAX_VOLUME_NAME) {
-+    in_buf[len] = grub_le_to_cpu16 (in_buf_le[len]);
-+    len++;
-+  }
-+
-+  *grub_utf16_to_utf8 (out_buf, in_buf, len) = '\0';
-+  return out_buf;
-+}
-+
-+static grub_err_t
-+grub_f2fs_label (grub_device_t device, char **label)
-+{
-+  struct grub_f2fs_data *data;
-+  grub_disk_t disk = device->disk;
-+
-+  grub_dl_ref (my_mod);
-+
-+  data = grub_f2fs_mount (disk);
-+  if (data)
-+    *label = (char *) grub_f2fs_utf16_to_utf8 (data->sblock.volume_name);
-+  else
-+    *label = NULL;
-+
-+  grub_free (data);
-+  grub_dl_unref (my_mod);
-+  return grub_errno;
-+}
-+
-+static grub_err_t
-+grub_f2fs_uuid (grub_device_t device, char **uuid)
-+{
-+  struct grub_f2fs_data *data;
-+  grub_disk_t disk = device->disk;
-+
-+  grub_dl_ref (my_mod);
-+
-+  data = grub_f2fs_mount (disk);
-+  if (data)
-+    {
-+      *uuid =
-+	grub_xasprintf
-+	("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-+		data->sblock.uuid[0], data->sblock.uuid[1],
-+		data->sblock.uuid[2], data->sblock.uuid[3],
-+		data->sblock.uuid[4], data->sblock.uuid[5],
-+		data->sblock.uuid[6], data->sblock.uuid[7],
-+		data->sblock.uuid[8], data->sblock.uuid[9],
-+		data->sblock.uuid[10], data->sblock.uuid[11],
-+		data->sblock.uuid[12], data->sblock.uuid[13],
-+		data->sblock.uuid[14], data->sblock.uuid[15]);
-+    }
-+  else
-+    *uuid = NULL;
-+
-+  grub_free (data);
-+  grub_dl_unref (my_mod);
-+  return grub_errno;
-+}
-+
-+static struct grub_fs grub_f2fs_fs = {
-+  .name = "f2fs",
-+  .dir = grub_f2fs_dir,
-+  .open = grub_f2fs_open,
-+  .read = grub_f2fs_read,
-+  .close = grub_f2fs_close,
-+  .label = grub_f2fs_label,
-+  .uuid = grub_f2fs_uuid,
-+#ifdef GRUB_UTIL
-+  .reserved_first_sector = 1,
-+  .blocklist_install = 0,
-+#endif
-+  .next = 0
-+};
-+
-+GRUB_MOD_INIT (f2fs)
-+{
-+  grub_fs_register (&grub_f2fs_fs);
-+  my_mod = mod;
-+}
-+
-+GRUB_MOD_FINI (f2fs)
-+{
-+  grub_fs_unregister (&grub_f2fs_fs);
-+}
-diff --git a/po/exclude.pot b/po/exclude.pot
-index 0a9b215ea..816089c30 100644
---- a/po/exclude.pot
-+++ b/po/exclude.pot
-@@ -1214,6 +1214,7 @@ msgstr ""
- 
- #: grub-core/commands/xnu_uuid.c:75 grub-core/fs/jfs.c:924
- #: grub-core/fs/nilfs2.c:1135
-+#: grub-core/fs/f2fs.c:1259
- #, c-format
- msgid "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
- msgstr ""
-diff --git a/tests/f2fs_test.in b/tests/f2fs_test.in
-new file mode 100644
-index 000000000..1ea77c826
---- /dev/null
-+++ b/tests/f2fs_test.in
-@@ -0,0 +1,19 @@
-+#!/bin/sh
-+
-+set -e
-+
-+if [ "x$EUID" = "x" ] ; then
-+ EUID=`id -u`
-+fi
-+
-+if [ "$EUID" != 0 ] ; then
-+ exit 77
-+fi
-+
-+if ! which mkfs.f2fs >/dev/null 2>&1; then
-+ echo "mkfs.f2fs not installed; cannot test f2fs."
-+ exit 77
-+fi
-+
-+
-+"@builddir@/grub-fs-tester" f2fs
-diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
-index 2337771a1..333c45035 100644
---- a/tests/util/grub-fs-tester.in
-+++ b/tests/util/grub-fs-tester.in
-@@ -145,7 +145,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE +
- 	xsquash*)
- 	    MINBLKSIZE=4096
- 	    MAXBLKSIZE=1048576;;
--	xxfs)
-+	xxfs|xf2fs)
- 	    MINBLKSIZE=$SECSIZE
- 		# OS Limitation: GNU/Linux doesn't accept > 4096
- 	    MAXBLKSIZE=4096;;
-@@ -268,6 +268,10 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE +
- 		x"btrfs"*)
- 		    FSLABEL="grub_;/testé莭莽😁киритi urewfceniuewruevrewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoi";;
- 
-+	    # FS LIMITATION: f2fs label is at most 512 UTF-16 chars
-+		x"f2fs")
-+		    FSLABEL="grub_;/testé䏌䐓䏕киритiurewfceniuewruewnuuireurevueurnievrewfnerfcnevirivinrewvnirewnivrewiuvcrewvnuewvrrrewniuerwreiuviurewiuviurewnuvewnvrenurnunuvrevuurerejiremvreijnvvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoirvcreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoircreivire nverivnreivrevnureiorfnfrvoeoiroireoireoifrefoieroifoireoifoiq";;
-+
- 	    # FS LIMITATION: exfat is at most 15 UTF-16 chars
- 		x"exfat")
- 		    FSLABEL="géт ;/莭莽😁кир";;
-@@ -477,7 +481,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE +
- 	    # FIXME: Not sure about BtrFS, NTFS, JFS, AFS, UDF and SFS. Check it.
- 	# FS LIMITATION: as far as I know those FS don't store their last modification date.
- 		x"jfs_caseins" | x"jfs" | x"xfs" | x"xfs_crc" | x"btrfs"* | x"reiserfs_old" | x"reiserfs" \
--		    | x"bfs" | x"afs" \
-+		    | x"bfs" | x"afs" | x"f2fs" \
- 		    | x"tarfs" | x"cpio_"* | x"minix" | x"minix2" \
- 		    | x"minix3" | x"ntfs"* | x"udf" | x"sfs"*)
- 		    NOFSTIME=y;;
-@@ -756,6 +760,8 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE +
- 		    MOUNTDEVICE="/dev/mapper/grub_test-testvol"
- 		    MOUNTFS=ext2
- 		    "mkfs.ext2" -L "$FSLABEL" -q "${MOUNTDEVICE}"  ;;
-+		xf2fs)
-+		    "mkfs.f2fs" -l "$FSLABEL" -q "${LODEVICES[0]}" ;;
- 		xnilfs2)
- 		    "mkfs.nilfs2" -L "$FSLABEL" -b $BLKSIZE  -q "${LODEVICES[0]}" ;;
- 		xext2_old)
--- 
-2.11.0
-
diff --git a/grub-fix-texinfo-page.patch b/grub-fix-texinfo-page.patch
deleted file mode 100644
index 78967dc..0000000
--- a/grub-fix-texinfo-page.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- grub-2.00/docs/grub-dev.texi~	2013-03-21 03:42:02.280203039 +0100
-+++ grub-2.00/docs/grub-dev.texi	2013-03-21 03:42:05.150239736 +0100
-@@ -1394,8 +1394,8 @@ grub_video_blit_glyph (&glyph, color, 0,
- 
- @node Bitmap API
- @section Bitmap API
--@itemize
- @subsection grub_video_bitmap_create
-+@itemize
- @item Prototype:
- @example
- grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, unsigned int width, unsigned int height, enum grub_video_blit_format blit_format)
diff --git a/grub2-10_linux.patch b/grub2-10_linux.patch
deleted file mode 100644
index 4e1956f..0000000
--- a/grub2-10_linux.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/util/grub.d/10_linux.in	2012-04-19 01:24:38.000000000 +0400
-+++ b/util/grub.d/10_linux.in	2012-10-16 18:54:20.809871694 +0400
-@@ -129,7 +129,7 @@
-   message="$(gettext_printf "Loading Linux %s ..." ${version})"
-   sed "s/^/$submenu_indentation/" << EOF
-	echo	'$(echo "$message" | grub_quote)'
--	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
-+       linux  ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} resume=`swapon -s | grep '/dev/sd.[0-9]\{1,\}' -o | if read line; then echo "$line"; fi`
- EOF
-   if test -n "${initrd}" ; then
-     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
diff --git a/grub2-2.02-fix-grub-gen-asciih.patch b/grub2-2.02-fix-grub-gen-asciih.patch
deleted file mode 100644
index e4ed316..0000000
--- a/grub2-2.02-fix-grub-gen-asciih.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- grub-2.00/util/grub-gen-asciih.c	2014-10-13 17:34:17.286646044 +0100
-+++ ./test/grub-gen-asciih.c	2014-10-13 17:33:40.266381708 +0100
-@@ -133,6 +133,7 @@
-   fprintf (file, "/* THIS CHUNK OF BYTES IS AUTOMATICALLY GENERATED */\n");
-   fprintf (file, "unsigned char ascii_bitmaps[] =\n");
-   fprintf (file, "{\n");
-+  fprintf (file, "};\n");
- 
-   for (char_code = 0; char_code <= 0x7f; char_code++)
-     {
diff --git a/grub2-2.02-unity-mkrescue-use-grub2-dir.patch b/grub2-2.02-unity-mkrescue-use-grub2-dir.patch
index f0db162..74711ed 100644
--- a/grub2-2.02-unity-mkrescue-use-grub2-dir.patch
+++ b/grub2-2.02-unity-mkrescue-use-grub2-dir.patch
@@ -1,19 +1,19 @@
-diff -Naur grub-2.02-20180928/Makefile.am grub-2.02-20180928-p/Makefile.am
---- grub-2.02-20180928/Makefile.am	2018-09-27 14:56:45.000000000 +0200
-+++ grub-2.02-20180928-p/Makefile.am	2019-02-14 17:40:28.451060963 +0100
-@@ -424,7 +424,7 @@
- if COND_i386_coreboot
+diff -Naur grub-2.04/Makefile.am grub-2.04.tpg/Makefile.am
+--- grub-2.04/Makefile.am	2019-04-23 08:54:47.000000000 +0000
++++ grub-2.04.tpg/Makefile.am	2019-10-24 08:22:13.395246285 +0000
+@@ -425,7 +425,7 @@
+ FS_PAYLOAD_MODULES ?= $(shell cat grub-core/fs.lst)
  default_payload.elf: grub-mkstandalone grub-mkimage FORCE
  	test -f $@ && rm $@ || true
--	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(shell cat grub-core/fs.lst) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
-+	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(shell cat grub-core/fs.lst) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub2/grub.cfg=$(srcdir)/coreboot.cfg
+-	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(FS_PAYLOAD_MODULES) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
++	pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(FS_PAYLOAD_MODULES) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub2/grub.cfg=$(srcdir)/coreboot.cfg
  endif
  
  endif
-diff -Naur grub-2.02-20180928/util/grub-install.c grub-2.02-20180928-p/util/grub-install.c
---- grub-2.02-20180928/util/grub-install.c	2018-09-27 14:56:45.000000000 +0200
-+++ grub-2.02-20180928-p/util/grub-install.c	2019-02-14 17:34:35.694403965 +0100
-@@ -1611,7 +1611,7 @@
+diff -Naur grub-2.04/util/grub-install.c grub-2.04.tpg/util/grub-install.c
+--- grub-2.04/util/grub-install.c	2019-04-23 08:54:47.000000000 +0000
++++ grub-2.04.tpg/util/grub-install.c	2019-10-24 08:24:18.435256415 +0000
+@@ -1640,7 +1640,7 @@
      case GRUB_INSTALL_PLATFORM_I386_IEEE1275:
      case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
        {
@@ -22,27 +22,10 @@ diff -Naur grub-2.02-20180928/util/grub-install.c grub-2.02-20180928-p/util/grub
  	grub_install_copy_file (imgfile, dst, 1);
  	free (dst);
        }
-@@ -1806,7 +1806,7 @@
- 	}
-       break;
-     case GRUB_INSTALL_PLATFORM_MIPS_ARC:
--      grub_install_sgi_setup (install_device, imgfile, "grub");
-+      grub_install_sgi_setup (install_device, imgfile, "grub2");
-       break;
- 
-     case GRUB_INSTALL_PLATFORM_I386_EFI:
-diff -Naur grub-2.02-20180928/util/grub-mkimage.c grub-2.02-20180928-p/util/grub-mkimage.c
---- grub-2.02-20180928/util/grub-mkimage.c	2018-09-27 14:56:45.000000000 +0200
-+++ grub-2.02-20180928-p/util/grub-mkimage.c	2019-02-14 17:41:39.220393993 +0100
-@@ -58,7 +58,6 @@
- 
- #include "progname.h"
- 
--
- 
- static struct argp_option options[] = {
-   {"directory",  'd', N_("DIR"), 0,
-@@ -69,7 +68,7 @@
+diff -Naur grub-2.04/util/grub-mkimage.c grub-2.04.tpg/util/grub-mkimage.c
+--- grub-2.04/util/grub-mkimage.c	2019-04-23 08:54:47.000000000 +0000
++++ grub-2.04.tpg/util/grub-mkimage.c	2019-10-24 08:24:41.592258291 +0000
+@@ -69,7 +69,7 @@
     /* TRANSLATORS: "memdisk" here isn't an identifier, it can be translated.
      "embed" is a verb (command description).  "*/
     N_("embed FILE as a memdisk image\n"
@@ -51,7 +34,7 @@ diff -Naur grub-2.02-20180928/util/grub-mkimage.c grub-2.02-20180928-p/util/grub
        " but the prefix itself can be overridden by later options"), 0},
    {"dtb",  'D', N_("FILE"), 0, N_("embed FILE as a device tree (DTB)\n"), 0},
     /* TRANSLATORS: "embed" is a verb (command description).  "*/
-@@ -175,7 +174,7 @@
+@@ -175,7 +175,7 @@
        if (arguments->prefix)
  	free (arguments->prefix);
  
@@ -60,9 +43,9 @@ diff -Naur grub-2.02-20180928/util/grub-mkimage.c grub-2.02-20180928-p/util/grub
        break;
  
      case 'D':
-diff -Naur grub-2.02-20180928/util/grub-mkrescue.c grub-2.02-20180928-p/util/grub-mkrescue.c
---- grub-2.02-20180928/util/grub-mkrescue.c	2018-09-27 14:56:45.000000000 +0200
-+++ grub-2.02-20180928-p/util/grub-mkrescue.c	2019-02-14 17:34:35.695403969 +0100
+diff -Naur grub-2.04/util/grub-mkrescue.c grub-2.04.tpg/util/grub-mkrescue.c
+--- grub-2.04/util/grub-mkrescue.c	2019-05-20 11:01:11.000000000 +0000
++++ grub-2.04.tpg/util/grub-mkrescue.c	2019-10-24 08:29:59.010284008 +0000
 @@ -261,14 +261,14 @@
  
    load_cfg_f = grub_util_fopen (load_cfg, "wb");
@@ -98,7 +81,7 @@ diff -Naur grub-2.02-20180928/util/grub-mkrescue.c grub-2.02-20180928-p/util/gru
    grub_install_mkdir_p (boot_grub);
    romdir = grub_util_path_concat (2, boot_grub, "roms");
    grub_util_mkdir (romdir);
-@@ -591,12 +591,12 @@
+@@ -593,12 +593,12 @@
        grub_install_push_module ("biosdisk");
        grub_install_push_module ("iso9660");
        grub_install_make_image_wrap (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
@@ -113,7 +96,7 @@ diff -Naur grub-2.02-20180928/util/grub-mkrescue.c grub-2.02-20180928-p/util/gru
        xorriso_push ("-no-emul-boot");
        xorriso_push ("-boot-load-size");
        xorriso_push ("4");
-@@ -635,7 +635,7 @@
+@@ -637,7 +637,7 @@
  	      fwrite (buf, 1, 512, sa);
  	      
  	      grub_install_make_image_wrap_file (source_dirs[GRUB_INSTALL_PLATFORM_I386_PC],
@@ -122,7 +105,7 @@ diff -Naur grub-2.02-20180928/util/grub-mkrescue.c grub-2.02-20180928-p/util/gru
  						 0, load_cfg,
  						 "i386-pc", 0);
  	      sz = ftello (sa);
-@@ -831,8 +831,8 @@
+@@ -845,8 +845,8 @@
        grub_install_copy_file (grub_chrp, bootx, 1);
        grub_install_mkdir_p (ppc_chrp);
        grub_install_copy_file (bisrc, bitgt, 1);
@@ -133,7 +116,7 @@ diff -Naur grub-2.02-20180928/util/grub-mkrescue.c grub-2.02-20180928-p/util/gru
        /* FIXME: add PreP */
        if (system_area == SYS_AREA_COMMON)
  	{
-@@ -881,25 +881,25 @@
+@@ -895,25 +895,25 @@
        xorriso_push ("-B");
        xorriso_push (",");
        xorriso_push ("--grub2-sparc-core");
@@ -166,9 +149,9 @@ diff -Naur grub-2.02-20180928/util/grub-mkrescue.c grub-2.02-20180928-p/util/gru
      }
  
    make_image_fwdisk (GRUB_INSTALL_PLATFORM_MIPSEL_ARC, "mipsel-arc", "arc.exe");
-diff -Naur grub-2.02-20180928/util/grub-mkstandalone.c grub-2.02-20180928-p/util/grub-mkstandalone.c
---- grub-2.02-20180928/util/grub-mkstandalone.c	2018-09-27 14:56:45.000000000 +0200
-+++ grub-2.02-20180928-p/util/grub-mkstandalone.c	2019-02-14 17:34:35.695403969 +0100
+diff -Naur grub-2.04/util/grub-mkstandalone.c grub-2.04.tpg/util/grub-mkstandalone.c
+--- grub-2.04/util/grub-mkstandalone.c	2018-11-24 17:13:02.000000000 +0000
++++ grub-2.04.tpg/util/grub-mkstandalone.c	2019-10-24 08:28:23.869276300 +0000
 @@ -112,7 +112,7 @@
  
  struct argp argp = {
diff --git a/grub2-mkfont-fix.patch b/grub2-mkfont-fix.patch
deleted file mode 100644
index 545e636..0000000
--- a/grub2-mkfont-fix.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur grub-2.00/util/grub-mkfont.c grub-new/util/grub-mkfont.c
---- grub-2.00/util/grub-mkfont.c	2012-03-10 16:17:57.000000000 +0400
-+++ grub-new/util/grub-mkfont.c	2012-12-04 18:00:35.463252107 +0400
-@@ -1101,7 +1101,7 @@
-       arguments->font_info.desc = strtoul (arg, NULL, 0);
-       break;
- 
--    case 'e':
-+    case 'c':
-       arguments->font_info.asce = strtoul (arg, NULL, 0);
-       break;
- 
diff --git a/grub2-move-terminal.patch b/grub2-move-terminal.patch
deleted file mode 100644
index 4af0c71..0000000
--- a/grub2-move-terminal.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -Naur grub-2.00/grub-core/gfxmenu/view.c grub-new/grub-core/gfxmenu/view.c
---- grub-2.00/grub-core/gfxmenu/view.c	2012-02-24 14:19:45.000000000 +0400
-+++ grub-new/grub-core/gfxmenu/view.c	2012-11-30 17:10:51.554194628 +0400
-@@ -361,11 +361,21 @@
- static void
- init_terminal (grub_gfxmenu_view_t view)
- {
--  term_rect.width = view->screen.width * 7 / 10;
--  term_rect.height = view->screen.height * 7 / 10;
-+  term_rect.width = 731;
-+  term_rect.height = 334;
- 
--  term_rect.x = view->screen.x + view->screen.width * (10 - 7) / 10 / 2;
--  term_rect.y = view->screen.y + view->screen.height * (10 - 7) / 10 / 2;
-+  term_rect.x = view->screen.x + view->screen.width / 2 - 365;
-+  term_rect.y = view->screen.y + view->screen.height / 2 - 128;
-+
-+  if (term_rect.width > view->screen.width)
-+  {
-+    term_rect.x = 0;
-+    term_rect.width = view->screen.width;
-+  }
-+  if ((term_rect.height - 128) * 2 > view->screen.height)
-+  {
-+    term_rect.height = view->screen.height - term_rect.y - 8;
-+  }
- 
-   term_view = view;
- 
diff --git a/grub2-name-corrections.patch b/grub2-name-corrections.patch
deleted file mode 100644
index 36650ea..0000000
--- a/grub2-name-corrections.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From d4bd41f972c6e22b86c773cbba2a1e14f400a8be Mon Sep 17 00:00:00 2001
-From: Peter Jones <pjones@redhat.com>
-Date: Mon, 14 Mar 2011 14:27:42 -0400
-Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
-
----
- util/grub.d/10_linux.in     |    4 ++--
- util/grub.d/20_linux_xen.in |    4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index a09c3e6..0b0df78 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
-@@ -29,9 +29,9 @@ export TEXTDOMAINDIR=@localedir@
- CLASS="--class gnu-linux --class gnu --class os"
- 
- if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
--  OS=GNU/Linux
-+  OS="$(sed 's, release .*$,,g' /etc/system-release) Linux"
- else
--  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
-+  OS="${GRUB_DISTRIBUTOR} Linux"
-   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
- fi
- 
-diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
-index ee49cd9..10422b0 100644
---- a/util/grub.d/20_linux_xen.in
-+++ b/util/grub.d/20_linux_xen.in
-@@ -29,9 +29,9 @@ export TEXTDOMAINDIR=@localedir@
- CLASS="--class gnu-linux --class gnu --class os --class xen"
- 
- if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
--  OS=GNU/Linux
-+  OS="$(sed 's, release .*$,,g' /etc/system-release) Linux"
- else
--  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
-+  OS="${GRUB_DISTRIBUTOR} Linux"
-   CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
- fi
- 
--- 
-1.7.4
-
diff --git a/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch b/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch
deleted file mode 100644
index d2e34eb..0000000
--- a/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-Index: grub-2.02~beta2/util/setup.c
-===================================================================
---- grub-2.02~beta2.orig/util/setup.c
-+++ grub-2.02~beta2/util/setup.c
-@@ -501,8 +501,44 @@ SETUP (const char *dir,
-       err = grub_util_ldm_embed (dest_dev->disk, &nsec, maxsec,
- 				 GRUB_EMBED_PCBIOS, &sectors);
-     else if (ctx.dest_partmap)
--      err = ctx.dest_partmap->embed (dest_dev->disk, &nsec, maxsec,
--				     GRUB_EMBED_PCBIOS, &sectors);
-+      {
-+        err = ctx.dest_partmap->embed (dest_dev->disk, &nsec, maxsec,
-+				       GRUB_EMBED_PCBIOS, &sectors);
-+#ifdef GRUB_SETUP_BIOS
-+	if (err == GRUB_ERR_OUT_OF_RANGE
-+	    && strcmp (ctx.dest_partmap->name, "msdos") == 0
-+	    && dest_dev->disk->id == root_dev->disk->id
-+	    && dest_dev->disk->dev->id == root_dev->disk->dev->id)
-+	  {
-+	    grub_fs_t root_fs;
-+
-+	    root_fs = grub_fs_probe (root_dev);
-+	    if (root_fs && root_fs->embed)
-+	      {
-+		grub_disk_addr_t *fs_sectors;
-+		unsigned int fs_nsec;
-+
-+		fs_sectors = NULL;
-+		fs_nsec = core_sectors;
-+		err = root_fs->embed (root_dev, &fs_nsec, maxsec,
-+				      GRUB_EMBED_PCBIOS, &fs_sectors);
-+		if (!err && fs_nsec >= core_sectors)
-+		  {
-+		    grub_util_info ("Your msdos embedding area is too small, will use file system embedding area instead");
-+		    sectors = fs_sectors;
-+		    nsec = fs_nsec;
-+		    ctx.container = root_dev->disk->partition;
-+		    core_dev = root_dev;
-+		  }
-+		else
-+		  {
-+		    if (fs_sectors)
-+		      grub_free (fs_sectors);
-+		  }
-+	      }
-+	  }
-+#endif
-+      }
-     else
-       err = fs->embed (dest_dev, &nsec, maxsec,
- 		       GRUB_EMBED_PCBIOS, &sectors);
-@@ -584,7 +620,7 @@ SETUP (const char *dir,
- 
-     /* Write the core image onto the disk.  */
-     for (i = 0; i < nsec; i++)
--      grub_disk_write (dest_dev->disk, sectors[i], 0,
-+      grub_disk_write (core_dev->disk, sectors[i], 0,
- 		       GRUB_DISK_SECTOR_SIZE,
- 		       core_img + i * GRUB_DISK_SECTOR_SIZE);
- 
- 
diff --git a/grub2-theme-not_selected_item_box.patch b/grub2-theme-not_selected_item_box.patch
deleted file mode 100644
index c29cdca..0000000
--- a/grub2-theme-not_selected_item_box.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-diff -Naur grub-2.00/grub-core/gfxmenu/gui_list.c grub-new/grub-core/gfxmenu/gui_list.c
---- grub-2.00/grub-core/gfxmenu/gui_list.c	2011-12-14 14:36:07.000000000 +0400
-+++ grub-new/grub-core/gfxmenu/gui_list.c	2012-11-29 16:00:36.642209919 +0400
-@@ -58,8 +58,10 @@
-   int need_to_recreate_boxes;
-   char *theme_dir;
-   char *menu_box_pattern;
-+  char *item_box_pattern;
-   char *selected_item_box_pattern;
-   grub_gfxmenu_box_t menu_box;
-+  grub_gfxmenu_box_t item_box;
-   grub_gfxmenu_box_t selected_item_box;
- 
-   grub_gfxmenu_icon_manager_t icon_manager;
-@@ -76,11 +78,14 @@
- 
-   grub_free (self->theme_dir);
-   grub_free (self->menu_box_pattern);
-+  grub_free (self->item_box_pattern);
-   grub_free (self->selected_item_box_pattern);
-   if (self->menu_box)
-     self->menu_box->destroy (self->menu_box);
-   if (self->selected_item_box)
-     self->selected_item_box->destroy (self->selected_item_box);
-+  if (self->item_box)
-+    self->item_box->destroy (self->item_box);
-   if (self->icon_manager)
-     grub_gfxmenu_icon_manager_destroy (self->icon_manager);
- 
-@@ -115,10 +120,14 @@
-                              self->selected_item_box_pattern,
-                              self->theme_dir);
- 
-+      grub_gui_recreate_box (&self->item_box,
-+                             self->item_box_pattern,
-+                             self->theme_dir);
-+
-       self->need_to_recreate_boxes = 0;
-     }
- 
--  return (self->menu_box != 0 && self->selected_item_box != 0);
-+  return (self->menu_box != 0 && self->selected_item_box != 0 && self->item_box != 0);
- }
- 
- static int
-@@ -212,7 +221,7 @@
- static void
- draw_menu (list_impl_t self, int num_shown_items)
- {
--  if (! self->menu_box || ! self->selected_item_box)
-+  if (! self->menu_box || ! self->selected_item_box || !self->item_box)
-     return;
- 
-   int boxpad = self->item_padding;
-@@ -225,6 +234,7 @@
- 
-   make_selected_item_visible (self);
- 
-+  grub_gfxmenu_box_t itbox = self->item_box;
-   grub_gfxmenu_box_t selbox = self->selected_item_box;
-   int sel_leftpad = selbox->get_left_pad (selbox);
-   int sel_toppad = selbox->get_top_pad (selbox);
-@@ -256,7 +266,15 @@
-           selbox->draw (selbox, 0,
-                         item_top - sel_toppad);
-         }
--
-+      else
-+        {
-+          int cwidth = oviewport.width - 2 * boxpad - 2;
-+          if (itbox->get_border_width)
-+            cwidth -= itbox->get_border_width (itbox);
-+          itbox->set_content_size (itbox, cwidth, item_height - 1);
-+          itbox->draw (itbox, 0,
-+                       item_top - sel_toppad);
-+        }
-       icon = get_item_icon (self, menu_index);
-       if (icon != 0)
-         grub_video_blit_bitmap (icon, GRUB_VIDEO_BLIT_BLEND,
-@@ -302,7 +320,7 @@
- 
-   check_boxes (self);
- 
--  if (! self->menu_box || ! self->selected_item_box)
-+  if (! self->menu_box || ! self->selected_item_box || ! self->item_box)
-     return;
- 
-   grub_gui_set_viewport (&self->bounds, &vpsave);
-@@ -487,6 +505,12 @@
-       grub_free (self->menu_box_pattern);
-       self->menu_box_pattern = value ? grub_strdup (value) : 0;
-     }
-+  else if (grub_strcmp (name, "item_pixmap_style") == 0)
-+    {
-+      self->need_to_recreate_boxes = 1;
-+      grub_free (self->item_box_pattern);
-+      self->item_box_pattern = value ? grub_strdup (value) : 0;
-+    }
-   else if (grub_strcmp (name, "selected_item_pixmap_style") == 0)
-     {
-       self->need_to_recreate_boxes = 1;
-@@ -604,8 +628,10 @@
-   self->need_to_recreate_boxes = 0;
-   self->theme_dir = 0;
-   self->menu_box_pattern = 0;
-+  self->item_box_pattern = 0;
-   self->selected_item_box_pattern = 0;
-   self->menu_box = grub_gfxmenu_create_box (0, 0);
-+  self->item_box = grub_gfxmenu_create_box (0, 0);
-   self->selected_item_box = grub_gfxmenu_create_box (0, 0);
- 
-   self->icon_manager = grub_gfxmenu_icon_manager_new ();
diff --git a/grub2.spec b/grub2.spec
index 4f5d107..6861413 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -8,12 +8,12 @@
 %define platform uboot
 %endif
 
-%ifarch aarch64
+%ifarch aarch64 riscv64
 %define platform efi
 %endif
 
 %define debug_package %{nil}
-%define snapshot 20180928
+%define snapshot %{nil}
 
 %global efi %{ix86} %{x86_64} aarch64
 %define efidir openmandriva
@@ -24,8 +24,8 @@ Name:		grub2
 ## 'boot/grub' in the source , including Makefiles*
 ## and compare to grub2-2.02-unity-mkrescue-use-grub2-dir.patch
 ## do _NOT_ update without doing that .. we just go lucky until now.
-Version:	2.02
-Release:	30
+Version:	2.04
+Release:	2
 Group:		System/Kernel and hardware
 License:	GPLv3+
 Url:		http://www.gnu.org/software/grub/
@@ -42,16 +42,15 @@ Source2:	grub.default
 Source4:	grub_guide.tar.gz
 Source5:	DroidSansMonoLicense.txt
 Source6:	DroidSansMono.ttf
-Source8:	grub2-po-update.tar.gz
 Source9:	update-grub2
 Source11:	grub2.rpmlintrc
-Source12:	grub-lua-rev30.tar.xz
+# (tpg) source
+# rm -rf grub-extras && git clone https://git.savannah.gnu.org/git/grub-extras.git && cd grub-extras
+# git archive --prefix=grub-extras/ --format=tar HEAD | xz > ../grub-extras-$(date +%Y%m%d).tar.xz
+Source12:	grub-extras-20191024.tar.xz
 # documentation and simple test script for testing grub2 themes
 Source13:	mandriva-grub2-theme-test.sh
-Source14:	linguas.tar.xz
-# Used to generate source 14
-Source15:	linguas.sh
-Source16:	30-uefi_firmware
+Source14:	30-uefi_firmware
 Patch0:		grub2-locales.patch
 Patch1:		grub2-00_header.patch
 Patch2:		grub2-custom-color.patch
@@ -71,12 +70,13 @@ Patch9:		grub2-2.00-class-via-os-prober.patch
 Patch10:	grub-2.00-autoreconf-sucks.patch
 Patch11:	0468-Don-t-write-messages-to-the-screen.patch
 Patch12:	grub-2.02-beta2-custom-vendor-config.patch
-Patch13:	0001-Revert-Make-grub-install-check-for-errors-from-efibo.patch
+#Patch13:	0001-Revert-Make-grub-install-check-for-errors-from-efibo.patch
 Patch14:	fix-microcode-os-prober-initrd-line-parsing.patch
 Patch15:	grub-2.02-20180620-disable-docs.patch
 # Without this, build fails on aarch64 w/ unresolved symbol abort
 # while running grub-mkimage
 Patch16:	grub-2.02-define-abort.patch
+Patch17:	grub-2.04-grub-extras-lua-fix.patch
 
 # (crazy) these are 2 BAD patches , FIXME after Lx4
 # Patch7 prepares remove for that ( partially )
@@ -85,7 +85,6 @@ Patch100:	grub2-2.00-mga-dont_write_sparse_file_error_to_screen.patch
 Patch101:	grub2-2.00-mga-dont_write_diskfilter_error_to_screen.patch
 
 # Patches from SuSe
-Patch200:	grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch
 
 # Patches from Unity
 Patch300:	grub2-2.02-unity-mkrescue-use-grub2-dir.patch
@@ -110,10 +109,9 @@ BuildRequires:	pkgconfig(freetype2)
 BuildRequires:	pkgconfig(liblzma)
 BuildRequires:	pkgconfig(libusb)
 BuildRequires:	pkgconfig(ncursesw)
-%ifarch %{efi}
-BuildRequires:	pesign
+%ifarch %{arm} %{armx}
+BuildRequires:	gcc
 %endif
-
 Provides:	bootloader
 # (crazy) without gettext() function of grub2 is fakeed with printf ..
 Requires:       gettext-base
@@ -198,27 +196,27 @@ Documentation for GRUB.
 
 %prep
 %if "%{snapshot}" == ""
-%setup -qn grub-%{version} -a12 -a14
+%setup -qn grub-%{version} -a12
 %else
-%setup -qn grub-%{version}-%{snapshot} -a12 -a14
+%setup -qn grub-%{version}-%{snapshot} -a12
 %endif
 %autopatch -p1
 
+sed -i -e "s|^FONT_SOURCE=.*|FONT_SOURCE=%{SOURCE6}|g" configure configure.ac
+sed -ri -e 's/-g"/"/g' -e "s/-Werror//g" configure.ac
+sed -i -e 's/-Werror//g' grub-core/Makefile.am
 
-perl -pi -e 's/(\@image\{font_char_metrics,,,,)\.(png\})/$1$2/;' \
-	docs/grub-dev.texi
-
-perl -pi -e "s|(^FONT_SOURCE=)|\$1%{SOURCE6}|;" configure configure.ac
+# (tpg) remove not needed extra modules
+rm -rf grub-extras/915resolution
+rm -rf grub-extras/disabled
+rm -rf grub-extras/ntldr-img
+rm -rf grub-extras/lua
 
-sed -ri -e 's/-g"/"/g' -e "s/-Werror//g" configure.ac
-perl -pi -e 's/-Werror//;' grub-core/Makefile.am
-mkdir grub-extras
-mv lua grub-extras
 export GRUB_CONTRIB=./grub-extras
 sed -i -e 's,-I m4,-I m4 --dont-fix,g' autogen.sh
 
-tar -xf %{SOURCE8}
-cd po-update; sh ./update.sh; cd -
+# (tpg) pull latest translations
+./linguas.sh
 
 #-----------------------------------------------------------------------
 %build
@@ -231,13 +229,13 @@ export CONFIGURE_TOP="$PWD"
 # https://sourceware.org/bugzilla/show_bug.cgi?id=14187
 ./autogen.sh
 
-#(proyvind): non-UEFI boot will fail with 'alloc magic broken' on x86_64
-#            if built with clang
 %if "%{platform}" != ""
 mkdir -p %{platform}
 cd %{platform}
+# Clang causes openmandriva theme to disappear. Only black theme on non UEFI/EFI platform. Switch back to gcc (angry)
 %configure CC=gcc BUILD_CC=gcc TARGET_CC=gcc \
-	CFLAGS="-O2 -fuse-ld=bfd" \
+	CFLAGS="-Os -fuse-ld=bfd" \
+	LDFLAGS="" \
 	TARGET_LDFLAGS="-static" \
 	--with-platform=%{platform} \
 %ifarch %{x86_64}
@@ -251,7 +249,8 @@ cd %{platform}
 	--enable-device-mapper \
 	--enable-grub-mkfont \
 	--enable-device-mapper \
-	--enable-grub-emu-sdl
+	--enable-grub-emu-sdl \
+	--without-included-regex
 
 %make_build -j1 all
 cd -
@@ -265,7 +264,8 @@ cd efi
 %else
 %configure BUILD_CC=%{__cc} TARGET_CC=%{__cc} \
 %endif
-	CFLAGS="-O2 -fuse-ld=bfd" \
+	CFLAGS="-Os -fuse-ld=bfd" \
+	LDFLAGS="" \
 	TARGET_LDFLAGS="-static" \
 	--with-platform=efi \
 	--program-transform-name=s,grub,%{name}-efi, \
@@ -275,12 +275,13 @@ cd efi
 	--disable-werror \
 	--enable-grub-mkfont \
 	--enable-device-mapper \
-	--enable-grub-emu-sdl
+	--enable-grub-emu-sdl \
+	--without-included-regex
 
 %make_build ascii.h widthspec.h
 %make_build -C grub-core
 
-%define grub_modules_default all_video boot cat chain configfile echo efifwsetup efinet ext2 f2fs fat font gfxmenu gfxterm gfxterm_background gfxterm_menu gzio halt hfsplus iso9660 jpeg loadenv loopback linux lsefi lua lvm mdraid09 mdraid1x minicmd normal part_apple part_gpt part_msdos password_pbkdf2 png reboot regexp search search_fs_file search_fs_uuid search_label serial sleep sleep squash4 syslinuxcfg test tftp video xfs btrfs
+%define grub_modules_default all_video boot btrfs cat chain configfile cryptodisk echo efifwsetup efinet ext2 f2fs fat font gcry_rijndael gcry_rsa gcry_serpent gcry_sha256 gcry_twofish gcry_whirlpool gfxmenu gfxterm gfxterm_background gfxterm_menu gzio halt hfsplus iso9660 jpeg loadenv loopback linux lsefi luks lvm mdraid09 mdraid1x minicmd normal part_apple part_gpt part_msdos password_pbkdf2 probe png reboot regexp search search_fs_file search_fs_uuid search_label serial sleep squash4 syslinuxcfg test tftp video xfs
 
 %ifarch aarch64
 %define grubefiarch arm64-efi
@@ -313,7 +314,7 @@ cd -
 # (crazy) fixme? why so?
 # Script that makes part of grub.cfg persist across updates
 install -m755 %{SOURCE1} -D %{buildroot}%{_sysconfdir}/grub.d/90_persistent
-install -m755 %{SOURCE16} -D %{buildroot}%{_sysconfdir}/grub.d/30_uefi_firmware
+install -m755 %{SOURCE14} -D %{buildroot}%{_sysconfdir}/grub.d/30_uefi_firmware
 
 # Ghost config file
 install -d %{buildroot}/boot/%{name}
diff --git a/linguas.sh b/linguas.sh
deleted file mode 100755
index d389b1f..0000000
--- a/linguas.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-rsync -Lrtvz --exclude=ko.po  translationproject.org::tp/latest/grub/ po
-
-autogenerated="en@quot en@hebrew de@hebrew en@arabic en@piglatin de_CH"
-
-
-for x in $autogenerated; do
-    rm "po/$x.po";
-done
-
-
-(
-    (
-	cd po && ls *.po| cut -d. -f1
-	for x in $autogenerated; do
-	    echo "$x";
-	done
-    ) | sort | uniq | xargs
-) >po/LINGUAS
-
-tar cJf linguas.tar.xz po
Not Available

benbullard79 [@T] cox.netNo Comment.1849d 22hrs
benbullard79 [@T] cox.netNo Comment.1849d 22hrs
benbullard79 [@T] cox.netNo Comment.1849d 22hrs