README for XFree86 4.0.2 on OpenBSD : Kernel Support for X
Previous: Running X
Next: Rebuilding the XFree86 Distribution

7. Kernel Support for X

To make sure X support is enabled under OpenBSD, the following line must be in your config file in /sys/arch/i386/conf:

option XSERVER option APERTURE

7.1. Console drivers

The server supports the two standard OpenBSD/i386 console drivers: pcvt and pccons. They are detected at runtime and no configuration of the server itself is required.

The pcvt console driver is the default in OpenBSD. It offers several virtual consoles and international keyboard support.

7.2. Aperture Driver

By default OpenBSD includes the BSD 4.4 kernel security feature that disable access to the /dev/mem device when in multi-users mode. But the XFree86 server require linear access to the display memory in most cases.

OpenBSD now requires the aperture driver to be enabled for all X servers, because the aperture driver also controls access to the I/O ports of the video boards.

To enable the aperture driver, once included in the kernel, set

in /etc/sysctl.conf.

Some drivers need a patch to the aperture driver in the kernel to work correctly with int10 support. If you get warning from xf86ReadBIOS like this one:

(II) checkDevMem: using aperture driver /dev/xf86
(WW) xf86ReadBIOS: /dev/mem mmap[s=600,a=0,o=0] failed (Invalid argument)
you should patch your kernel and rebuild it. Until it's integrated in OpenBSD-current, or a better fix is found, the patch is available at

I've also included it below, if you want to edit the source file by hand.

Index: sys/arch/i386/i386/mem.c
RCS file: /cvs/src/sys/arch/i386/i386/mem.c,v
retrieving revision 1.14
diff -u -r1.14 mem.c
--- sys/arch/i386/i386/mem.c	1999/11/20 11:11:28	1.14
+++ sys/arch/i386/i386/mem.c	2000/11/13 10:54:22
@@ -269,8 +269,8 @@
 /* minor device 4 is aperture driver */
 	case 4:
 		if (allowaperture &&
-		    (((off >= VGA_START && off <= BIOS_END) ||
-		    (unsigned)off > (unsigned)ctob(physmem))))
+		    (off <= BIOS_END || 
+		     (unsigned)off > (unsigned)ctob(physmem)))
 			return i386_btop(off);
 			return -1;

Another (less recommended) way to enable linear memory and I/O ports access is to disable the kernel security feature by adding ``option INSECURE'' in your kernel configuration file and build a new kernel. You will also need to comment out the line initializing securelevel to 1 in /etc/rc.securelevel.

Caveat: the aperture driver only allows one access at a time (so that the system is in the same security state once X is launched). This means that if you run multiple servers on multiples VT, only the first one will have linear memory access. Use 'option INSECURE' if you need more that one X server at a time.

7.3. MIT-SHM

OpenBSD supports System V shared memory. If XFree86 detects this support in your kernel, it will support the MIT-SHM extension.

To add support for system V shared memory to your kernel add the lines:

 # System V-like IPC
 options         SYSVMSG
 options         SYSVSEM
 options         SYSVSHM

to your kernel config file.

README for XFree86 4.0.2 on OpenBSD : Kernel Support for X
Previous: Running X
Next: Rebuilding the XFree86 Distribution