LinuxSir.cn,穿越时空的Linuxsir!

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

启动语句在rc.M与rc.local有什么区别?

[复制链接]
发表于 2004-9-28 21:28:39 | 显示全部楼层 |阅读模式
由于升级内核,需要重新编译alsa驱动,是自己下载源码编译的,但保留了原先系统的配置文件,也就是rc.alsa,asound.state,以及rc.M中的关于alsa的部分。但是系统启动时alsactl老说找不到声卡,后来复制rc.M中相关的语句到rc.local中,再注释掉rc.M中的,启动就正常了。问题是相同的启动语句放到rc.M中与放到rc.local中有什么区别?
发表于 2004-9-29 08:42:32 | 显示全部楼层
看看这个,自己再琢磨琢磨
http://slack.linuxsir.cn/main/?q=node/view/68
发表于 2004-9-29 09:01:16 | 显示全部楼层
很奇怪,难明白
windroze知道就讲讲吧。琢磨不出来啊
发表于 2004-9-29 10:59:25 | 显示全部楼层
我也不太清楚,估计和hotplug的自动检测有关。最好的办法是看看各个脚本之间的调用关系,自己理出头绪。
 楼主| 发表于 2004-9-29 11:55:46 | 显示全部楼层
还是不太明白。当把关于alsa的语句放在rc.M中时,启动时会出错,但是在登录之后,自己运行:alsactl restore,一切正常。难道在登录之前与之后之间还有什么内部操作吗?
发表于 2004-9-29 12:32:04 | 显示全部楼层
可能在rc.M中调用alsa的语句时,声卡驱动模块还没有加载。很多服务之间有相互依赖的关系,要求一定的启动次序。
发表于 2004-9-29 19:39:25 | 显示全部楼层
呵呵,楼主试试吧alsa的部分加在rc.M的最后看可以不?
发表于 2004-9-29 19:59:04 | 显示全部楼层
如果楼主使用 alsa,并且 rc.hotplug 是可执行的话,那么多数情况下都会自动加载。
如果声卡模块没有被加载,那可以使用如下办法:
安装 alsa-lib 和 alsa-utils 包。使用里面的 alsaconf 命令配置,如果这个程式找到了声卡,那么它会自动将加载的模块写入 /etc/modules.conf(2.4内核) 或 /etc/modprof.conf (2.6内核) 这个文件中,开机时就能加载了。如果程式没有找到声卡,那就升级 alsa-driver 试试。
注意:
alsaconf 配置好后是全部静音状态,可用 alsamixer 打开声道。若重启后又变为静音,请查看在 /etc/rc.d 中没有有可执行的 rc.alsa 文件,若没有(slack10 好像没有),可在 /etc/rc.d 中加入一个文件 rc.alsa 使用以下命令
[php]
cat > /etc/rc.d/rc.alsa << "EOF"
#!/bin/sh
# Load the mixer settings and OSS compatibility for ALSA.
# (the Advanced Linux Sound Architecture)

# A function to load the ALSA mixer settings:
load_alsa_mixer() {
  if [ -r /etc/asound.state ]; then
    echo "Loading ALSA mixer settings:  /usr/sbin/alsactl restore"
    /usr/sbin/alsactl restore
  else
    echo "ALSA warning:  No mixer settings found in /etc/asound.state."
    echo "  Sound may be muted.  Use 'alsamixer' to unmute your sound card,"
    echo "  and then 'alsactl store' to save the default ALSA mixer settings"
    echo "  to be loaded at boot."
  fi
}

# A function to load the ALSA OSS compat modules:
load_alsa_oss_modules() {
  if ! cat /proc/modules | grep -w snd-pcm-oss 1> /dev/null 2> /dev/null ; then
    echo "Loading OSS compatibility modules for ALSA."
    modprobe snd-pcm-oss
    modprobe snd-mixer-oss
  fi
}

# If hotplug or something else has loaded the ALSA modules, then
# simply load the mixer settings and make sure the OSS compat
# modules are loaded:
if [ -d /proc/asound ]; then
  load_alsa_mixer
  load_alsa_oss_modules
else
  # If there are ALSA modules defined in /etc/modules.conf, but
  # ALSA is not yet loaded, then load the modules now:
  DRIVERS=`modprobe -c | grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | awk '{ print $3 }'`
  if [ ! "$DRIVERS" = "" ]; then
    echo "Loading ALSA kernel modules."
    for module in $DRIVERS; do
      modprobe $module
    done
  fi
  # If ALSA is now up, then load the mixer settings and OSS modules:
  if [ -d /proc/asound ]; then
    load_alsa_mixer
    load_alsa_oss_modules
  fi
fi

EOF

chmod +x /etc/rc.d/rc.alsa
[/php]

以上是我在使用时的一些心得,希望对楼主有所帮助。
 楼主| 发表于 2004-9-30 00:29:58 | 显示全部楼层

apache惹的祸???

按照rc.M中的顺序,我试了一下,结果竟发现跟rc.httpd关。具体测试如下:当我把有关alsa的语句放在httpd语句之前时,alsa启动就出错; 放在它的后面就没有问题。我把httpd语句注释之后再启动,alsa又出错了。呵呵,两个风马牛不相及的东西居然还有这种关系(我的电脑上装了apache)。
看来还得好好学一学。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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