Gentoo安装详解(四)-- 配置声卡
配置声卡
To choose the right driver, first detect the used audio controller. Use lspci for this task:
lspci | grep -i audio
内核配置
You need to activate the following kernel options:
Device Drivers --->
<*> Sound card support
<*> Advanced Linux Sound Architecture --->
[*] PCI sound devices --->
Select the driver for your audio controller.
HD-Audio --->
Select a codec or enable all and let the generic parse choose the right one:
[*] Build Realtek HD-audio codec support
[*] ...
[*] Build Silicon Labs 3054 HD-modem codec support
[*] Enable generic HD-audio codec parser
[*] USB sound devices --->
Must have as some cards are presented as USB devices.
[*] USB Audio/MIDI driver
General setup --->
[*] System V IPC
The lsmod command can be helpful.
If the system has more than 8 sound outputs (Each HDMI output on a GPU will count as one), the max number of sound cards will need to be increased:
KERNEL
Device Drivers --->
<*> Sound card support
<*> Advanced Linux Sound Architecture --->
[*] Dynamic device file minor numbers
(32) Max number of sound cards
软件
The media-sound/alsa-utils package provides some tools for troubleshooting and testing the sound system. It is a good idea to merge the package if it is not already installed:
emerge --ask alsa-utils
配置
权限
If the acl
USE flag enabled globally and a login daemon (e.g. systemd-logind or elogind) is being used (i.e the system is using a desktop profile) permissions to sound cards will be handled automatically. Permissions can be checked using getfacl:
getfacl /dev/snd/controlC0 | grep larry
user:larry:rw-
Add the user you want to be able to access the sound card to the audio group:
gpasswd -a larry audio
服务
You can now start ALSA:
/etc/init.d/alsasound start
To start ALSA at boot time, add it your boot runlevel:
rc-update add alsasound boot
Mixer 调节音量,取消静音
If you can't hear anything, the output channels may be muted. Unmute the channels with the desktop environment's mixer or with alsamixer by selecting the appropriate channels and pressing the M
key to mute or unmute:
alsamixer
测试声音
If everything above is perfect, you should now be able to test your sound card and your speakers. We will use the speaker-test command line tool from package media-sound/alsa-utils (this should already be installed as per our previous recommendation).
speaker-test -t wav -c 2