Your message dated Fri, 01 Mar 2019 13:05:29 +0000
with message-id <[email protected]>
and subject line Bug#922104: fixed in grub2 2.02+dfsg1-12
has caused the Debian Bug report #922104,
regarding grub-install: check for arm-efi as a default target
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
922104: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=922104
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: src:grub
Version: 2.02+dfsg1-11
Severity: normal
Tags: upstream patch

Hi Colin,

I've already submitted the core of this upstream - see

  http://lists.gnu.org/archive/html/grub-devel/2019-02/msg00018.html

Much like on x86, we can work out if the system is running on top of
EFI firmware. If so, return "arm-efi". If not, fall back to
"arm-uboot" as previously.

Heavily inspired by the existing code for x86.

I'd push this as an MR, but my head is just not in the right place for
handling git-dpm right now :-(

Here's a patch instead, ready to drop into debian/patches. I've
extended the code here in similar fashion to what's already been added
in our version of grub_install_get_default_x86_platform() to check in
the pkglibdir. Otherwise this new code is just the same as I've sent
upstream yesterday.

-- System Information:
Debian Release: 9.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-8-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
From: Steve McIntyre <[email protected]>
Date: Tue, 12 Feb 2019 02:23:14 +0000
Subject: grub-install: check for arm-efi as a default target

Much like on x86, we can work out if the system is running on top of
EFI firmware. If so, return "arm-efi". If not, fall back to
"arm-uboot" as previously.

Heavily inspired by the existing code for x86.

Signed-off-by: Steve McIntyre <[email protected]>

Bug-Debian: https://bugs.debian.org/XXXXXX
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2019-02/msg00018.html

Patch-Name: grub-install-check-arm-efi.patch
 grub-core/osdep/basic/platform.c |  6 ++++++
 grub-core/osdep/linux/platform.c | 37 +++++++++++++++++++++++++++++++++++++
 include/grub/util/install.h      |  3 +++
 util/grub-install.c              |  2 +-
 5 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/grub-core/osdep/basic/platform.c b/grub-core/osdep/basic/platform.c
index 2ab907976..ac41452e0 100644
--- a/grub-core/osdep/basic/platform.c
+++ b/grub-core/osdep/basic/platform.c
@@ -19,6 +19,12 @@
 #include <grub/util/install.h>
 
 const char *
+grub_install_get_default_arm_platform (void)
+{ 
+  return "arm-uboot";
+}
+
+const char *
 grub_install_get_default_x86_platform (void)
 { 
   return "i386-pc";
diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c
index 9805c36d4..0110ac655 100644
--- a/grub-core/osdep/linux/platform.c
+++ b/grub-core/osdep/linux/platform.c
@@ -101,6 +101,43 @@ read_platform_size (void)
 }
 
 const char *
+grub_install_get_default_arm_platform (void)
+{ 
+  /*
+     On Linux, we need the efivars kernel modules.
+     If no EFI is available this module just does nothing
+     besides a small hello and if we detect efi we'll load it
+     anyway later. So it should be safe to
+     try to load it here.
+   */
+  grub_util_exec_redirect_all ((const char * []){ "modprobe", "efivars", NULL 
},
+                              NULL, NULL, "/dev/null");
+
+  grub_util_info ("Looking for /sys/firmware/efi ..");
+  if (is_not_empty_directory ("/sys/firmware/efi"))
+    {
+      const char *pkglibdir = grub_util_get_pkglibdir ();
+      const char *platform;
+      char *pd;
+      int found;
+
+      grub_util_info ("...found");
+      platform = "arm-efi";
+
+      pd = grub_util_path_concat (2, pkglibdir, platform);
+      found = grub_util_is_directory (pd);
+      free (pd);
+      if (found)
+       return platform;
+      else
+       grub_util_info ("... but %s platform not available", platform);
+    }
+
+  grub_util_info ("... not found");
+  return "arm-uboot";
+}
+
+const char *
 grub_install_get_default_x86_platform (void)
 { 
   /*
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
index 3fd46ec30..5783cc4bc 100644
--- a/include/grub/util/install.h
+++ b/include/grub/util/install.h
@@ -205,6 +205,9 @@ void
 grub_install_create_envblk_file (const char *name);
 
 const char *
+grub_install_get_default_arm_platform (void);
+
+const char *
 grub_install_get_default_x86_platform (void);
 
 const char *
diff --git a/util/grub-install.c b/util/grub-install.c
index 6bc96fc8f..fcd6680f1 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -348,7 +348,7 @@ get_default_platform (void)
 #elif defined (__ia64__)
    return "ia64-efi";
 #elif defined (__arm__)
-   return "arm-uboot";
+   return grub_install_get_default_arm_platform ();
 #elif defined (__aarch64__)
    return "arm64-efi";
 #elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__)

--- End Message ---
--- Begin Message ---
Source: grub2
Source-Version: 2.02+dfsg1-12

We believe that the bug you reported is fixed in the latest version of
grub2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Colin Watson <[email protected]> (supplier of updated grub2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 01 Mar 2019 12:34:45 +0000
Source: grub2
Architecture: source
Version: 2.02+dfsg1-12
Distribution: unstable
Urgency: medium
Maintainer: GRUB Maintainers <[email protected]>
Changed-By: Colin Watson <[email protected]>
Closes: 919029 922104 922741 923253
Changes:
 grub2 (2.02+dfsg1-12) unstable; urgency=medium
 .
   [ Colin Watson ]
   * Remove code to migrate grub-pc/install_devices to persistent device
     names under /dev/disk/by-id/.  This migration happened in
     1.98+20100702-1, which was in squeeze (four stable releases ago), so we
     no longer need to carry around this complex code.
   * Preserve previous answer to grub-pc/install_devices if we have to ask
     grub-pc/install_devices_disks_changed and the user chooses not to
     install to any devices, so that we can recover from temporary bugs that
     cause /dev/disk/by-id/ paths to change (closes: #919029).
   * debian/signing-template.json.in: Add trusted_certs key (empty, since
     GRUB has no hardcoded list of trusted certificates).
   * util: Detect more I/O errors (closes: #922741).
 .
   [ Leif Lindholm ]
   * arm64/efi: Fix grub_efi_get_ram_base().
 .
   [ Steve McIntyre ]
   * grub-install: Check for arm-efi as a default target (closes: #922104).
 .
   [ James Clarke ]
   * osdep/freebsd: Fix partition calculation for EBR entries (closes:
     #923253).
Checksums-Sha1:
 bdde214b3c1c2d1a3fcd5078905528cece234e42 6691 grub2_2.02+dfsg1-12.dsc
 20766f9616d83edb4dcc572cf62dbb17a7e5ecb5 1126288 
grub2_2.02+dfsg1-12.debian.tar.xz
 7eb2257fbf0bf0db9ad28ac9e6cdcb5c378f686e 15038 
grub2_2.02+dfsg1-12_source.buildinfo
Checksums-Sha256:
 4e8a8c3ab7c2059486d28a93557930aaf570f69488c750edd1eb31b12879ec18 6691 
grub2_2.02+dfsg1-12.dsc
 8cbdb418b2e4eccedce914d123b7de6862f4f599386277312011ce32797f846e 1126288 
grub2_2.02+dfsg1-12.debian.tar.xz
 2121f690fa3057a1fe475d1309d76a38a5ac16a5da9548b93de3d8c250ebe34b 15038 
grub2_2.02+dfsg1-12_source.buildinfo
Files:
 c7ebc34dbe2dfcad2f68d9ff522051ae 6691 admin optional grub2_2.02+dfsg1-12.dsc
 fd7e5314427a7db5915b8990cbb5fc56 1126288 admin optional 
grub2_2.02+dfsg1-12.debian.tar.xz
 9abb7b87c62a864ab5044b7e1769cf5a 15038 admin optional 
grub2_2.02+dfsg1-12_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEErApP8SYRtvzPAcEROTWH2X2GUAsFAlx5J1YACgkQOTWH2X2G
UAvK4g//YG6+7BFAQo80XOW3JGsB/BKuyXJR7ZNoEU5RLsIHmSWpPIt3v/sltiHL
D6qcknGSbcj0/knd5uo34BsxdFbBfTw3oqfoLYGJfyFy4xgNiV9b7qBETDfoWfFX
DDL/qxqI70Gu0Y6/+dIbQwsxezunTAiQ5scURL2fLHXsGP4HZrFBp5rcSSCI5zej
rZ/IoDqb/ScvQBfC5GF3QeDGGIDsvnYNL8QbASM78Te2JZ5ec4J4e6Me+GD2DxtA
VD1ybL7sB8j3EtnYjIbL/9B3DfgIS+vpqT2FXiTC7nh/k5AVobHWpX5QsWII3fvc
OfZ9oI0EUiImx9+/7ppSoqLaXu+b6otvSSgCwFdtxOnOO1UNDgGskCoda4vwJpE7
c+om5WAguXTWmDSUo6JzaggFf32R6X6L1tqOFfWguTdQ4qD0M2sakTxtISUvybGx
PZIyamkhpNlNE+g+o+my0/WjlwYw+CZeBuQXKxaw6WSZsIJbmaVWy5gEmnA6AeXf
RpvyTB1iTi9VxamG9hMSwO+MNNcVc2/JYCyIlQckutHU9dq+pdLHVpaDrsLFvzYK
NhOozNScr0CP2XK1IYdpTwQsHqg0rZM6ymjNU3UCWyMtNnCAF95XXV5KpIPV9Pza
13h4J5IScKj00ALaubZ0NsN+Tsv55+Zak8FFOwCKxC1RI9Vi3zk=
=6Jmj
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to