summaryrefslogtreecommitdiff
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2013-01-17 16:58:43 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-18 13:06:21 +0000
commitf2d6e84cb1694e2365beca331439bb2d23843a5b (patch)
tree4eba73b805f4b875440d7401f1c9d92aec602436 /meta/recipes-kernel
parenta5de76317112fc065a78a745c2f23775dca15d75 (diff)
downloadopenembedded-core-f2d6e84cb1694e2365beca331439bb2d23843a5b.tar.gz
openembedded-core-f2d6e84cb1694e2365beca331439bb2d23843a5b.tar.bz2
openembedded-core-f2d6e84cb1694e2365beca331439bb2d23843a5b.zip
modutils-initscripts: improve modutils.sh
modutils.sh reads /etc/modules to load the listed modules at boot time. /etc/modules is generated by update-modules which scans /etc/modules-load.d directory. However, update-modules became obsolete because the files it generates are not used by modprobe anymore. Hence, change modutils.sh to scan also /etc/modules-load.d/*.conf and load the modules listed there. Basically, the behavior is this: * if /etc/modules exists, load those modules; * if the directory /etc/modules-load.d exists, load the modules listed in the .conf files but ignore those already loaded (from /etc/modules); [YOCTO #3598] Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rwxr-xr-xmeta/recipes-kernel/modutils-initscripts/files/modutils.sh34
1 files changed, 25 insertions, 9 deletions
diff --git a/meta/recipes-kernel/modutils-initscripts/files/modutils.sh b/meta/recipes-kernel/modutils-initscripts/files/modutils.sh
index 9049bbb8aa..a78adf5729 100755
--- a/meta/recipes-kernel/modutils-initscripts/files/modutils.sh
+++ b/meta/recipes-kernel/modutils-initscripts/files/modutils.sh
@@ -13,7 +13,7 @@
LOAD_MODULE=modprobe
[ -f /proc/modules ] || exit 0
-[ -f /etc/modules ] || exit 0
+[ -f /etc/modules ] || [ -d /etc/modules-load.d ] || exit 0
[ -e /sbin/modprobe ] || LOAD_MODULE=insmod
if [ ! -f /lib/modules/`uname -r`/modules.dep ]; then
@@ -21,15 +21,31 @@ if [ ! -f /lib/modules/`uname -r`/modules.dep ]; then
depmod -Ae
fi
+loaded_modules=" "
+
+process_file() {
+ file=$1
+
+ (cat $file; echo; ) |
+ while read module args
+ do
+ case "$module" in
+ \#*|"") continue ;;
+ esac
+ [ -n "$(echo $loaded_modules | grep " $module ")" ] && continue
+ [ "$VERBOSE" != no ] && echo -n "$module "
+ eval "$LOAD_MODULE $module $args >/dev/null 2>&1"
+ loaded_modules="${loaded_modules}${module} "
+ done
+}
+
[ "$VERBOSE" != no ] && echo -n "Loading modules: "
-(cat /etc/modules; echo; ) |
-while read module args
-do
- case "$module" in
- \#*|"") continue ;;
- esac
- [ "$VERBOSE" != no ] && echo -n "$module "
- eval "$LOAD_MODULE $module $args >/dev/null 2>&1"
+[ -f /etc/modules ] && process_file /etc/modules
+
+[ -d /etc/modules-load.d ] || exit 0
+
+for f in /etc/modules-load.d/*.conf; do
+ process_file $f
done
[ "$VERBOSE" != no ] && echo