On Friday 29 April 2011 12:42:47 Andrew Benton wrote:
> On Fri, 29 Apr 2011 08:57:54 -0700
>
> bsquared <[email protected]> wrote:
> > > Yes, I rebooted and checked /dev/rtc is a link to /dev/rtc0 which
> > > matches kernel config.
> > > --
> > > Thank you,
> > > -Brian
> >
> > On re-reading my last message wasn't very clear. Yes I have the rtc
> >
> > file, but the time is incorrrect. It appears that udev is not running
> > setclock.
> >
> > What could be causing this? I looked in the logs and there is no
> > reference to udev,setclock.
>
> It seems that /dev/rtc0 is matching this rule in 50-udev-default.rules
> which is why it's making the symlink:
>
> SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc"
>
> The question is, why doesn't it match the 55-lfs.rules:
>
> SUBSYSTEM=="rtc", ACTION=="add", MODE="0644",
> RUN+="/etc/rc.d/init.d/setclock start" KERNEL=="rtc", ACTION=="add",
> MODE="0644", RUN+="/etc/rc.d/init.d/setclock start"
This rule looks rather misshapen. Translated to more traditional C-ish logic:
if ((SUBSYSTEM == "rtc") && (ACTION == "add") &&
(KERNEL == "rtc") && (ACTION == "add")) {
MODE = "0644";
RUN += "/etc/rc.d/init.d/setclock start";
MODE = "0644";
RUN += "/etc/rc.d/init.d/setclock start";
}
I don't know if udev can handle a rule when conditions and actions are
intermixed and repeated. But if it didn't barf, it must've been OK.
Ordered more traditionally and removing the redundant parts, the rule would
be:
KERNEL=="rtc",SUBSYSTEM=="rtc",ACTION=="add",RUN+="/etc/rc.d/init.d/setclock
start",MODE="0644"
which would translate to C-ish:
if ((KERNEL == "rtc") && (SUBSYSTEM == "rtc") && (ACTION == "add")) {
MODE = "0644";
RUN += "/etc/rc.d/init.d/setclock start";
}
ACTION=="add" says to match the rule iff the device is being added for the
first time.
KERNEL=="rtc" says to match if the kernel name of the device is 'rtc'. I'll
bet this should be KERNEL=="rtc0".
Debian has a nice rule in 85-hwclock.rules:
KERNEL=="rtc0", RUN+="/lib/udev/hwclock-set $root/$name"
Clearly they've added functionality to udev. But it provided the clue.
The other way to find information about a device:
udevadm info --query=all --name=/dev/rtc
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page