#2266: Set system time before bootscripts run
-------------------------------------+--------------------------------------
Reporter: d...@… | Owner: lfs-b...@…
Type: task | Status: new
Priority: normal | Milestone: 7.0
Component: Book | Version: SVN
Severity: normal | Keywords:
-------------------------------------+--------------------------------------
Comment(by bdu...@…):
I propose to solve this ticket in the way that ubuntu does:
1. Remove the start function from the /etc/rc.d/init.d/setclock
bootscript
2. Add /etc/udev/rules.d/85-hwclock.rules:
{{{
# This file causes the hardware clock to be set when /dev/rtc
# is available.
KERNEL=="rtc", ACTION=="add", RUN+="set_hwclock"
}}}
3. Add set_hwclock. ubuntu has it in /lib/udev/, but perhaps we should
put it in /sbin. udev has some code that allows running a program/script
from /lib/udev/ without a path.
ubuntu's set_hwclock looks like:
{{{
#!/bin/sh
# udev helper for hwclock
#
# This is based on the hwclock.sh init script,
# but somewhat simplified.
[ ! -x /sbin/hwclock ] && exit 0
. /etc/default/rcS
[ "$GMT" = "-u" ] && UTC="yes"
case "$UTC" in
no|"") GMT="--localtime"
UTC=""
;;
yes) GMT="--utc"
UTC="--utc"
;;
*) exit 1 ;;
esac
case "$BADYEAR" in
no|"") BADYEAR="" ;;
yes) BADYEAR="--badyear" ;;
*) exit 1 ;;
esac
# Copies Hardware Clock time to System Clock using the correct
# timezone for hardware clocks in local time, and sets kernel
# timezone. DO NOT REMOVE.
/sbin/hwclock --hctosys $GMT $HWCLOCKPARS $BADYEAR
}}}
We probably want to just ignore badyear (man hwclock) as we do now. I
wouldn't think too many users have hw with a bios from 95 or 96.
Note: The hwclock.sh init script has:
{{{
# Set this to any options you might need to give to hwclock,
# such as machine hardware clock type for Alphas.
HWCLOCKPARS=
}}}
--
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2266#comment:5>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page