How do I add a Device Driver ?

David Broudy

Adding a device driver file to the RT-Mach kernel is not a difficult thing, but there are some tricks that may trip you up. All file paths in this document are relative to the rk97a/src/mk directory.

  1. Edit the kernel/conf/i386/files. Note that we are in the i386/ subdirectory. This is the file list for the platform dependant i386 files. Device drivers should always be in this platform dependant file.
    1. Add a line for each C file that you will be adding. It is not necessary to add lines for header files.
    2. Each line of the files file has the following format:
    3. filename type name device-driver
      1. filename: This is the name of the file relative to the kernel/ directory.
      2. type: This can be standard or optional. Drivers should always be optional. If it is optional it must be followed by a name.
      3. name: The name is very important. It will be used in the MASTER file to referance this group of files.
      4. device-driver: This text is present if the file is a device driver.
  2. Edit kernel/conf/i386/MASTER. This is the platform dependant MASTER file. Details of the fromat are in the platform independant MASTER file located in kernel/conf.
    1. Add the name of the device that you selected in files to one of the Configurations. Do not be confused by the fact that there are hash marks (#) in front of these lines; they are not comments.
    2. The MASTER file has the following format:
    3. type name # < name1, name2 >
      1. type: This will be the device or pseudo-device in the system dependant MASTER. No one seems to know the difference. This can be other things in the system independant MASTER.
      2. name: This sould be the same name as you used above and in the files file.
      3. attribute selector list: This list should include at least the name of this device, but this is also where you can list dependencies.
  3. Add your files. This is the most time consuming ste. You will probably have to port a few things here.
  4. Run odemake. No neet to worry about making the tree clean before you remake. Odemake will take care of that for you. You also do not need to tell odemake that you have changed the MASTER.