[EFI] libdebian-installer: add efi subarch for amd64 and i386
Hi,
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.
--
Steve McIntyre, Cambridge, UK. steve@einval.com
"I've only once written 'SQL is my bitch' in a comment. But that code
is in use on a military site..." -- Simon Booth
mr diff: /home/steve/debian/d-i/d-i/packages/libdebian-installer
diff --git a/debian/changelog b/debian/changelog
index ea88601..8e7866e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ libdebian-installer (0.82) UNRELEASED; urgency=low
* Support for reading hardware model from Device Tree (armel).
* Add Dreamplug device (Kirkwood)
+ [ Steve McIntyre ]
+ * Add "efi" as a subarch for amd64
+
-- Ian Campbell <ijc@hellion.org.uk> Tue, 10 Jul 2012 21:15:56 +0000
libdebian-installer (0.81) unstable; urgency=low
diff --git a/src/system/subarch-x86-linux.c b/src/system/subarch-x86-linux.c
index 567d3c2..e8bf343 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++)
Reply to: