LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 3368|回复: 4

Enabling sound on FreeBSD 5.x[zz]

[复制链接]
发表于 2004-2-21 10:32:35 | 显示全部楼层 |阅读模式
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]
发表于 2004-7-9 16:46:45 | 显示全部楼层
比起4.X真的是方便多了!看来我也得去弄个5.X装装。再也不用为了一个声卡编译内核了。FreeBSD,I love u!
发表于 2005-1-5 19:56:53 | 显示全部楼层
freebsd# kldload snd_driver
freebsd# cat /dev/sndstat
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <CMedia CMI8738> at io 0xe800 irq 10 kld snd_cmi (1p/1r/0v channels duplex default)
freebsd# kldunload snd_driver
kldunload: can't find file snd-driver: No such file or directory
freebsd# kldload snd_pcm
kldload: can't load snd_pcm: No such file or directory
freebsd# kldload snd_cmi
kldload:can't load snd_cmi:NO such file or directory

我看了freebsd5.3 关盘中的有关支持的硬件是支持cmi8738的,但为何不能用呢?

原来是这样
#chmod 0200 /boot/defaulte/loader.conf
将其中的声卡设置YES就ok 了。
发表于 2005-1-5 20:36:05 | 显示全部楼层
做人要厚道啊,不说出处,起码把作者名也写上吧

http://www.freebsdforums.org/for ... &threadid=19095
发表于 2005-1-5 20:38:49 | 显示全部楼层
www.freebsdforums.org

phoenix
Moderator

Registered: Apr 2002
Location: Kamloops, BC, Canada
Posts: 7934
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表