Merge pull request #2298 from KloudJack/remove-grub2-suffix

Add configure option for unsuffixed GRUB2 commands linux/initrd
This commit is contained in:
Colin Walters 2021-03-18 17:46:18 -04:00 committed by GitHub
commit 9c29141c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 13 deletions

View File

@ -548,6 +548,14 @@ AM_COND_IF(BUILDOPT_SYSTEMD_AND_LIBMOUNT,
AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if systemd and libmount])) AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if systemd and libmount]))
if test x$with_libsystemd = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES systemd"; fi if test x$with_libsystemd = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES systemd"; fi
AC_ARG_WITH(modern-grub,
AS_HELP_STRING([--with-modern-grub],
[Omit grub linux and initrd suffixes for EFI/BIOS booting on GRUB >2.02 (default: no)]),,
[with_modern_grub=no])
AS_IF([ test x$with_modern_grub = xyes], [
AC_DEFINE([WITH_MODERN_GRUB], 1, [Define if we have a GRUB version newer than 2.02])
])
AC_ARG_WITH(builtin-grub2-mkconfig, AC_ARG_WITH(builtin-grub2-mkconfig,
AS_HELP_STRING([--with-builtin-grub2-mkconfig], AS_HELP_STRING([--with-builtin-grub2-mkconfig],
[Use a builtin minimal grub2-mkconfig to generate a GRUB2 configuration file (default: no)]),, [Use a builtin minimal grub2-mkconfig to generate a GRUB2 configuration file (default: no)]),,

View File

@ -28,25 +28,26 @@
#include <string.h> #include <string.h>
/* I only did some cursory research here, but it appears /* Maintain backwards compatibility with legacy GRUB
* that we only want to use "linux16" for x86 platforms. * installations that might rely on the -16 suffix
* At least, I got a report that "linux16" is definitely wrong * for real-mode booting.
* for ppc64. See * Allow us to override this at build time if we're
* http://pkgs.fedoraproject.org/cgit/rpms/grub2.git/tree/0036-Use-linux16-when-appropriate-880840.patch?h=f25 * using a modern GRUB installation.
* https://bugzilla.redhat.com/show_bug.cgi?id=1108296
* among others.
*/ */
#if defined(__i386__) || defined(__x86_64__) #if !defined(WITH_MODERN_GRUB) && ( defined(__i386__) || defined(__x86_64__) )
#define GRUB2_SUFFIX "16" #define GRUB2_SUFFIX "16"
#else #else
#define GRUB2_SUFFIX "" #define GRUB2_SUFFIX ""
#endif #endif
/* https://github.com/projectatomic/rpm-ostree-toolbox/issues/102#issuecomment-316483554 /* Maintain backwards compatibility with legacy GRUB
* https://github.com/rhboot/grubby/blob/34b1436ccbd56eab8024314cab48f2fc880eef08/grubby.c#L63 * installations that might rely on the -efi suffix
* * for RHEL/fedora-based distros.
* This is true at least on Fedora/Red Hat Enterprise Linux for aarch64. * Allow us to override this at build time if we're
* using a modern GRUB installation that makes the
* suffix-less linux/initrd commands synonymous for
* both EFI and BIOS booting.
*/ */
#if defined(__aarch64__) #if defined(WITH_MODERN_GRUB) || defined(__aarch64__)
#define GRUB2_EFI_SUFFIX "" #define GRUB2_EFI_SUFFIX ""
#else #else
#define GRUB2_EFI_SUFFIX "efi" #define GRUB2_EFI_SUFFIX "efi"