On Wed, Aug 22, 2012 at 01:59:46PM -0400, Joey Hess wrote: >Steve McIntyre wrote: >> Looking through the Ubuntu version of debian-installer, I can see that >> Colin and I independently came up with nigh-on exactly the same way to >> deal with EFI systems, using a subarch to identify them. We've >> differed very slightly in terms of the the source code in >> libdebian-installer for checking for /sys/firmware/efi, but the effect >> is the same. Here's my diff. > >This patch doesn't apply cleanly to current git, both hunks conflect. >Perhaps you could rebase on current git head and use git format-patch? > >> +static int is_efi(void) >> +{ >> + int ret = access("/sys/firmware/efi", R_OK); >> + if (ret == 0) > >This appears to be some broken indentation.
ACK to both. Here's the cleaned-up and rebased patch. -- Steve McIntyre, Cambridge, UK. st...@einval.com "Since phone messaging became popular, the young generation has lost the ability to read or write anything that is longer than one hundred and sixty characters." -- Ignatios Souvatzis
>From 7479488017fd905ae86ee4632b28d392e84a6d99 Mon Sep 17 00:00:00 2001 From: Steve McIntyre <st...@einval.com> Date: Wed, 22 Aug 2012 19:34:50 +0100 Subject: [PATCH] Add "efi" as a subarch for amd64 and i386 --- debian/changelog | 7 +++++++ src/system/subarch-x86-linux.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/debian/changelog b/debian/changelog index d48c86a..1250fdb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libdebian-installer (0.84) UNRELEASED; urgency=low + + [ Steve McIntyre ] + * Add "efi" as a subarch for amd64 and i386 + + -- Steve McIntyre <93...@debian.org> Wed, 22 Aug 2012 19:24:48 +0100 + libdebian-installer (0.83) unstable; urgency=low * Re-upload without files from git checkout. diff --git a/src/system/subarch-x86-linux.c b/src/system/subarch-x86-linux.c index 567d3c2..1e903b3 100644 --- a/src/system/subarch-x86-linux.c +++ b/src/system/subarch-x86-linux.c @@ -250,6 +250,17 @@ static char *dmi_system_manufacturer(void) return ret; } +/* Are we on an EFI system? Check to see if /sys/firmware/efi + * exists */ +static int is_efi(void) +{ + int ret = access("/sys/firmware/efi", R_OK); + if (ret == 0) + return 1; + else + return 0; +} + struct map { const char *entry; const char *ret; @@ -267,6 +278,11 @@ const char *di_system_subarch_analyze(void) const char *ret = "generic"; int i; + /* Look for generic EFI first; this will be over-ridden by the mac + * detection next if we're on a mac. */ + if (is_efi()) + ret = "efi"; + if (manufacturer) { for (i = 0; map_manufacturer[i].entry; i++) -- 1.7.10.4