http://bugzilla.novell.com/show_bug.cgi?id=595573
http://bugzilla.novell.com/show_bug.cgi?id=595573#c6
--- Comment #6 from Geoff Farrell 2010-06-26 00:22:52 UTC ---
Werner, thank you for the detailed explanation of the problems associated with
Daylight Saving Time (DST) and Hardware Clocks. I appreciate that that would
have taken a good deal of your time.
I have examined this problem and think I have a solution. It is based on asking
the user what s/he wants to do about it - whether to automatically change the
Hardware Clock at DST transition or not. The user could based their decision on
whether another OS occupies the hard disk in a dual-boot situation. In my case,
without another OS, I would answer 'yes'; someone with another OS which might
change the time at DST transition would be best advised to answer 'no'.
To achieve this, I suggest putting an option 'AUTODST' into
/etc/sysconfig/clock, which would have a yes/no setting. Then it would need
code in initrd to examine whether a DST transition has occurred, and to change
the System Clock when it happens, then write the time back to the Hardware
Clock before proceeding with mounting the real '/' filesystem. This 'AUTODST'
setting would also need to be in initrd, along with the current 'HWCLOCK='
setting.
The major difficulty with this method - as you have pointed out - is that the
hardware does not support the setting of such a flag, and neither is the
filesystem available at that point in the bootup sequence to retrieve it.
However, I was able to institute a system where the status of Daylight Saving
(DSTstatus) - whether active or not - is saved on an unused sector of the boot
disk (I used sector 62 because it was far away from the preceding mbr boot
code), and 'dd' is used to read from or write to that sector to extract the
DSTstatus information. The code (checkDSTstatus) then examines the
/etc/localtime file (already in initrd), calculates the DST transition points,
then determines whether the current time at bootup has passed a DST transition
point. If so, then action can be taken there and then (by a modified
05-clock.sh) before the bootup sequence moves on to mount the real '/'
filesystem. This code needs a few more commands in initrd to run the
calculations.
My method would require the installer (and YaST-> System-> Bootloader after the
system has been installed) to provide an option in the Timezone setting screen
called 'Automatically change the Hardware Clock at Daylight Saving Time
transition'. This option would only be enabled when a user disables the
'Hardware Clock Set To UTC' option. Enabling this option would set the
'AUTODST' flag in /etc/sysconfig/clock to 'yes'. The help information for this
option would caution enabling this option in a dual-boot situation. The
Bootloader would also need to save the DSTstatus to Sector 62 of the boot
device, and record the device name (eg, /dev/sda) in another file
/etc/sysconfig/bootdevice (also required in initrd) Another file would be
required in initrd (/etc/sysconfig/DSTchange) to record the result of
checkDSTstatus.
I will attach the files required to achieve all of this. They are:
To be contained within initrd:
/etc/sysconfig/DSTstatus
/etc/sysconfig/DSTchange
/etc/sysconfig/bootdevice
/etc/sysconfig/clock
/bin/checkDSTstatus
/boot/05-clock.sh (modified version - same as /etc/init.d/boot.dstclock)
These are not attached (as they are normal system files) but are required to be
in initrd:
/bin/dd
/bin/head
/bin/tail
To be contained in the normal filesystem:
/bin/checkDSTstatus (same as in initrd)
/etc/init.d/boot.dstclock (same as 05-clock.sh in initrd)
To test the functioning of the two scripts above, I unpacked initrd, added the
files listed above to be contained within initrd, then re-packed it. I have not
looked at the task of modifying mkinitrd to achieve those changes.
More detailed explanation of the methodology is contained in the scripts'
comments. I will also attach a 'Test' version of checkDSTstatus that was used
to check out various timezones, locales and dates, to see that the code
operated correctly. This version contains many more 'echo' statements that lets
you see what is going on at various stages.
The method of storing the DSTstatus flag to a hard-coded boot device sector is
crude, but is meant as a demonstrator of the overall method. Maybe a more
sophisticated method would be required for production. Since the Bootloader
would be the best tool to save the information at installation, perhaps it
could add it to the end of the MBR code, from where it could be retrieved by a
suitably modified checkDSTstatus script.
Thanks for taking the time to consider this.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.