Kernel Support for X

# 7 Kernel Support for X

Contents of this section

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

> `options XSERVER, UCONSOLE`

The server supports several console drivers: pccons, pcvt, syscons and codrv. They are detected at runtime and no configuration of the server itself is required.

The pccons driver is the most widely tested and is the console driver contained in the NetBSD binary distribution's kernels.

The pcvt console driver is bundled with NetBSD 1.0. The pcvt X mode is compatible with the pccons driver X mode. It offers several virtual consoles and international keyboard support. In order to use this driver, change the line:

> `device pc0 at isa? port "IO_KBD" irq 1`

to

> `device vt0 at isa? port "IO_KBD" irq 1`

in your kernel config file, and rebuild and install your kernel.

Syscons and codrv are not bundled with NetBSD 1.0. They are available by anonymous FTP from a number of sites.

If using pccons you get the message:

> `

>     > XFree86 Version 3.1.1 / X Window System
>     > (protocol Version 11, revision 0, vendor release 6000)
>     > Operating System: NetBSD
>     > Configured drivers:
>     >   Mach8: accelerated server for ATI Mach-8 graphics adaptors
>     > (Patchlevel 0)
>     >
>     > Fatal server error:
>     > xf86OpenConsole: CONSOLE_X_MODE_OFF failed (Inappropriate ioctl for device)
>     > Was expecting pccons driver with X support
>     > Check your kernel's console driver configuration and /dev entries
>     >

> `

then delete `/dev/ttyv0`. I don't know why ```MAKEDEV`'' move `/dev/ttyqf` to `/dev/ttyv0`. (from Hung-Chi Chu hcchu@r350.ee.ntu.edu.tw)

## 7.1 Aperture Driver

By default NetBSD 0.9C and higher include a kernel security feature that disable access to the `/dev/mem` device when in multi-users mode. But XFree86 servers can take advantage (or require) linear access to the display memory.

The P9000 and AGX servers require linear memory access, other accelerated servers can take advantage of it, but do not require it.

There are two ways to allow XFree86 to access linear memory:

1. Disable the kernel security feature by initializing the ``securelevel'' variable to -1 in `/sys/kern/kern_sysctl.c`, line 205 and building a new kernel. For more informations, see the comments in `/usr/include/sys/systm.h`.
2. Install the NetBSD aperture driver:
   1. add the following lines to the end of `/etc/rc.local`:

      > `

      >      KERNDIR=/usr/X11R6/lib/X11/kernel
      >      if [ -f ${KERNDIR}/ap.o ]; then
      >        modload -o ${KERNDIR}/ap -e ap -p ${KERNDIR}/apinstall ${KERNDIR}/ap.o
      >      fi

      > `

   2. On pre 1.0 versions of NetBSD modload does not execute post-install scripts. If you're running NetBSD 1.0 or later skip this. Else create the device manually: WARNING: be sure to understand what you'll do before proceeding
      1. find out what major device number will be allocated to you by modload. Modload allocates major numbers beginning at 29. So if ```ap`'' is your only device driver module, it will have major number 29. If it's the third, it will be 31…
      2. goto the `/dev` directory and type: ```mknod xf86 c 29 0`'' (replace 29 by the appropriate value if you load more than one device driver module.
   3. Reboot your system. XFree86 will auto-detect the aperture driver if available.

> Caveat: the NetBSD 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.

## 7.2 MIT-SHM

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

Under NetBSD 1.0, use the following to add shared memory support to your kernel:

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. Then from `/sys/arch/i386/config`, type:

> `

>      # rm -f ../compile/<KERNEL-NAME>/*
>      # config <KERNEL-NAME>
>      # cd ../compile/<KERNEL-NAME>
>      # make depend
>      # make

> `

Then install your new kernel and re-boot:

> `

>      # cp /netbsd /onetbsd
>      # cp netbsd /
>      # reboot

> `

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter