Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TsABV-00036u-1Q for mharc-grub-devel@gnu.org; Mon, 07 Jan 2013 05:44:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsABS-00036O-Cu for grub-devel@gnu.org; Mon, 07 Jan 2013 05:43:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsABR-0007M4-AK for grub-devel@gnu.org; Mon, 07 Jan 2013 05:43:58 -0500 Received: from v6.chiark.greenend.org.uk ([2001:ba8:1e3::]:46761 helo=chiark.greenend.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsABR-0007Ly-4F for grub-devel@gnu.org; Mon, 07 Jan 2013 05:43:57 -0500 Received: from [172.20.153.9] (helo=riva.pelham.vpn.ucam.org) by chiark.greenend.org.uk (Debian Exim 4.72 #1) with esmtps (return-path cjwatson@ubuntu.com) id 1TsABP-0006N1-BJ for grub-devel@gnu.org; Mon, 07 Jan 2013 10:43:55 +0000 Received: from localhost ([127.0.0.1] helo=sarantium.pelham.vpn.ucam.org) by riva.pelham.vpn.ucam.org with esmtp (Exim 4.72) (envelope-from ) id 1TsABO-0000CG-CJ for grub-devel@gnu.org; Mon, 07 Jan 2013 10:43:54 +0000 Received: from riva.dynamic.greenend.org.uk (localhost [127.0.0.1]) by sarantium.pelham.vpn.ucam.org (Postfix) with ESMTPS id 0F8593E4FDD for ; Mon, 7 Jan 2013 10:43:12 +0000 (GMT) Date: Mon, 7 Jan 2013 10:43:10 +0000 From: Colin Watson To: grub-devel@gnu.org Subject: Re: Detecting running platform (specifically EFI) during runtime? Message-ID: <20130107104310.GA26167@riva.dynamic.greenend.org.uk> References: <20130105132855.3ec74e3a@opensuse.site> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:ba8:1e3:: 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: Mon, 07 Jan 2013 10:43:59 -0000 On Sat, Jan 05, 2013 at 05:17:18PM +0530, Keshav P R wrote: > On Sat, Jan 5, 2013 at 2:58 PM, Andrey Borzenkov wrote: > > Is it possible to check at run-time on which platform we are running. > > Specifically, any way to distinguish between EFI and legacy BIOS? > > Something like below should work (requires grub 2.00, not 1.99): > > [CODE - part of grub.cfg] > if [ "${grub_platform}" == "efi" ]; then > set _GRUB_PLATFORM="UEFI" > > if [ "${grub_cpu}" == "x86_64" ]; then I have now documented the grub_cpu and grub_platform environment variables in docs/grub.texi in trunk. (When explaining something not documented in the manual, please consider whether it would be useful to propose a documentation patch.) Cheers, -- Colin Watson [cjwatson@ubuntu.com]