|
There are two methods for enabling sound support on FreeBSD 5.x: recompile the kernel to add the sound driver, or use kernel loadable modules.
Regardless of which method you end up using, I recommend that you start with the modules. It will usually take a couple tries to find the correct sound driver and settings, and having to recompile a new kernel and reboot after each change is a royal pain. Much simpler / faster to just load / unload various modules until you find the right combinatoion.
To figure out which sound driver to use:
1. As root, load every single sound driver that FreeBSD supports and let the kernel try to detect your hardware:
# kldload snd_driver
2. Check the contents of the sndstat file to see if the kernel detected your hardware, and which driver it is using:
# cat /dev/sndstat
You should see something similar to:
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <VIA VT82C686A> at io 0x1000 irq 5 (1p/1r/4v channels duplex default)
This tells you that it is using the NEWPCM architecture, that it is using the pcm sound driver, and that it detected a VIA VT82C686A sound chip.
3. Unload all the sound drivers:
#kldunload snd_driver
4. Load just the pcm sound driver:
# kldload snd_pcm
5. Check the contents of the sndstat file again to see if it identical to the output above. If so, then you have found the driver that needs to be loaded. If not, then you will need to experiment with other drivers until you find the correct one.
6. If the contents are identical, then check which sound modules the kernel loaded:
# kldstat
(I'd list a sample, but I'm not using modules right now as this is a laptop and I won't be chaning the soundcard anytime soon.)
If you want to continue to use the kernel modules, you will need to edit /boot/loader.conf and tell it which modules to load at boot time. To do so, open that file in your favourite text editor and add the following lines:
snd_pcm_load="YES"
snd_via82c686_load="YES"
IOW, put the kernel modules listed by kldstat followed by _load="YES". (For more info on loader.conf, read the man page and the comments in /boot/defaults/loader.conf.)
If you want to compile the sound drivers into your kernel, then you will need to edit the kernel config file and add device pcm. If it's an ISA sound card, you may need to add the sbc device as well.
Unlike FreeBSD 4.x, you don't set the IRQ, DMA, or IO info directly in the kernel config file. This information is stored in a separate text file: /boot/device.hints Read through the options listed in /usr/src/sys/conf/NOTES and add the relevant entries to the device.hints file.
To see which sound drivers the kernel supports try the following:
# ls /modules/snd_*
And the man pages for pcm(4), sbc(4), csa(4), and gus(4) also list the chipsets they support. These man pages also list how to set the IRQ, DMA, IO for ISA-based cards.
The nice thing about FreeBSD 5.x is that it supports the device filesystem (devfs) which will create the needed sound devices for you. If you load the sound modules than look in /dev, you'll see the dsp, audio, snd, and mixer devices appear. If you unload the sound modules, these device nodes disappear. Nifty, eh? And if you compiled the sound drivers into the kernel, these device nodes will appear at boot time.
Hope that helps you get sound working on your FreeBSD system. If you have any questions or comments, please post them here. Thanks.
[Edit: added missing snd_ to pcm driver] |
|