[patch] Don't require a working efifb when probing for EFI/GPT

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[patch] Don't require a working efifb when probing for EFI/GPT

Andrew Daugherity
I successfully installed OpenBSD under xhyve, although there were a
few issues, mostly xhyve's fault [1].  One which seems to be an issue
with OpenBSD itself rather than xhyve is that with a headless machine,
the installer always uses MBR mode.  I selected GPT and ignored the
warning "An EFI/GPT disk may not boot. Proceed?"; it boots fine, of
course, since it's using the TianoCore EDK II firmware.  (And MBR mode
would not boot, unless I manually created and populated an EFI System
Partition.)

I tracked this down to install.md checking for efifb (it's expecting
something like 'efifb0 at mainbus0: 1024x768, 32bpp' in the dmesg):
====
  if dmesg | grep -q 'efifb0 at mainbus0'; then
    MDEFI=y
  fi
====

With a headless VM, however, the dmesg line is:
efifb at mainbus0 not configured

I can't find a better way to detect EFI via dmesg or sysctl hw, so a
simple patch to install.md will have to suffice:
====
diff --git distrib/amd64/common/install.md distrib/amd64/common/install.md
index d4fc8418a97..0c9db939463 100644
--- distrib/amd64/common/install.md
+++ distrib/amd64/common/install.md
@@ -35,7 +35,7 @@ MDXAPERTURE=2
 MDXDM=y
 NCPU=$(sysctl -n hw.ncpufound)

-if dmesg | grep -q 'efifb0 at mainbus0'; then
+if dmesg | egrep -q 'efifb0? at mainbus0'; then
  MDEFI=y
 fi

====
(diff also attached)

This probably also applies to physical hardware where efifb is broken
for whatever reason.  I've verified that this still behaves correctly
with a working efifb0.

No idea if this also applies to any other platforms beside amd64, but
a quick glance at i386, arm64, and armv7 seems to say no.


-Andrew

[1] https://github.com/machyve/xhyve/issues/179#issuecomment-561903641

install-efi-gpt.diff (508 bytes) Download Attachment