From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1THyat-0000ku-78 for mharc-grub-devel@gnu.org; Sat, 29 Sep 2012 11:04:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THyaq-0000jB-C0 for grub-devel@gnu.org; Sat, 29 Sep 2012 11:04:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THyap-0003R7-5z for grub-devel@gnu.org; Sat, 29 Sep 2012 11:04:36 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:39754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THyao-0003PI-QJ for grub-devel@gnu.org; Sat, 29 Sep 2012 11:04:35 -0400 Received: by lbok6 with SMTP id k6so3066651lbo.0 for ; Sat, 29 Sep 2012 08:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:x-mailer:mime-version; bh=On77ACWEeHUpDAtECIMQkWJTDWb5uqVTVGZqks4+wFo=; b=W6Ker+p7LPRvhO8dmHNIS5xeicq9zqgP1k8CBzesYAZ+xkUPdJ6CRek3ySj0kCFMTI Dy/H9iazpjloWDjsg/A7yOvxFCNZYikwCQ5UHjETQE1Bax7wmogFShPkYWNzwM6zrdMM lHDQFnPjDkpGBenKxfp5CiSnBER8BNzn4WmXOKfslffPG4Vwki2E3NLxfmMsC1fbYOR7 2O5AufRm8YFA9vBBFLaHXsxd73qmGgCIVxmNofnnfn4uJObXm9Q2LWm3wBtXbCOza4ig EcTaNQIwYFjvol1uDlK9KnrHFvQXVga3hhMmb3uP0rod2bDh3G02r2yhSW9WhhSTPT2U EwpA== Received: by 10.112.38.67 with SMTP id e3mr3654548lbk.98.1348931073722; Sat, 29 Sep 2012 08:04:33 -0700 (PDT) Received: from [192.168.10.142] (ppp83-237-18-178.pppoe.mtu-net.ru. [83.237.18.178]) by mx.google.com with ESMTPS id gd18sm3233504lab.1.2012.09.29.08.04.31 (version=SSLv3 cipher=OTHER); Sat, 29 Sep 2012 08:04:32 -0700 (PDT) Message-ID: <1348931070.2008.14.camel@opensuse.site> Subject: [RFC] Support for UEFI ESP in os-prober From: Andrey Borzenkov To: grub-devel@gnu.org Date: Sat, 29 Sep 2012 19:04:30 +0400 Content-Type: multipart/mixed; boundary="=-nGoM895tPzN684efMcTk" X-Mailer: Evolution 3.4.4 Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.217.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2012 15:04:37 -0000 --=-nGoM895tPzN684efMcTk Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Attached are suggested implementation for UEFI support. Because ESP can contain arbitrary number of boot entries, it is itself implemented as extensible framework. 1. /usr/lib/os-prober/mounted/05efi Makes basic plausibility checks (FAT and /EFI exists) and calls scripts from /usr/lib/os-prober/mounted/efi/* to perform OS detection. Returns detected bootladers in the form ${device}@${path}:${long}:${short}:efi 2. patch for /etc/grub.d/30_os-prober creates "chainloader ${path}" entry from the above 3. Patch for /usr/lib/os-prober/mounted/20microsoft It seems that on UEFI systems Windows sometimes installs both legacy and UEFI bootloader. In this case os-prober adds menu entries for legacy Windows boot which do not work from within UEFI GRUB bootloader. Patch detects UEFI platform and skips running there. 4. /usr/lib/os-prober/mounted/efi/20microsoft Suggested implementation for Microsoft bootloader. We have no way to create entries for individual OSes here (this would involve parsing BCD store at the very least), so entry is titled as "Windows Boot Manager", the same as is automatically added to UEFI boot menu. This is successfully tested on VM with Windows 7/openSUSE 12.2 dual boot. As openSUSE 12.2 comes with GRUB2 as default bootloader, this issue seems to be hit by quite a number of users. Comments? -andrey --=-nGoM895tPzN684efMcTk Content-Disposition: attachment; filename="os-prober-skip-MS-legacy-on-UEFI.patch" Content-Type: text/x-patch; name="os-prober-skip-MS-legacy-on-UEFI.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Index: b/os-probes/mounted/x86/20microsoft =================================================================== --- a/os-probes/mounted/x86/20microsoft +++ b/os-probes/mounted/x86/20microsoft @@ -7,6 +7,12 @@ partition="$1" mpoint="$2" type="$3" +# This script looks for legacy BIOS bootloaders only. Skip if running UEFI +if [ -d /sys/firmware/efi ]; then + debug "Skipping legacy bootloaders on UEFI system" + exit 1 +fi + # Weed out stuff that doesn't apply to us case "$type" in ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;; --=-nGoM895tPzN684efMcTk Content-Disposition: attachment; filename="30_os-prober.patch" Content-Type: text/x-patch; name="30_os-prober.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit --- /etc/grub.d/30_os-prober.orig 2012-09-28 22:12:51.047085849 +0400 +++ /etc/grub.d/30_os-prober 2012-09-29 18:35:25.949036128 +0400 @@ -144,6 +144,22 @@ EOF } EOF ;; + efi) + + EFIPATH=${DEVICE#*@} + DEVICE=${DEVICE%@*} + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" + cat << EOF +menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' { +EOF + save_default_entry | sed -e "s/^/\t/" + prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" + + cat <