rev 2

On Fri, Aug 19, 2011 at 11:47 AM, Jim Cromie <[email protected]> wrote:
> patch changes installer so it writes /etc/modprobe.d/$profile.conf
> instead of just /etc/modules.
>

1st rev wrote all module names to  /etc/modprobe.d/$profile.conf
even those which had no options, which caused modprobe warnings
on modules which didnt have any options passed in.
Rev2 fixes this.


> putting options in former means that modprobe will find them automatically,
> simplifying rmmod, modprobe cycles..
>
> patch removes options from /etc/modules: theyre allowed, but having them
> in 2 places may confuse someone.
>
> BTW, scx200_acb doesnt probe ports 0x810,0x820 properly on this board,
> I dont know what works, so I left it alone.
>
From 0b89e25ffe54edfb951463b39d9f396c93b9e6ec Mon Sep 17 00:00:00 2001
From: root <[email protected]>
Date: Tue, 16 Aug 2011 03:27:52 -0600
Subject: [PATCH 01/11] teach installer to write /etc/modprobe.d/profile.conf

rework update_modules() to write etc/modprobe.d/$profile.conf
along with etc/modules, drop module options from latter, and
put them in former, where theyre used by modprobe.

Tested on soekris net4801, with updated modules list:
dropped lm77, not present on the net4801
added scx200_hrt, scx200_gpio, pc8736x_gpio, pc87360

The last is an lm-sensor, which needs user-space config tool to use.
---
 etc/voyage-profiles/4801.pro    |    2 +-
 usr/local/sbin/update-config.sh |   30 +++++++++++++++++++++++-------
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/etc/voyage-profiles/4801.pro b/etc/voyage-profiles/4801.pro
index eba8019..1606ee2 100755
--- a/etc/voyage-profiles/4801.pro
+++ b/etc/voyage-profiles/4801.pro
@@ -2,4 +2,4 @@ VOYAGE_PROFILE=4801
 VOYAGE_SYSTEM_CONSOLE=serial
 VOYAGE_SYSTEM_SERIAL=19200
 VOYAGE_SYSTEM_PCMCIA=no
-VOYAGE_SYSTEM_MODULES="wd1100 sysctl_wd_graceful=0 sysctl_wd_timeout=30; lm77; scx200_acb base=0x810,0x820"
+VOYAGE_SYSTEM_MODULES="wd1100 sysctl_wd_graceful=0 sysctl_wd_timeout=30; scx200_acb base=0x810,0x820; pc87360 init=2; pc8736x_gpio; scx200_hrt; scx200_gpio"
diff --git a/usr/local/sbin/update-config.sh b/usr/local/sbin/update-config.sh
index d3a4cbc..992030a 100755
--- a/usr/local/sbin/update-config.sh
+++ b/usr/local/sbin/update-config.sh
@@ -15,21 +15,37 @@
 #	Params:	$1 - root directory of target
 #
 update_modules() {
-	local saveifs modname buildlist
+	local saveifs modline moduleslist nameonly modopts modoptslist
 	saveifs=$IFS
 	IFS=";"
-	buildlist="
+	moduleslist="
 #
-# These lines generated automatically by `basename $0`
+# These lines generated automatically by `basename $0`,
+# parsing VOYAGE_SYSTEM_MODULES from Profile: $VOYAGE_PROFILE
 # on `date`
 #
 "
-	for modname in $VOYAGE_SYSTEM_MODULES; do
-		rmspace=`echo $modname | sed -e "s/^ *//"`
-		buildlist="$buildlist\n$rmspace"
+	modoptslist=$moduleslist	# copy header
+
+	# echo "Profile: $VOYAGE_PROFILE"
+	# echo "system-modules: $VOYAGE_SYSTEM_MODULES; "
+	for modline in $VOYAGE_SYSTEM_MODULES; do
+		rmspace=`echo $modline | sed -e "s/^ *//"`
+		nameonly=`echo $rmspace | cut -d' ' -f1`
+		modopts=`echo $rmspace | sed -e "s/$nameonly//" \
+		    | sed -e "s/^ *//"`
+		# echo "modline: $modline"
+		# echo "rmspace: $rmspace"
+		# echo "nameonly: $nameonly"
+		moduleslist="$moduleslist\n$nameonly"
+		# modprobe doesnt like empty options
+		[ -n "$modopts" ] && \
+		    modoptslist="$modoptslist\noptions $modopts"
 	done
 	IFS=$saveifs
-	echo -e "$buildlist" >> $1/etc/modules
+
+	echo -e "$moduleslist" >> $1/etc/modules
+	echo -e "$modoptslist" >> $1/etc/modprobe.d/$VOYAGE_PROFILE.conf
 }
 
 #
-- 
1.7.4.4

_______________________________________________
Voyage-linux mailing list
[email protected]
http://list.voyage.hk/mailman/listinfo/voyage-linux

Reply via email to