Driver with A Single Source File

  1. Modify alsa-driver/pci/Makefile

    Suppose you have a file xyz.c. Add the following two lines

      snd-xyz-objs := xyz.o
      obj-$(CONFIG_SND_XYZ) += snd-xyz.o

  2. Create the Kconfig entry

    Add the new entry of Kconfig for your xyz driver.

      config SND_XYZ
              tristate "Foobar XYZ"
              depends on SND
              select SND_PCM
                Say Y here to include support for Foobar XYZ soundcard.
                To compile this driver as a module, choose M here: the module
                will be called snd-xyz.

    the line, select SND_PCM, specifies that the driver xyz supports PCM. In addition to SND_PCM, the following components are supported for select command: SND_RAWMIDI, SND_TIMER, SND_HWDEP, SND_MPU401_UART, SND_OPL3_LIB, SND_OPL4_LIB, SND_VX_LIB, SND_AC97_CODEC. Add the select command for each supported component.

    Note that some selections imply the lowlevel selections. For example, PCM includes TIMER, MPU401_UART includes RAWMIDI, AC97_CODEC includes PCM, and OPL3_LIB includes HWDEP. You don't need to give the lowlevel selections again.

    For the details of Kconfig script, refer to the kbuild documentation.

  3. Run cvscompile script to re-generate the configure script and build the whole stuff again.