How to add an (S)VGA driver to XFree86 : Setting Up The Build Information
Previous: Directory Tree Structure
Next: The Bank-Switching Functions

## 4. Setting Up The Build Information

This section describes the peripheral configuration and build steps that must be performed to set up for your new driver. The steps are the same whether you are building from the source tree of from the Link Kit; only the locations of the files is different. Here are the configuration steps that must be followed:

1. Choose the name for your driver subdirectory and data structures. Since the current driver scheme allows (in fact, encourages) putting drivers for multiple related chipsets in a single driver, it is usually best to use the vendor name, rather than a chipset version. The fact that older XFree86 drivers do not follow this convention should not deter you from using it now - most of that code was developed before the driver interface had been made flexible and extensible. For this documentation, we'll use chips from the SuperDuper Chips vendor. Hence, we'll use `sdc' for the name of the driver.
2. Decide whether your driver will support the color server, the monochrome server, or both. For this documentation, we will assume that both the color and monochrome servers will be supported. If you intend to support only the color server, the steps for the monochrome server can be ignored. If you intend to support only the monochrome server, the steps for the color server listed should be performed for the monochrome server, and the monochrome steps ignored. Most of the existing drivers support only the color or both servers; the ``generic'' driver is the only driver (currently) that supports just the monochrome server.
3. Create your driver directories:
   - If you are working in the source tree, create the following directories:

            xc/programs/Xserver/hw/xfree86/vga256/drivers/sdc
            xc/programs/Xserver/hw/xfree86/vga16/drivers/sdc
            xc/programs/Xserver/hw/xfree86/vga2/drivers/sdc

   - If you are working in the Link Kit, create the following directories:

            /usr/X11R6/lib/Server/drivers/vga256/sdc
            /usr/X11R6/lib/Server/drivers/vga16/sdc
            /usr/X11R6/lib/Server/drivers/vga2/sdc

4. Set up the Imakefile parameters to cause your driver to be built:
   - If you are working in the source tree:
     1. Edit the file xc/config/cf/xfree86.cf, and add `sdc' to the list for the definitions for `XF86Vga256Drivers', `XF86Vga16Drivers' and `XF86Vga2Drivers'. You should put `sdc' just before `generic' in the list (i.e. second last), to ensure that none of the other driver's probe functions incorrectly detect the `sdc' chipset .
     2. Edit the file xc/config/cf/xf86site.def, and add the same entries in this file (this is just a comment that shows the default values).
     3. Edit the site.def.LK file in xc/programs/Xserver/hw/xfree86/LinkKit/, and add the same entries in this file. This is the prototype `site.def' file that will be installed in the Link Kit.
   - If you are working in the Link Kit, edit the file /usr/X11R6/lib/Server/site.def, and add `sdc' to the `XF86Vga256Drivers', `XF86Vga16Drivers' and `XF86Vga2Drivers' definitions as described in (a) above.
5. Now copy the prototype files into your new directories:
   - If you are working in the source tree, copy the `stub' files as follows (directories are below xc/programs/Xserver):
     Imakefile.stub =>

       hw/xfree86/vga256/drivers/sdc/Imakefile

     stub_driver.c =>

       hw/xfree86/vga256/drivers/sdc/sdc_driver.c

     stub_bank.s =>

       hw/xfree86/vga256/drivers/sdc/sdc_bank.s

     Imakefile.stub =>

       hw/xfree86/vga16/drivers/sdc/Imakefile (then edit this Imakefile and make the changes described in the comments).

     Imakefile.stub =>

       hw/xfree86/vga2/drivers/sdc/Imakefile (then edit this Imakefile and make the changes described in the comments).

   - If you are working in the Link Kit, copy the `stub' files as follows:
     Imakefile.stub =>

       /usr/X11R6/lib/Server/drivers/vga256/sdc/Imakefile

     stub_driver.c =>

       /usr/X11R6/lib/Server/drivers/vga256/sdc/sdc_driver.c

     stub_bank.s =>

       /usr/X11R6/lib/Server/drivers/vga256/sdc/sdc_bank.s

     Imakefile.stub =>

       /usr/X11R6/lib/Server/drivers/vga16/sdc/Imakefile (then edit this Imakefile and make the changes described in the comments).

     Imakefile.stub =>

       /usr/X11R6/lib/Server/drivers/vga2/sdc/Imakefile (then edit this Imakefile and make the changes described in the comments).

6. Edit each of the files you've just copied, and replace `stub' with `sdc' and `STUB' with `SDC' wherever they appear.

That's all the prep work needed. Now it's time to work on the actual driver.

How to add an (S)VGA driver to XFree86 : Setting Up The Build Information
Previous: Directory Tree Structure
Next: The Bank-Switching Functions