aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-03-23 14:52:46 +0100
committerTakashi Iwai <tiwai@suse.de>2010-03-23 14:52:46 +0100
commit26257eb95767a0085c02a154ac22fdfdbfc8188a (patch)
tree541757eb2183df1cb1ef25ba0a0175653b65f251
parent3791628cfa296f06f5f58e905edd19ec5e126a3f (diff)
parentd2f4ae999dd73c8e9151819d947eee46a25dab36 (diff)
downloadalsa-driver-build-unstable-26257eb95767a0085c02a154ac22fdfdbfc8188a.tar.gz
Merge remote branch 'alsa/master'
-rw-r--r--Makefile2
-rw-r--r--configure.in25
-rwxr-xr-xutils/alsa-compile.sh137
3 files changed, 106 insertions, 58 deletions
diff --git a/Makefile b/Makefile
index 134cce406..51e80161d 100644
--- a/Makefile
+++ b/Makefile
@@ -128,8 +128,8 @@ $(ALSAKERNELFILE):
else \
# alsa-kmirror tree \
ln -sf $(ALSAKERNELDIR) alsa-kernel ; \
- ln -sf alsa-kernel sound ; \
fi; \
+ ln -sf alsa-kernel sound ; \
fi \
}
diff --git a/configure.in b/configure.in
index 9f9ae9a5c..fa85eb4d8 100644
--- a/configure.in
+++ b/configure.in
@@ -69,7 +69,19 @@ AC_ARG_WITH(alsakernel,
[alsakerneldir="$withval"],
[alsakerneldir="../alsa-kmirror"]
)
-ALSAKERNELDIR=$(cd "$alsakerneldir" && pwd)
+ALSAKERNELDIR=""
+if test -d "$alsakerneldir"; then
+ ALSAKERNELDIR=$(cd "$alsakerneldir" && pwd)
+elif test -d "alsa-kernel"; then
+ ALSAKERNELDIR=$(cd "alsa-kernel" && pwd)
+fi
+if test -z "$ALSAKERNELDIR"; then
+ cat << EOF
+The directory $alsakerneldir does not exist.
+Please obtain the ALSA linux kernel tree (alsa-kmirror or alsa-kernel).
+EOF
+ exit 1
+fi
AC_MSG_RESULT($alsakerneldir)
AC_SUBST(ALSAKERNELDIR)
@@ -90,7 +102,16 @@ AC_ARG_WITH(kernel,
DEFAULT_KERNEL_BUILD=""],
[kerneldir="$DEFAULT_KERNEL_DIR"]
)
-CONFIG_SND_KERNELDIR=$(cd "$kerneldir" && pwd)
+if test -d "$kerneldir"; then
+ CONFIG_SND_KERNELDIR=$(cd "$kerneldir" && pwd)
+else
+ cat << EOF
+Please install the package with full kernel sources for your distribution
+or use --with-kernel=dir option to specify another directory with kernel
+sources (default is $DEFAULT_KERNEL_DIR).
+EOF
+ exit 1
+fi
AC_MSG_RESULT($kerneldir)
dnl Check for directory with kernel build tree...
diff --git a/utils/alsa-compile.sh b/utils/alsa-compile.sh
index e6c33e91c..c5e51f145 100755
--- a/utils/alsa-compile.sh
+++ b/utils/alsa-compile.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-version=0.1.3
+version=0.2.1
protocol=
distrib=unknown
distribver=0.0
@@ -33,6 +33,15 @@ patches=
kmodmesg=
withdebug=
+fuser_prg=fuser
+insmod_prg=insmod
+rmmod_prg=rmmod
+lsmod_prg=lsmod
+test -x /sbin/fuser && fuser_prg=/sbin/fuser
+test -x /sbin/insmod && insmod_prg=/sbin/insmod
+test -x /sbin/rmmod && rmmod_prg=/sbin/rmmod
+test -x /sbin/lsmod && lsmod_prg=/sbin/lsmod
+
usage() {
echo "Usage: $0 [OPTION]..."
cat <<EOF
@@ -53,7 +62,8 @@ Operation modes:
--patch=patch apply code patch (can be used multiple times)
--tmpdir=dir set temporary directory (overrides TMPDIR envval)
--kmodules[=mods] reinsert kernel modules or insert specified modules
- to current kernel
+ to current kernel; more modules can be delimited
+ with ',' and arguments can be delimited with ':'
--kmodlist list ALSA toplevel kernel modules
--kmodremove remove ALSA kernel modules from kernel
--kmodclean remove installed ALSA kernel modules from /lib/modules
@@ -120,7 +130,7 @@ do
-y|--yes)
yes=true ;;
-c*|--clean*)
- clean=
+ clean="full"
case "$#,$1" in
*,*=*)
clean=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
@@ -212,7 +222,8 @@ do
--kmodules*)
case "$#,$1" in
*,*=*)
- kernelmodules=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
+ kernelmodules=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+ ;;
1,*)
kernelmodules="reinstall" ;;
*)
@@ -227,7 +238,7 @@ do
kmodremove=true
;;
--kmodclean)
- dir="/lib/modules/`uname -r`/alsa/updates"
+ dir="/lib/modules/`uname -r`/updates/alsa"
echo "Removing kernel modules in $dir:"
if test -d $dir; then
if ! rm -rf $dir; then
@@ -575,9 +586,9 @@ EOF
# Kill processes currently accessing the audio devices
kill_audio_apps() {
- local pids0=$(fuser /dev/snd/* 2> /dev/null)
- local pids1=$(fuser /dev/mixer* 2> /dev/null)
- local pids2=$(fuser /dev/sequencer* 2> /dev/null)
+ local pids0=$($fuser_prg /dev/snd/* 2> /dev/null)
+ local pids1=$($fuser_prg /dev/mixer* 2> /dev/null)
+ local pids2=$($fuser_prg /dev/sequencer* 2> /dev/null)
local pids=
for pid in $pids0 $pids1 $pids2; do
local pids="$pids $pid"
@@ -621,10 +632,9 @@ kill_audio_apps() {
fi
}
-# List available modules
-# $CWD(!) (= $tmpdir?) with ./modules/ and caching in ../modules.dep
+# List available modules, cwd==source-tree
parse_modules() {
- if ! test -s ../modules.dep; then
+ if ! test -s "$tmpdir/modules.dep"; then
local rel=$(uname -r)
cd modules
for i in snd-dummy.*; do
@@ -643,7 +653,7 @@ parse_modules() {
exit 1
fi
- if ! cp $pdst/modules.dep ../modules.dep ; then
+ if ! cp $pdst/modules.dep "$tmpdir/modules.dep" ; then
echo >&2 "cp problem."
exit 1
fi
@@ -653,13 +663,13 @@ parse_modules() {
echo "File modules.dep is cached."
fi
- if ! test -s ../modules.top ; then
+ if ! test -s "$tmpdir/modules.top" ; then
for i in modules/*.*o; do
if test -r $i; then
local a=$($modinfobin $i | grep "parm:" | grep "enable:")
if ! test -z "$a"; then
local a=$(basename $i | cut -d . -f 1)
- echo $a >> ../modules.top
+ echo $a >> "$tmpdir/modules.top"
fi
else
echo >&2 "permissions $tmpdir/$i problem."
@@ -674,7 +684,7 @@ parse_modules() {
# Echo the list of loaded sound modules
current_modules() {
- lsmod | cut -d ' ' -f 1 | grep -E "^(snd[_-]|snd$|ac97_bus$)"
+ $lsmod_prg | cut -d ' ' -f 1 | grep -E "^(snd[_-]|snd$|ac97_bus$)"
}
# Remove kernel modules, using two phases
@@ -682,7 +692,7 @@ current_modules() {
my_rmmod() {
local phase2=
while test -n "$1"; do
- if ! rmmod $1 2> /dev/null > /dev/null; then
+ if ! $rmmod_prg $1 2> /dev/null > /dev/null; then
local phase2="$phase2 $1"
else
echo "> rmmod $1"
@@ -691,7 +701,7 @@ my_rmmod() {
done
for mod in $phase2; do
echo "> rmmod $mod"
- if ! rmmod $mod ; then
+ if ! $rmmod_prg $mod ; then
echo >&2 "Unable to remove kernel module $mod."
exit 1
fi
@@ -712,15 +722,21 @@ my_insmod() {
fi
done
if test "$xmod" = "snd-dummy1"; then
- local args="index=999"
- local nofail=true
+ args="index=999"
+ nofail=true
+ fi
+ local xmod1=$(echo $xmod | cut -d ':' -f 1)
+ if test "$xmod1" != "$xmod"; then
+ local args1=$(echo $xmod | cut -d ':' -f 2-)
+ args="$args $args1"
+ xmod="$xmod1"
fi
if test -r modules/$xmod.ko; then
local mod=modules/$xmod.ko
echo "> insmod $mod $args"
if test -n "$nofail"; then
- insmod $mod $args 2> /dev/null
- elif ! insmod $mod $args; then
+ $insmod_prg $mod $args 2> /dev/null
+ elif ! $insmod_prg $mod $args; then
echo >&2 "Unable to insert kernel module $xmod.ko."
exit 1
fi
@@ -729,8 +745,8 @@ my_insmod() {
local mod=modules/$xmod.o
echo "> insmod $mod $args"
if test -n "$nofail"; then
- insmod $mod.o $args
- elif ! insmod $mod.o $args; then
+ $insmod_prg $mod.o $args
+ elif ! $insmod_prg $mod.o $args; then
echo >&2 "Unable to insert kernel module $xmod.o."
exit 1
fi
@@ -750,7 +766,7 @@ show_kernel_messages() {
/Dummy soundcard not found or device busy/ { delete lines }
{ lines[length(lines)+1] = \$0 }
END {
- for (x = 3; x <= length(lines); x++)
+ for (x = 2; x <= length(lines); x++)
print prefix lines[x]
}
EOF
@@ -763,38 +779,44 @@ EOF
do_kernel_modules() {
local usermods="$@"
local curmods=$(current_modules)
+ local dst=
if test -z "$curmods" -a -z "$usermods"; then
echo >&2 "Unable to determine current ALSA kernel modules."
exit 1
fi
if test -n "$usermods"; then
- local loadmods="$usermods"
- local dst="../modules.user"
+ dst="$tmpdir/modules.user"
rm -f $dst || exit 1
else
- local loadmods="$curmods"
- local dst="../modules.insmod"
+ dst="$tmpdir/modules.insmod"
fi
parse_modules
if ! test -s $dst; then
- local topmods=$(cat ../modules.top)
- cat > run.awk <<EOF
+ local topmods=$(cat "$tmpdir/modules.top")
+ cat > "$tmpdir/run.awk" <<EOF
function basename(name) {
split(name, y, "[/.]")
return y[length(y)-1]
}
-function skipempty(dst, src, delim, x) {
+function skipempty(dst, src, delim, x, y) {
split(src, y, delim)
for (x in y) {
- if (length(y[x]) > 0)
+ if (length(y[x]) > 0) {
dst[x] = y[x]
+ }
}
}
-function skipemptyuser(dst, src, delim, x, m) {
+function skipemptyuser(dst, src, delim, x, y, z, m) {
split(src, y, delim)
for (x in y) {
if (length(y[x]) > 0) {
- m = y[x]
+ z = index(y[x], ":")
+ if (z > 1) {
+ m = substr(y[x], 0, z - 1)
+ modargs[m] = substr(y[x], z)
+ } else {
+ m = y[x]
+ }
if (substr(m, 0, 4) != "snd-")
m = "snd-" m
dst[x] = m
@@ -840,7 +862,6 @@ function addtopmodule(mod, v, j, k, z)
addslavemodules(mod)
}
BEGIN {
- skipempty(akmods, kmods, ",")
if (length(usermods) > 0)
skipemptyuser(acurmods, usermods, " ")
else
@@ -902,17 +923,23 @@ END {
for (b = 1; b <= length(modules); b++) {
mod = modules[b]
- if (length(mod) > 0)
- print mod
+ if (length(mod) > 0) {
+ arg = ""
+ for (d in modargs) {
+ if (d == mod)
+ arg = modargs[d]
+ }
+ print mod arg
+ }
}
}
EOF
- awk -f run.awk -v kmods="$kernelmodules" \
+ awk -f "$tmpdir/run.awk" \
-v curmods="$curmods" \
-v usermods="$usermods" \
-v topmods="$topmods" \
- ../modules.dep > $dst || exit 1
- rm run.awk || exit 1
+ "$tmpdir/modules.dep" > $dst || exit 1
+ rm "$tmpdir/run.awk" || exit 1
if ! test -s $dst; then
if test -n "$usermods"; then
echo >&2 "Unable to determine specified ALSA kernel modules."
@@ -965,7 +992,7 @@ kernel_modules_list() {
exit 1
fi
parse_modules
- local topmods=$(cat ../modules.top)
+ local topmods=$(cat "$tmpdir/modules.top")
for mod in $topmods; do
local desc=$($modinfobin -F description modules/$mod.*o)
echo "$mod: $desc"
@@ -1010,16 +1037,11 @@ if test "$kmodmesg" = "true"; then
exit 0
fi
-protocol=$(echo $url | cut -d ':' -f 1)
-check_environment
-do_cmd cd $tmpdir
-package_switch $package
-
if test -n "$clean"; then
- if test -z $clean; then
+ if test "$clean" = "full"; then
echo -n "Removing tree $tmpdir:"
- if test -d $tmpdir; then
- if ! rm -rf $tmpdir; then
+ if test -d "$tmpdir"; then
+ if ! rm -rf "$tmpdir"; then
echo " failed"
exit 1
fi
@@ -1028,19 +1050,19 @@ if test -n "$clean"; then
else
package_switch $clean
echo -n "Removing package $package:"
- rm $tmpdir/environment.* 2> /dev/null
+ rm "$tmpdir/environment.*" 2> /dev/null
if test "$package" = "alsa-driver"; then
- rm -rf $tmpdir/modules.*
- rm -rf $tmpdir/run.awk
+ rm -rf "$tmpdir/modules.*"
+ rm -rf "$tmpdir/run.awk"
fi
if test -n "$tree"; then
- if test -d $tmpdir/$tree; then
- if ! rm -rf $tmpdir/$tree; then
+ if test -d "$tmpdir/$tree"; then
+ if ! rm -rf "$tmpdir/$tree"; then
echo " failed"
exit 1
fi
fi
- rm -f $packagedir
+ rm -f "$packagedir"
echo " success"
elif test -d $package; then
rm -rf $package
@@ -1055,6 +1077,11 @@ if test -n "$clean"; then
exit 0
fi
+protocol=$(echo $url | cut -d ':' -f 1)
+check_environment
+do_cmd cd $tmpdir
+package_switch $package
+
if test "$kmodremove" = "true"; then
kernel_modules_remove
exit 0