* Busybox hwclock.sh initscript issues
@ 2015-09-18 5:28 Craig McQueen
2015-09-18 11:30 ` Gary Thomas
0 siblings, 1 reply; 3+ messages in thread
From: Craig McQueen @ 2015-09-18 5:28 UTC (permalink / raw)
To: yocto@yoctoproject.org
I'm using Yocto dizzy. I've found a couple of issues with the Busybox hwclock.sh initscript.
1) The script checks that /sbin/hwclock exists at the start. But after that it runs hwclock without an explicit /sbin/hwclock path. So it only works if /sbin/ is in the PATH. Thus it doesn't run properly when called from e.g. cronie which doesn't run with /sbin/ in the PATH.
2) The bootmisc.sh initscript uses the time from /etc/timestamp if the hwclock time is older. That's good. But then by default, hwclock.sh runs after bootmisc.sh, and unconditionally overwrites the system time from the hwclock. So on a system without a functional hwclock, the /etc/timestamp feature basically doesn't work. One solution is modify INITSCRIPT_PARAMS_${PN}-hwclock so it doesn't run at start-up (I am doing that in a busybox bbappend).
--
Craig McQueen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Busybox hwclock.sh initscript issues
2015-09-18 5:28 Busybox hwclock.sh initscript issues Craig McQueen
@ 2015-09-18 11:30 ` Gary Thomas
2015-09-21 0:19 ` Craig McQueen
0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2015-09-18 11:30 UTC (permalink / raw)
To: yocto
On 2015-09-17 23:28, Craig McQueen wrote:
> I'm using Yocto dizzy. I've found a couple of issues with the Busybox hwclock.sh initscript.
>
> 1) The script checks that /sbin/hwclock exists at the start. But after that it runs hwclock without an explicit /sbin/hwclock path. So it only works if /sbin/ is in the PATH. Thus it doesn't run properly when called from e.g. cronie which doesn't run with /sbin/ in the PATH.
>
> 2) The bootmisc.sh initscript uses the time from /etc/timestamp if the hwclock time is older. That's good. But then by default, hwclock.sh runs after bootmisc.sh, and unconditionally overwrites the system time from the hwclock. So on a system without a functional hwclock, the /etc/timestamp feature basically doesn't work. One solution is modify INITSCRIPT_PARAMS_${PN}-hwclock so it doesn't run at start-up (I am doing that in a busybox bbappend).
Why do you think it doesn't work? On a system without a
functioning hardware clock, at least the time stamp moves
forward on every boot/shutdown.
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Busybox hwclock.sh initscript issues
2015-09-18 11:30 ` Gary Thomas
@ 2015-09-21 0:19 ` Craig McQueen
0 siblings, 0 replies; 3+ messages in thread
From: Craig McQueen @ 2015-09-21 0:19 UTC (permalink / raw)
To: Gary Thomas, yocto@yoctoproject.org
On 2015-09-18 21:31, Gary Thomas wrote:
>
> On 2015-09-17 23:28, Craig McQueen wrote:
> > I'm using Yocto dizzy. I've found a couple of issues with the Busybox
> hwclock.sh initscript.
> >
> > 1) The script checks that /sbin/hwclock exists at the start. But after that it
> runs hwclock without an explicit /sbin/hwclock path. So it only works if /sbin/
> is in the PATH. Thus it doesn't run properly when called from e.g. cronie
> which doesn't run with /sbin/ in the PATH.
> >
> > 2) The bootmisc.sh initscript uses the time from /etc/timestamp if the
> hwclock time is older. That's good. But then by default, hwclock.sh runs after
> bootmisc.sh, and unconditionally overwrites the system time from the
> hwclock. So on a system without a functional hwclock, the /etc/timestamp
> feature basically doesn't work. One solution is modify
> INITSCRIPT_PARAMS_${PN}-hwclock so it doesn't run at start-up (I am doing
> that in a busybox bbappend).
>
> Why do you think it doesn't work? On a system without a functioning
> hardware clock, at least the time stamp moves forward on every
> boot/shutdown.
It doesn't work because after the bootmisc.sh runs, which sets the time according to /etc/timestamp, then hwclock.sh runs and sets the time to that of the non-functional hwclock (2000-01-01 00:00 in my case).
To fix it, I've made a busybox bbappend file with the following:
INITSCRIPT_PARAMS_${PN}-hwclock = "stop 20 0 1 6 ."
That means hwclock.sh isn't run at start-up (but actually bootmisc.sh runs it as part of its handling of /etc/timestamp). That makes it work the way I want, and how I suspect the bootmisc.sh author intended it.
--
Craig McQueen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-21 0:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18 5:28 Busybox hwclock.sh initscript issues Craig McQueen
2015-09-18 11:30 ` Gary Thomas
2015-09-21 0:19 ` Craig McQueen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.