[oe-commits] Petr Štetiar : busybox: add posibility to specify correct rtc device for hwclock init script

git version control git at git.openembedded.org
Wed Oct 6 22:35:17 UTC 2010


Module: openembedded.git
Branch: master
Commit: f2e95d221a4b642b67aeca2ecf0a93b6a3271710
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=f2e95d221a4b642b67aeca2ecf0a93b6a3271710

Author: Petr Štetiar <ynezz at true.cz>
Date:   Mon Oct  4 10:35:32 2010 +0000

busybox: add posibility to specify correct rtc device for hwclock init script

With this patch it's now possible to specify rtc device using HWCLOCKDEVICE
variable in /etc/default/hwclock and the system time is then set using correct
device and vice versa. It's wise to have such functionality, beacuse there're
SBCs with more then one rtc device, for example ts72xx.

Signed-off-by: Petr Štetiar <ynezz at true.cz>
Signed-off-by: Khem Raj <raj.khem at gmail.com>

---

 recipes/busybox/busybox.inc      |    2 +-
 recipes/busybox/files/hwclock.sh |   28 ++++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/recipes/busybox/busybox.inc b/recipes/busybox/busybox.inc
index 1046b2f..401f6ad 100644
--- a/recipes/busybox/busybox.inc
+++ b/recipes/busybox/busybox.inc
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r34"
+INC_PR = "r35"
 
 SRC_URI = "\
   file://busybox-cron \
diff --git a/recipes/busybox/files/hwclock.sh b/recipes/busybox/files/hwclock.sh
index 71538fb..1bc9de3 100644
--- a/recipes/busybox/files/hwclock.sh
+++ b/recipes/busybox/files/hwclock.sh
@@ -30,9 +30,19 @@ case "$1" in
 		then
 			if [ -z "$TZ" ]
 			then
-	                   hwclock -s $UTC
+				if [ -z "$HWCLOCKDEVICE" ]
+				then
+					hwclock -s $UTC
+				else
+					hwclock -s $UTC -f $HWCLOCKDEVICE
+				fi
 			else
-			   TZ="$TZ" hwclock -s $UTC
+				if [ -z "$HWCLOCKDEVICE" ]
+				then
+					TZ="$TZ" hwclock -s $UTC
+				else
+					TZ="$TZ" hwclock -s $UTC -f $HWCLOCKDEVICE
+				fi
 			fi
 		fi
 
@@ -55,7 +65,12 @@ case "$1" in
 		fi
 		if [ "$HWCLOCKACCESS" != no ]
 		then
-			hwclock -w $UTC
+			if [ -z "$HWCLOCKDEVICE" ]
+			then
+				hwclock -w $UTC
+			else
+				hwclock -w $UTC -f $HWCLOCKDEVICE
+			fi
 		fi
 		if [ "$VERBOSE" != no ]
 		then
@@ -66,7 +81,12 @@ case "$1" in
 	show)
 		if [ "$HWCLOCKACCESS" != no ]
 		then
-			hwclock -r $UTC
+			if [ -z "$HWCLOCKDEVICE" ]
+			then
+				hwclock -r $UTC
+			else
+				hwclock -r $UTC -f $HWCLOCKDEVICE
+			fi
 		fi
 		;;
         *)





More information about the Openembedded-commits mailing list