[arch-commits] Commit in grub/trunk (2 files)

2020-05-11 Thread Christian Hesse via arch-commits
Date: Monday, May 11, 2020 @ 09:29:58
  Author: eworm
Revision: 383168

upgpkg: grub 2:2.04-7

fix NLS (FS#64604)

Added:
  grub/trunk/0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch
Modified:
  grub/trunk/PKGBUILD

-+
 0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch |   36 
++
 PKGBUILD|7 +
 2 files changed, 42 insertions(+), 1 deletion(-)

Added: 0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch
===
--- 0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch 
(rev 0)
+++ 0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch 
2020-05-11 09:29:58 UTC (rev 383168)
@@ -0,0 +1,36 @@
+From ee855b15ff185bad3b0495500ab234b9cab7436c Mon Sep 17 00:00:00 2001
+From: Martin Whitaker 
+Date: Mon, 24 Feb 2020 22:11:29 +
+Subject: [PATCH] grub-install: fix inverted test for NLS enabled when copying
+ locales.
+
+Commit 3d8439da8c9a4acf9bc1c41b364ec6e1680ef052 attempted to avoid
+copying locale files to the target directory when NLS was disabled.
+However the test is inverted, and it does the opposite.
+
+Signed-off-by: Martin Whitaker 
+
+diff --git a/util/grub-install-common.c b/util/grub-install-common.c
+index ca0ac612a..f53bf0694 100644
+--- a/util/grub-install-common.c
 b/util/grub-install-common.c
+@@ -598,7 +598,7 @@ copy_all (const char *srcd,
+   grub_util_fd_closedir (d);
+ }
+ 
+-#if !(defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS)
++#if (defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS)
+ static const char *
+ get_localedir (void)
+ {
+@@ -659,7 +659,7 @@ static void
+ grub_install_copy_nls(const char *src __attribute__ ((unused)),
+   const char *dst __attribute__ ((unused)))
+ {
+-#if !(defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS)
++#if (defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS)
+   char *dst_locale;
+ 
+   dst_locale = grub_util_path_concat (2, dst, "locale");
+-- 
+2.21.1

Modified: PKGBUILD
===
--- PKGBUILD2020-05-11 09:20:25 UTC (rev 383167)
+++ PKGBUILD2020-05-11 09:29:58 UTC (rev 383168)
@@ -23,7 +23,7 @@
 pkgdesc='GNU GRand Unified Bootloader (2)'
 _pkgver=2.04
 pkgver=${_pkgver/-/}
-pkgrel=6
+pkgrel=7
 epoch=2
 url='https://www.gnu.org/software/grub/'
 arch=('x86_64')
@@ -64,6 +64,7 @@
 
"https://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz"{,.sig}
 '0003-10_linux-detect-archlinux-initramfs.patch'
 '0004-add-GRUB_COLOR_variables.patch'
+'0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch'
 'grub.default')
 
 sha256sums=('SKIP'
@@ -73,6 +74,7 @@
 'SKIP'
 '171415ab075d1ac806f36c454feeb060f870416f24279b70104bba94bd6076d4'
 'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29'
+'06820004912a3db195a76e68b376fce1ba6507ac740129f0b99257ef07aba1ea'
 '690adb7943ee9fedff578a9d482233925ca3ad3e5a50fffddd27cf33300a89e3')
 
 _backports=(
@@ -120,6 +122,9 @@
## Based on 
http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
patch -Np1 -i "${srcdir}/0004-add-GRUB_COLOR_variables.patch"
 
+   echo "Patch to NLS installation..."
+   patch -Np1 -i 
"${srcdir}/0005-grub-install-fix-inverted-test-for-NLS-enabled-when-.patch"
+
echo "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 
files for starfield theme..."
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu 
/usr/share/fonts/TTF|g' -i "configure.ac"
 


[arch-commits] Commit in grub/trunk (2 files)

2018-06-17 Thread Christian Hesse via arch-commits
Date: Monday, June 18, 2018 @ 05:56:02
  Author: eworm
Revision: 327114

upgpkg: grub 2:2.02-6

xfs: Accept filesystem with sparse inodes (FS#59047)

Added:
  grub/trunk/0009-xfs-Accept-filesystem-with-sparse-inodes.patch
Modified:
  grub/trunk/PKGBUILD

-+
 0009-xfs-Accept-filesystem-with-sparse-inodes.patch |   60 ++
 PKGBUILD|7 +-
 2 files changed, 66 insertions(+), 1 deletion(-)

Added: 0009-xfs-Accept-filesystem-with-sparse-inodes.patch
===
--- 0009-xfs-Accept-filesystem-with-sparse-inodes.patch 
(rev 0)
+++ 0009-xfs-Accept-filesystem-with-sparse-inodes.patch 2018-06-18 05:56:02 UTC 
(rev 327114)
@@ -0,0 +1,60 @@
+From cda0a857dd7a27cd5d621747464bfe71e8727fff Mon Sep 17 00:00:00 2001
+From: Daniel Kiper 
+Date: Tue, 29 May 2018 16:16:02 +0200
+Subject: xfs: Accept filesystem with sparse inodes
+
+The sparse inode metadata format became a mkfs.xfs default in
+xfsprogs-4.16.0, and such filesystems are now rejected by grub as
+containing an incompatible feature.
+
+In essence, this feature allows xfs to allocate inodes into fragmented
+freespace.  (Without this feature, if xfs could not allocate contiguous
+space for 64 new inodes, inode creation would fail.)
+
+In practice, the disk format change is restricted to the inode btree,
+which as far as I can tell is not used by grub.  If all you're doing
+today is parsing a directory, reading an inode number, and converting
+that inode number to a disk location, then ignoring this feature
+should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED
+
+I did some brief testing of this patch by hacking up the regression
+tests to completely fragment freespace on the test xfs filesystem, and
+then write a large-ish number of inodes to consume any existing
+contiguous 64-inode chunk.  This way any files the grub tests add and
+traverse would be in such a fragmented inode allocation.  Tests passed,
+but I'm not sure how to cleanly integrate that into the test harness.
+
+Signed-off-by: Eric Sandeen 
+Reviewed-by: Daniel Kiper 
+Tested-by: Chris Murphy 
+---
+ grub-core/fs/xfs.c | 11 ++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
+index c6031bd..3b00c74 100644
+--- a/grub-core/fs/xfs.c
 b/grub-core/fs/xfs.c
+@@ -79,9 +79,18 @@ GRUB_MOD_LICENSE ("GPLv3+");
+ #define XFS_SB_FEAT_INCOMPAT_SPINODES   (1 << 1)/* sparse inode 
chunks */
+ #define XFS_SB_FEAT_INCOMPAT_META_UUID  (1 << 2)/* metadata UUID */
+ 
+-/* We do not currently verify metadata UUID so it is safe to read such 
filesystem */
++/*
++ * Directory entries with ftype are explicitly handled by GRUB code.
++ *
++ * We do not currently read the inode btrees, so it is safe to read 
filesystems
++ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature.
++ *
++ * We do not currently verify metadata UUID, so it is safe to read filesystems
++ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature.
++ */
+ #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \
+   (XFS_SB_FEAT_INCOMPAT_FTYPE | \
++   XFS_SB_FEAT_INCOMPAT_SPINODES | \
+XFS_SB_FEAT_INCOMPAT_META_UUID)
+ 
+ struct grub_xfs_sblock
+-- 
+cgit v1.0-41-gc330
+

Modified: PKGBUILD
===
--- PKGBUILD2018-06-18 04:33:58 UTC (rev 327113)
+++ PKGBUILD2018-06-18 05:56:02 UTC (rev 327114)
@@ -22,7 +22,7 @@
 pkgname="grub"
 pkgdesc="GNU GRand Unified Bootloader (2)"
 pkgver=2.02
-pkgrel=5
+pkgrel=6
 epoch=2
 url="https://www.gnu.org/software/grub/;
 arch=('x86_64')
@@ -66,6 +66,7 @@
 
'0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch'
 
'0007-grub-mkconfig_10_linux_Support_multiple_early_initrd_images.patch'
 '0008-Fix-packed-not-aligned-error-on-GCC-8.patch'
+'0009-xfs-Accept-filesystem-with-sparse-inodes.patch'
 'grub.default'
 'grub.cfg')
 
@@ -80,6 +81,7 @@
 'c38f2b2caae33008b35a37d8293d8bf13bf6fd779a4504925da1837fd007aeb5'
 'e43566c4fe3b1b87e677167323d4716b82ac0810410a9d8dc7fbf415c8db2b8a'
 'e84b8de569c7e6b73263758c35cf95c6516fde85d4ed451991427864f6a4e5a8'
+'fcd5a626d4af33665d041ce42df813f1f198d8230ea186481b155a5b676f3b87'
 '74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82'
 'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
 
@@ -109,6 +111,9 @@
msg "Fix packed-not-aligned error on GCC 8"
patch -Np1 -i 
"${srcdir}/0008-Fix-packed-not-aligned-error-on-GCC-8.patch"
 
+   msg "xfs: Accept filesystem with sparse inodes"
+   patch -Np1 -i 
"${srcdir}/0009-xfs-Accept-filesystem-with-sparse-inodes.patch"
+
msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 
files for 

[arch-commits] Commit in grub/trunk (2 files)

2018-05-07 Thread Christian Hesse via arch-commits
Date: Monday, May 7, 2018 @ 22:31:53
  Author: eworm
Revision: 323464

more freetype fixes, build with GCC 8.x

Added:
  grub/trunk/0008-Fix-packed-not-aligned-error-on-GCC-8.patch
Modified:
  grub/trunk/PKGBUILD

--+
 0008-Fix-packed-not-aligned-error-on-GCC-8.patch |   72 +
 PKGBUILD |7 ++
 2 files changed, 79 insertions(+)

Added: 0008-Fix-packed-not-aligned-error-on-GCC-8.patch
===
--- 0008-Fix-packed-not-aligned-error-on-GCC-8.patch
(rev 0)
+++ 0008-Fix-packed-not-aligned-error-on-GCC-8.patch2018-05-07 22:31:53 UTC 
(rev 323464)
@@ -0,0 +1,72 @@
+From 563b1da6e6ae7af46cc8354cadb5dab416989f0a Mon Sep 17 00:00:00 2001
+From: Michael Chang 
+Date: Mon, 26 Mar 2018 16:52:34 +0800
+Subject: Fix packed-not-aligned error on GCC 8
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When building with GCC 8, there are several errors regarding 
packed-not-aligned.
+
+./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct 
grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]
+
+This patch fixes the build error by cleaning up the ambiguity of placing
+aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
+grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
+has to be packed, to ensure the structure is bit-to-bit mapped to the format
+laid on disk. I think we could blame to copy and paste error here for the
+mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
+the name suggests. :)
+
+Signed-off-by: Michael Chang 
+Tested-by: Michael Chang 
+Tested-by: Paul Menzel 
+Reviewed-by: Daniel Kiper 
+---
+ grub-core/fs/btrfs.c  | 2 +-
+ include/grub/efiemu/runtime.h | 2 +-
+ include/grub/gpt_partition.h  | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
+index 4849c1ceb..be195448d 100644
+--- a/grub-core/fs/btrfs.c
 b/grub-core/fs/btrfs.c
+@@ -175,7 +175,7 @@ struct grub_btrfs_time
+ {
+   grub_int64_t sec;
+   grub_uint32_t nanosec;
+-} __attribute__ ((aligned (4)));
++} GRUB_PACKED;
+ 
+ struct grub_btrfs_inode
+ {
+diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
+index 9b6b729f4..36d2dedf4 100644
+--- a/include/grub/efiemu/runtime.h
 b/include/grub/efiemu/runtime.h
+@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
+ 
+ struct efi_variable
+ {
+-  grub_efi_guid_t guid;
++  grub_efi_packed_guid_t guid;
+   grub_uint32_t namelen;
+   grub_uint32_t size;
+   grub_efi_uint32_t attributes;
+diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
+index 1b32f6725..9668a68c3 100644
+--- a/include/grub/gpt_partition.h
 b/include/grub/gpt_partition.h
+@@ -28,7 +28,7 @@ struct grub_gpt_part_type
+   grub_uint16_t data2;
+   grub_uint16_t data3;
+   grub_uint8_t data4[8];
+-} __attribute__ ((aligned(8)));
++} GRUB_PACKED;
+ typedef struct grub_gpt_part_type grub_gpt_part_type_t;
+ 
+ #define GRUB_GPT_PARTITION_TYPE_EMPTY \
+-- 
+cgit v1.1-33-g03f6
+

Modified: PKGBUILD
===
--- PKGBUILD2018-05-07 22:16:03 UTC (rev 323463)
+++ PKGBUILD2018-05-07 22:31:53 UTC (rev 323464)
@@ -65,6 +65,7 @@
 
'0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch'
 
'0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch'
 
'0007-grub-mkconfig_10_linux_Support_multiple_early_initrd_images.patch'
+'0008-Fix-packed-not-aligned-error-on-GCC-8.patch'
 'grub.default'
 'grub.cfg')
 
@@ -78,6 +79,7 @@
 '535422c510a050d41efe7720dbe54de29e04bdb8f86fd5aea5feb0b24f7abe46'
 'c38f2b2caae33008b35a37d8293d8bf13bf6fd779a4504925da1837fd007aeb5'
 'e43566c4fe3b1b87e677167323d4716b82ac0810410a9d8dc7fbf415c8db2b8a'
+'e84b8de569c7e6b73263758c35cf95c6516fde85d4ed451991427864f6a4e5a8'
 '74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82'
 'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
 
@@ -104,6 +106,9 @@
msg "Support multiple early initrd images"
patch -Np1 -i 
"${srcdir}/0007-grub-mkconfig_10_linux_Support_multiple_early_initrd_images.patch"
 
+   msg "Fix packed-not-aligned error on GCC 8"
+   patch -Np1 -i 
"${srcdir}/0008-Fix-packed-not-aligned-error-on-GCC-8.patch"
+
msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 
files for starfield theme"
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu 
/usr/share/fonts/TTF|g' -i "configure.ac"
 
@@ -204,6 

[arch-commits] Commit in grub/trunk (2 files)

2017-11-30 Thread Christian Hesse via arch-commits
Date: Friday, December 1, 2017 @ 07:58:15
  Author: eworm
Revision: 311206

upgpkg: grub 2:2.02-4

Change default tsc calibration method to pmtimer on EFI systems (FS#56521)

Added:
  
grub/trunk/0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch
Modified:
  grub/trunk/PKGBUILD

+
 0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch 
|   31 ++
 PKGBUILD   
|8 ++
 2 files changed, 38 insertions(+), 1 deletion(-)

Added: 
0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch
===
--- 
0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch  
(rev 0)
+++ 
0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch  
2017-12-01 07:58:15 UTC (rev 311206)
@@ -0,0 +1,31 @@
+From 446794de8da4329ea532cbee4ca877bcafd0e534 Mon Sep 17 00:00:00 2001
+From: "David E. Box" 
+Date: Fri, 15 Sep 2017 15:37:05 -0700
+Subject: tsc: Change default tsc calibration method to pmtimer on EFI systems
+
+On efi systems, make pmtimer based tsc calibration the default over the
+pit. This prevents Grub from hanging on Intel SoC systems that power gate
+the pit.
+
+Signed-off-by: David E. Box 
+Reviewed-by: Daniel Kiper 
+---
+ grub-core/kern/i386/tsc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
+index 2e85289d8..f266eb131 100644
+--- a/grub-core/kern/i386/tsc.c
 b/grub-core/kern/i386/tsc.c
+@@ -68,7 +68,7 @@ grub_tsc_init (void)
+ #ifdef GRUB_MACHINE_XEN
+   (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode());
+ #elif defined (GRUB_MACHINE_EFI)
+-  (void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer 
() || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode());
++  (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit 
() || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode());
+ #elif defined (GRUB_MACHINE_COREBOOT)
+   (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit 
() || calibrate_tsc_hardcode());
+ #else
+-- 
+cgit v1.1-26-g67d0
+

Modified: PKGBUILD
===
--- PKGBUILD2017-12-01 07:34:39 UTC (rev 311205)
+++ PKGBUILD2017-12-01 07:58:15 UTC (rev 311206)
@@ -22,7 +22,7 @@
 pkgname="grub"
 pkgdesc="GNU GRand Unified Bootloader (2)"
 pkgver=2.02
-pkgrel=3
+pkgrel=4
 epoch=2
 url="https://www.gnu.org/software/grub/;
 arch=('x86_64')
@@ -64,6 +64,7 @@
 '0003-10_linux-detect-archlinux-initramfs.patch'
 '0004-add-GRUB_COLOR_variables.patch'
 
'0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch'
+
'0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch'
 'grub.default'
 'grub.cfg')
 
@@ -76,6 +77,7 @@
 'b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3'
 'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29'
 '535422c510a050d41efe7720dbe54de29e04bdb8f86fd5aea5feb0b24f7abe46'
+'c38f2b2caae33008b35a37d8293d8bf13bf6fd779a4504925da1837fd007aeb5'
 '74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82'
 'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
 
@@ -99,6 +101,10 @@
patch -Np1 -i 
"${srcdir}/0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch"
echo
 
+   msg "Patch to change default tsc calibration method to pmtimer on EFI 
systems"
+   patch -Np1 -i 
"${srcdir}/0006-tsc-Change-default-tsc-calibration-method-to-pmtimer-on-EFI-systems.patch"
+   echo
+
msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 
files for starfield theme"
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu 
/usr/share/fonts/TTF|g' -i "configure.ac"
 


[arch-commits] Commit in grub/trunk (2 files)

2017-09-08 Thread Christian Hesse
Date: Friday, September 8, 2017 @ 10:09:30
  Author: eworm
Revision: 305042

upgpkg: grub 2:2.02-2

Allow GRUB to mount ext2/3/4 filesystems that have the encryption feature 
(FS#51879)

Added:
  
grub/trunk/0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch
Modified:
  grub/trunk/PKGBUILD

+
 
0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch
 |  140 ++
 PKGBUILD   
|8 
 2 files changed, 147 insertions(+), 1 deletion(-)

Added: 
0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch
===
--- 
0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch
  (rev 0)
+++ 
0005-Allow_GRUB_to_mount_ext234_filesystems_that_have_the_encryption_feature.patch
  2017-09-08 10:09:30 UTC (rev 305042)
@@ -0,0 +1,140 @@
+From 734668238fcc0ef691a080839e04f33854fa133a Mon Sep 17 00:00:00 2001
+From: Eric Biggers 
+Date: Thu, 29 Jun 2017 13:27:49 +
+Subject: Allow GRUB to mount ext2/3/4 filesystems that have the encryption
+ feature.
+
+On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set.
+For a regular file, this means its contents are encrypted; for a
+directory, this means the filenames in its directory entries are
+encrypted; and for a symlink, this means its target is encrypted.  Since
+GRUB cannot decrypt encrypted contents or filenames, just issue an error
+if it would need to do so.  This is sufficient to allow unencrypted boot
+files to co-exist with encrypted files elsewhere on the filesystem.
+
+(Note that encrypted regular files and symlinks will not normally be
+encountered outside an encrypted directory; however, it's possible via
+hard links, so they still need to be handled.)
+
+Tested by booting from an ext4 /boot partition on which I had run
+'tune2fs -O encrypt'.  I also verified that the expected error messages
+are printed when trying to access encrypted directories, files, and
+symlinks from the GRUB command line.  Also ran 'sudo ./grub-fs-tester
+ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+.
+
+Signed-off-by: Eric Biggers 
+---
+ grub-core/fs/ext2.c  | 23 ++-
+ tests/ext234_test.in |  1 +
+ tests/util/grub-fs-tester.in | 10 ++
+ 3 files changed, 33 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c
+index cdce63b..b8ad75a 100644
+--- a/grub-core/fs/ext2.c
 b/grub-core/fs/ext2.c
+@@ -102,6 +102,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
+ #define EXT4_FEATURE_INCOMPAT_64BIT   0x0080
+ #define EXT4_FEATURE_INCOMPAT_MMP 0x0100
+ #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
++#define EXT4_FEATURE_INCOMPAT_ENCRYPT  0x1
+ 
+ /* The set of back-incompatible features this driver DOES support. Add (OR)
+  * flags here as the related features are implemented into the driver.  */
+@@ -109,7 +110,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
+| EXT4_FEATURE_INCOMPAT_EXTENTS  \
+| EXT4_FEATURE_INCOMPAT_FLEX_BG \
+| EXT2_FEATURE_INCOMPAT_META_BG \
+-   | EXT4_FEATURE_INCOMPAT_64BIT)
++   | EXT4_FEATURE_INCOMPAT_64BIT \
++   | EXT4_FEATURE_INCOMPAT_ENCRYPT)
+ /* List of rationales for the ignored "incompatible" features:
+  * needs_recovery: Not really back-incompatible - was added as such to forbid
+  * ext2 drivers from mounting an ext3 volume with a dirty
+@@ -138,6 +140,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
+ #define EXT3_JOURNAL_FLAG_DELETED 4
+ #define EXT3_JOURNAL_FLAG_LAST_TAG8
+ 
++#define EXT4_ENCRYPT_FLAG  0x800
+ #define EXT4_EXTENTS_FLAG 0x8
+ 
+ /* The ext2 superblock.  */
+@@ -706,6 +709,12 @@ grub_ext2_read_symlink (grub_fshelp_node_t node)
+   grub_ext2_read_inode (diro->data, diro->ino, >inode);
+   if (grub_errno)
+   return 0;
++
++  if (diro->inode.flags & grub_cpu_to_le32_compile_time 
(EXT4_ENCRYPT_FLAG))
++   {
++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "symlink is encrypted");
++ return 0;
++   }
+ }
+ 
+   symlink = grub_malloc (grub_le_to_cpu32 (diro->inode.size) + 1);
+@@ -749,6 +758,12 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir,
+   return 0;
+ }
+ 
++  if (diro->inode.flags & grub_cpu_to_le32_compile_time (EXT4_ENCRYPT_FLAG))
++{
++  grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "directory is encrypted");
++  return 0;
++}
++
+   /* Search the file.  */
+   while (fpos < grub_le_to_cpu32 

[arch-commits] Commit in grub/trunk (2 files)

2017-01-09 Thread Christian Hesse
Date: Monday, January 9, 2017 @ 11:35:57
  Author: eworm
Revision: 285562

upgpkg: grub 1:2.02.beta3-5

efi: properly terminate filepath with NULL in chainloader (FS#52412)

Added:
  grub/trunk/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
Modified:
  grub/trunk/PKGBUILD

-+
 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch |   44 
++
 PKGBUILD|8 +
 2 files changed, 51 insertions(+), 1 deletion(-)

Added: 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch
===
--- 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch 
(rev 0)
+++ 0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch 
2017-01-09 11:35:57 UTC (rev 285562)
@@ -0,0 +1,44 @@
+From ce95549cc54b5d6f494608a7c390dba3aab4fba7 Mon Sep 17 00:00:00 2001
+From: Andrei Borzenkov 
+Date: Thu, 15 Dec 2016 16:07:00 +0300
+Subject: efi: properly terminate filepath with NULL in chainloader
+
+EFI File Path Media Device Path is defined as NULL terminated string;
+but chainloader built file paths without final NULL. This caused error
+with Secure Boot and Linux Foundation PreLoader on Acer with InsydeH20 BIOS.
+Apparently firmware failed verification with EFI_INVALID_PARAMETER which is
+considered fatal error by PreLoader.
+
+Reported and tested by Giovanni Santini 
+---
+ grub-core/loader/efi/chainloader.c | 6 +-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/loader/efi/chainloader.c 
b/grub-core/loader/efi/chainloader.c
+index 522a716..adc8563 100644
+--- a/grub-core/loader/efi/chainloader.c
 b/grub-core/loader/efi/chainloader.c
+@@ -122,6 +122,8 @@ copy_file_path (grub_efi_file_path_device_path_t *fp,
+ if (*p == '/')
+   *p = '\\';
+ 
++  /* File Path is NULL terminated */
++  fp->path_name[size++] = '\0';
+   fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp);
+ }
+ 
+@@ -156,8 +158,10 @@ make_file_path (grub_efi_device_path_t *dp, const char 
*filename)
+   d = GRUB_EFI_NEXT_DEVICE_PATH (d);
+ }
+ 
++  /* File Path is NULL terminated. Allocate space for 2 extra characters */
++  /* FIXME why we split path in two components? */
+   file_path = grub_malloc (size
+- + ((grub_strlen (dir_start) + 1)
++ + ((grub_strlen (dir_start) + 2)
+ * GRUB_MAX_UTF16_PER_UTF8
+ * sizeof (grub_efi_char16_t))
+  + sizeof (grub_efi_file_path_device_path_t) * 2);
+-- 
+cgit v1.0
+

Modified: PKGBUILD
===
--- PKGBUILD2017-01-09 09:56:20 UTC (rev 285561)
+++ PKGBUILD2017-01-09 11:35:57 UTC (rev 285562)
@@ -23,7 +23,7 @@
 pkgname="grub"
 pkgdesc="GNU GRand Unified Bootloader (2)"
 pkgver=2.02.beta3
-pkgrel=4
+pkgrel=5
 epoch=1
 url="https://www.gnu.org/software/grub/;
 arch=('x86_64' 'i686')
@@ -64,6 +64,7 @@
 '0003-10_linux-detect-archlinux-initramfs.patch'
 '0004-add-GRUB_COLOR_variables.patch'
 '0005-10_linux-fix-grouping-of-tests.patch'
+'0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch'
 'grub.default'
 'grub.cfg')
 
@@ -76,6 +77,7 @@
 'b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3'
 'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29'
 'bf712de689a944ac23a0303bbcc223eedf8d4fcb5c94bdc071c71c2444158a7f'
+'d99f47642d325398873346e25ecb646c387e358e25b05128fa333cc7721a7388'
 'df764fbd876947dea973017f95371e53833bf878458140b09f0b70d900235676'
 'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
 
@@ -109,6 +111,10 @@
patch -Np1 -i "${srcdir}/0005-10_linux-fix-grouping-of-tests.patch"
echo
 
+   msg "Patch to properly terminate filepath with NULL in chainloader"
+   patch -Np1 -i 
"${srcdir}/0006-efi-properly-terminate-filepath-with-NULL-in-chainloader.patch"
+   echo
+
msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 
files for starfield theme"
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu 
/usr/share/fonts/TTF|g' -i "${srcdir}/grub-${_pkgver}/configure.ac"
 


[arch-commits] Commit in grub/trunk (2 files)

2016-08-04 Thread Christian Hesse
Date: Thursday, August 4, 2016 @ 19:49:29
  Author: eworm
Revision: 273035

upgpkg: grub 1:2.02.beta3-3

10_linux: Fix grouping of tests for GRUB_DEVICE

Added:
  grub/trunk/0005-10_linux-fix-grouping-of-tests.patch
Modified:
  grub/trunk/PKGBUILD

---+
 0005-10_linux-fix-grouping-of-tests.patch |   22 ++
 PKGBUILD  |   12 ++--
 2 files changed, 32 insertions(+), 2 deletions(-)

Added: 0005-10_linux-fix-grouping-of-tests.patch
===
--- 0005-10_linux-fix-grouping-of-tests.patch   (rev 0)
+++ 0005-10_linux-fix-grouping-of-tests.patch   2016-08-04 19:49:29 UTC (rev 
273035)
@@ -0,0 +1,22 @@
+commit 082bc9f77b200eb48a5f1147163dea9c9d02d44c
+Author: Mike Gilbert 
+Date:   Sat Mar 5 17:30:48 2016 -0500
+
+10_linux: Fix grouping of tests for GRUB_DEVICE
+
+Commit 7290bb562 causes GRUB_DISABLE_LINUX_UUID to be ignored due to
+mixing of || and && operators. Add some parens to help with that.
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 5a78513..de9044c 100644
+--- a/util/grub.d/10_linux.in
 b/util/grub.d/10_linux.in
+@@ -47,7 +47,7 @@ esac
+ # and mounting btrfs requires user space scanning, so force UUID in this case.
+ if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = 
"xtrue" ] \
+ || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
+-|| test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm; then
++|| ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); 
then
+   LINUX_ROOT_DEVICE=${GRUB_DEVICE}
+ else
+   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}

Modified: PKGBUILD
===
--- PKGBUILD2016-08-04 19:33:56 UTC (rev 273034)
+++ PKGBUILD2016-08-04 19:49:29 UTC (rev 273035)
@@ -23,7 +23,7 @@
 pkgname="grub"
 pkgdesc="GNU GRand Unified Bootloader (2)"
 pkgver=2.02.beta3
-pkgrel=2
+pkgrel=3
 epoch=1
 url="https://www.gnu.org/software/grub/;
 arch=('x86_64' 'i686')
@@ -61,6 +61,7 @@
 '0002-intel-ucode.patch'
 '0003-10_linux-detect-archlinux-initramfs.patch'
 '0004-add-GRUB_COLOR_variables.patch'
+'0005-10_linux-fix-grouping-of-tests.patch'
 'grub.default'
 'grub.cfg')
 
@@ -72,6 +73,7 @@
  'ff3b8524983ce02fc48fce38f96b1a82'
  'ba9d27c44b677bf329e5b96933bdbde8'
  'e506ae4a9f9f7d1b765febfa84e10d48'
+ 'f1999315bbd25b4b9359919ce9b36144'
  'a03ffd56324520393bf574cefccb893d'
  'c8b9511586d57d6f2524ae7898397a46')
 validpgpkeys=('95D2E9AB8740D8046387FD151A09227B1F435A33')  #Paul Hardy
@@ -84,8 +86,10 @@
 prepare() {
cd "${srcdir}/grub-${_pkgver}/"
 
+   msg "Patch to fix CVE-2015-8370"
# CVE-2015-8370
-   patch -Np1 -i 
../0001-Fix-security-issue-when-reading-username-and-passwor.patch
+   patch -Np1 -i 
"${srcdir}/0001-Fix-security-issue-when-reading-username-and-passwor.patch"
+   echo
 
msg "Patch to load Intel microcode"
patch -Np1 -i "${srcdir}/0002-intel-ucode.patch"
@@ -100,6 +104,10 @@
patch -Np1 -i "${srcdir}/0004-add-GRUB_COLOR_variables.patch"
echo
 
+   msg "Patch to fix grouping of tests for GRUB_DEVICE"
+   patch -Np1 -i "${srcdir}/0005-10_linux-fix-grouping-of-tests.patch"
+   echo
+
msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 
files for starfield theme"
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu 
/usr/share/fonts/TTF|g' -i "${srcdir}/grub-${_pkgver}/configure.ac"
 


[arch-commits] Commit in grub/trunk (2 files)

2015-12-15 Thread Evangelos Foutras
Date: Tuesday, December 15, 2015 @ 16:59:37
  Author: foutrelis
Revision: 256230

upgpkg: grub 1:2.02.beta2-6

- Fix CVE-2015-8370: Grub2 Authentication Bypass (FS#47386).
- Lock grub-extras revision to fix build failure (FS#46165).

Added:
  grub/trunk/0001-Fix-security-issue-when-reading-username-and-passwor.patch
Modified:
  grub/trunk/PKGBUILD

-+
 0001-Fix-security-issue-when-reading-username-and-passwor.patch |   47 
++
 PKGBUILD|   16 ++-
 2 files changed, 58 insertions(+), 5 deletions(-)

Added: 0001-Fix-security-issue-when-reading-username-and-passwor.patch
===
--- 0001-Fix-security-issue-when-reading-username-and-passwor.patch 
(rev 0)
+++ 0001-Fix-security-issue-when-reading-username-and-passwor.patch 
2015-12-15 15:59:37 UTC (rev 256230)
@@ -0,0 +1,47 @@
+From e16eeda1200deabd0d3a4af968d526d62845a85f Mon Sep 17 00:00:00 2001
+From: Hector Marco-Gisbert 
+Date: Fri, 13 Nov 2015 16:21:09 +0100
+Subject: [PATCH] Fix security issue when reading username and password
+
+  This patch fixes two integer underflows at:
+* grub-core/lib/crypto.c
+* grub-core/normal/auth.c
+
+Resolves: CVE-2015-8370
+
+Signed-off-by: Hector Marco-Gisbert 
+Signed-off-by: Ismael Ripoll-Ripoll 
+---
+ grub-core/lib/crypto.c  | 2 +-
+ grub-core/normal/auth.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
+index 010e550..524a3d8 100644
+--- a/grub-core/lib/crypto.c
 b/grub-core/lib/crypto.c
+@@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned buf_size)
+ break;
+   }
+ 
+-  if (key == '\b')
++  if (key == '\b' && cur_len)
+   {
+ cur_len--;
+ continue;
+diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
+index c6bd96e..5782ec5 100644
+--- a/grub-core/normal/auth.c
 b/grub-core/normal/auth.c
+@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size)
+ break;
+   }
+ 
+-  if (key == '\b')
++  if (key == '\b' && cur_len)
+   {
+ cur_len--;
+ grub_printf ("\b");
+-- 
+2.6.4
+

Modified: PKGBUILD
===
--- PKGBUILD2015-12-15 15:57:22 UTC (rev 256229)
+++ PKGBUILD2015-12-15 15:59:37 UTC (rev 256230)
@@ -10,6 +10,7 @@
 
 _pkgver="2.02"
 _GRUB_GIT_TAG="grub-2.02-beta2"
+_GRUB_EXTRAS_COMMIT=4a56e2c2cc3d78f12f1788c27669a651071dee49
 
 _UNIFONT_VER="6.3.20131217"
 
@@ -22,8 +23,8 @@
 pkgname="grub"
 pkgdesc="GNU GRand Unified Bootloader (2)"
 pkgver=2.02.beta2
-pkgrel=5
-epoch="1"
+pkgrel=6
+epoch=1
 url="https://www.gnu.org/software/grub/;
 arch=('x86_64' 'i686')
 license=('GPL3')
@@ -53,11 +54,12 @@
 fi
 
 
source=("grub-${_pkgver}::git+git://git.sv.gnu.org/grub.git#tag=${_GRUB_GIT_TAG}"
-"grub-extras::git+git://git.sv.gnu.org/grub-extras.git#branch=master"
+
"grub-extras::git+git://git.sv.gnu.org/grub-extras.git#commit=${_GRUB_EXTRAS_COMMIT}"
 
"http://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz;
 
"http://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz.sig;
+'0001-Fix-security-issue-when-reading-username-and-passwor.patch'
 'grub-10_linux-detect-archlinux-initramfs.patch'
-   'grub-intel-ucode.patch'
+'grub-intel-ucode.patch'
 'grub-add-GRUB_COLOR_variables.patch'
 '60_memtest86+'
 'grub.default'
@@ -67,8 +69,9 @@
  'SKIP'
  '728b7439ac733a7c0d56049adec364c7'
  'SKIP'
+ '9589ec46a04f9bb4d5da987340a4a324'
  '945527e0de8d384166a4cf23439ae9ee'
-'a678629bc82c4e70c48d28242036d1d7'
+ 'a678629bc82c4e70c48d28242036d1d7'
  'e506ae4a9f9f7d1b765febfa84e10d48'
  'be55eabc102f2c60b38ed35c203686d6'
  'a03ffd56324520393bf574cefccb893d'
@@ -83,6 +86,9 @@
 prepare() {

cd "${srcdir}/grub-${_pkgver}/"
+
+   # CVE-2015-8370
+   patch -Np1 -i 
../0001-Fix-security-issue-when-reading-username-and-passwor.patch

msg "Patch to load Intel microcode"
patch -Np1 -i "${srcdir}/grub-intel-ucode.patch"


[arch-commits] Commit in grub/trunk (2 files)

2014-04-07 Thread Tobias Powalowski
Date: Monday, April 7, 2014 @ 13:01:47
  Author: tpowa
Revision: 209864

upgpkg: grub 1:2.02.beta2-3

remove 10_archlinux config

Added:
  grub/trunk/grub-10_linux-detect-archlinux-initramfs.patch
Modified:
  grub/trunk/PKGBUILD

+
 PKGBUILD   |   16 +++---
 grub-10_linux-detect-archlinux-initramfs.patch |   54 +++
 2 files changed, 63 insertions(+), 7 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2014-04-07 10:17:02 UTC (rev 209863)
+++ PKGBUILD2014-04-07 11:01:47 UTC (rev 209864)
@@ -13,7 +13,7 @@
 pkgname=grub
 pkgdesc=GNU GRand Unified Bootloader (2)
 pkgver=2.02.beta2
-pkgrel=2
+pkgrel=3
 epoch=1
 url=https://www.gnu.org/software/grub/;
 arch=('x86_64' 'i686')
@@ -41,22 +41,23 @@
 grub-extras::git+git://git.sv.gnu.org/grub-extras.git#branch=master
 
http://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz;
 
http://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz.sig;
+'grub-10_linux-detect-archlinux-initramfs.patch'
 'grub-add-GRUB_COLOR_variables.patch'
-'10_archlinux'
 '60_memtest86+'
 'grub.default'
 'grub.cfg')
+
 md5sums=('SKIP'
  'SKIP'
  '728b7439ac733a7c0d56049adec364c7'
  'SKIP'
+ '945527e0de8d384166a4cf23439ae9ee'
  'e506ae4a9f9f7d1b765febfa84e10d48'
- 'dcf3e0b47119b0bb06ce987c8f030ffa'
  'be55eabc102f2c60b38ed35c203686d6'
  'a03ffd56324520393bf574cefccb893d'
  'c8b9511586d57d6f2524ae7898397a46')
 
-pkgver() {
+_pkgver() {
cd ${srcdir}/grub-${_pkgver}/
echo $(git describe --tags) | sed -e 's|grub.||g' -e 's|-|\.|g'
 }
@@ -65,6 +66,10 @@

cd ${srcdir}/grub-${_pkgver}/

+   msg Patch to detect of Arch Linux initramfs images by grub-mkconfig
+   patch -Np1 -i ${srcdir}/grub-10_linux-detect-archlinux-initramfs.patch
+   echo
+   
msg Patch to enable GRUB_COLOR_* variables in grub-mkconfig
## Based on 
http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
patch -Np1 -i ${srcdir}/grub-add-GRUB_COLOR_variables.patch
@@ -234,9 +239,6 @@
rm -f ${pkgdir}/usr/lib/grub/i386-pc/*.image || true
rm -f 
${pkgdir}/usr/lib/grub/i386-pc/{kernel.exec,gdb_grub,gmodule.pl} || true

-   msg Install 10_archlinux helper script for grub-mkconfig
-   install -D -m0755 ${srcdir}/10_archlinux 
${pkgdir}/etc/grub.d/10_archlinux
-   
msg Install extra /etc/grub.d/ files
install -D -m0755 ${srcdir}/60_memtest86+ 
${pkgdir}/etc/grub.d/60_memtest86+


Added: grub-10_linux-detect-archlinux-initramfs.patch
===
--- grub-10_linux-detect-archlinux-initramfs.patch  
(rev 0)
+++ grub-10_linux-detect-archlinux-initramfs.patch  2014-04-07 11:01:47 UTC 
(rev 209864)
@@ -0,0 +1,54 @@
+From b470ffd22e43acc7c11231180187a720efd88de1 Mon Sep 17 00:00:00 2001
+From: Keshav Amburay the.ridikulus@gmail.com
+Date: Sat, 5 Apr 2014 20:40:51 -0400
+Subject: [PATCH] 10_linux: Detect Arch Linux main and fallback initramfs
+ images
+
+---
+ util/grub.d/10_linux.in | 16 +++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index 00d1931..7d4086b 100644
+--- a/util/grub.d/10_linux.in
 b/util/grub.d/10_linux.in
+@@ -81,6 +81,8 @@ linux_entry ()
+   case $type in
+ recovery)
+ title=$(gettext_printf %s, with Linux %s (recovery mode) 
${os} ${version}) ;;
++fallback)
++title=$(gettext_printf %s, with Linux %s (fallback initramfs) 
${os} ${version}) ;;
+ *)
+ title=$(gettext_printf %s, with Linux %s ${os} 
${version}) ;;
+   esac
+@@ -180,7 +182,7 @@ while [ x$list != x ] ; do
+   basename=`basename $linux`
+   dirname=`dirname $linux`
+   rel_dirname=`make_system_path_relative_to_its_root $dirname`
+-  version=`echo $basename | sed -e s,^[^0-9]*-,,g`
++  version=`echo $basename | sed -e s,vmlinuz-,,g`
+   alt_version=`echo $version | sed -e s,\.old$,,g`
+   linux_root_device_thisversion=${LINUX_ROOT_DEVICE}
+ 
+@@ -236,6 +238,18 @@ while [ x$list != x ] ; do
+ 
+   linux_entry ${OS} ${version} advanced \
+   ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
++  
++  if test -e ${dirname}/initramfs-${version}-fallback.img ; then
++initrd=initramfs-${version}-fallback.img
++
++if test -n ${initrd} ; then
++  gettext_printf Found fallback initramfs image: %s\n 
${dirname}/${initrd} 2
++fi
++
++linux_entry ${OS} ${version} fallback \
++${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
++  fi
++  
+   if [ x${GRUB_DISABLE_RECOVERY} !=