From 32f08268226f7bdc51da78b6643f8ef8eb69bc44 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 18 Feb 2009 14:41:04 +0000 Subject: [PATCH] hwclock: always pass --rtc to hwclock calls There can always be more than one, and the first is generally /dev/rtc0 not /dev/rtc (unless udev has made a symlink - which it only does for the CMOS driver). Use --rtc=/dev/rtc0 on each call, letting the rtc0 bit be customised at the top of the shell script --- debian/hwclock.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/hwclock.sh b/debian/hwclock.sh index 7c56fc71..4ceb95e8 100644 --- a/debian/hwclock.sh +++ b/debian/hwclock.sh @@ -30,6 +30,10 @@ FIRST=no # debian/rules sets this to 'yes' when creating hwclockfirst.sh # as machine hardware clock type for Alphas. HWCLOCKPARS= +# Set this to the hardware clock device you want to use, it should +# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option. +HCTOSYS_DEVICE=rtc0 + hwclocksh() { [ ! -x /sbin/hwclock ] && return 0 @@ -94,7 +98,7 @@ hwclocksh() # Please read /usr/share/doc/util-linux/README.Debian.hwclock # before enabling hwclock --adjust. - #/sbin/hwclock --adjust $GMT $BADYEAR + #/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR : fi @@ -104,7 +108,7 @@ hwclocksh() # Copies Hardware Clock time to System Clock using the correct # timezone for hardware clocks in local time, and sets kernel # timezone. DO NOT REMOVE. - if /sbin/hwclock --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then + if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then # Announce the local time. verbose_log_action_msg "System Clock set to: `date $UTC`" else @@ -133,7 +137,7 @@ hwclocksh() if [ "$GMT" = "-u" ]; then GMT="--utc" fi - if /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then + if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then verbose_log_action_msg "Hardware Clock updated to `date`" fi else @@ -148,7 +152,7 @@ hwclocksh() fi if [ "$HWCLOCKACCESS" != no ]; then - /sbin/hwclock --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ + /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ fi ;; *) -- 2.39.5