README.modules 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Building a modular sound driver
  2. ================================
  3. The following information is current as of linux-2.1.85. Check the other
  4. readme files, especially README.OSS, for information not specific to
  5. making sound modular.
  6. First, configure your kernel. This is an idea of what you should be
  7. setting in the sound section:
  8. <M> Sound card support
  9. <M> 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support
  10. I have SoundBlaster. Select your card from the list.
  11. <M> Generic OPL2/OPL3 FM synthesizer support
  12. <M> FM synthesizer (YM3812/OPL-3) support
  13. If you don't set these, you will probably find you can play .wav files
  14. but not .midi. As the help for them says, set them unless you know your
  15. card does not use one of these chips for FM support.
  16. Once you are configured, make zlilo, modules, modules_install; reboot.
  17. Note that it is no longer necessary or possible to configure sound in the
  18. drivers/sound dir. Now one simply configures and makes one's kernel and
  19. modules in the usual way.
  20. Then, add to your /etc/modprobe.d/oss.conf something like:
  21. alias char-major-14-* sb
  22. install sb /sbin/modprobe -i sb && /sbin/modprobe adlib_card
  23. options sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330
  24. options adlib_card io=0x388 # FM synthesizer
  25. Alternatively, if you have compiled in kernel level ISAPnP support:
  26. alias char-major-14 sb
  27. softdep sb post: adlib_card
  28. options adlib_card io=0x388
  29. The effect of this is that the sound driver and all necessary bits and
  30. pieces autoload on demand, assuming you use kerneld (a sound choice) and
  31. autoclean when not in use. Also, options for the device drivers are
  32. set. They will not work without them. Change as appropriate for your card.
  33. If you are not yet using the very cool kerneld, you will have to "modprobe
  34. -k sb" yourself to get things going. Eventually things may be fixed so
  35. that this kludgery is not necessary; for the time being, it seems to work
  36. well.
  37. Replace 'sb' with the driver for your card, and give it the right
  38. options. To find the filename of the driver, look in
  39. /lib/modules/<kernel-version>/misc. Mine looks like:
  40. adlib_card.o # This is the generic OPLx driver
  41. opl3.o # The OPL3 driver
  42. sb.o # <<The SoundBlaster driver. Yours may differ.>>
  43. sound.o # The sound driver
  44. uart401.o # Used by sb, maybe other cards
  45. Whichever card you have, try feeding it the options that would be the
  46. default if you were making the driver wired, not as modules. You can
  47. look at function referred to by module_init() for the card to see what
  48. args are expected.
  49. Note that at present there is no way to configure the io, irq and other
  50. parameters for the modular drivers as one does for the wired drivers.. One
  51. needs to pass the modules the necessary parameters as arguments, either
  52. with /etc/modprobe.d/*.conf or with command-line args to modprobe, e.g.
  53. modprobe sb io=0x220 irq=7 dma=1 dma16=5 mpu_io=0x330
  54. modprobe adlib_card io=0x388
  55. recommend using /etc/modprobe.d/*.conf.
  56. Persistent DMA Buffers:
  57. The sound modules normally allocate DMA buffers during open() and
  58. deallocate them during close(). Linux can often have problems allocating
  59. DMA buffers for ISA cards on machines with more than 16MB RAM. This is
  60. because ISA DMA buffers must exist below the 16MB boundary and it is quite
  61. possible that we can't find a large enough free block in this region after
  62. the machine has been running for any amount of time. The way to avoid this
  63. problem is to allocate the DMA buffers during module load and deallocate
  64. them when the module is unloaded. For this to be effective we need to load
  65. the sound modules right after the kernel boots, either manually or by an
  66. init script, and keep them around until we shut down. This is a little
  67. wasteful of RAM, but it guarantees that sound always works.
  68. To make the sound driver use persistent DMA buffers we need to pass the
  69. sound.o module a "dmabuf=1" command-line argument. This is normally done
  70. in /etc/modprobe.d/*.conf files like so:
  71. options sound dmabuf=1
  72. If you have 16MB or less RAM or a PCI sound card, this is wasteful and
  73. unnecessary. It is possible that machine with 16MB or less RAM will find
  74. this option useful, but if your machine is so memory-starved that it
  75. cannot find a 64K block free, you will be wasting even more RAM by keeping
  76. the sound modules loaded and the DMA buffers allocated when they are not
  77. needed. The proper solution is to upgrade your RAM. But you do also have
  78. this improper solution as well. Use it wisely.
  79. I'm afraid I know nothing about anything but my setup, being more of a
  80. text-mode guy anyway. If you have options for other cards or other helpful
  81. hints, send them to me, Jim Bray, jb@as220.org, http://as220.org/jb.