* [gentoo-embedded] Getting network time early in boot
@ 2011-03-30 2:06 Joe Sapp
2011-03-30 4:47 ` Mike Frysinger
2011-03-30 8:59 ` Wolfgang Denk
0 siblings, 2 replies; 6+ messages in thread
From: Joe Sapp @ 2011-03-30 2:06 UTC (permalink / raw
To: gentoo-embedded
Hi all,
I've got a board with no RTC so there are some problems during boot.
Currently there's a hack in the udev init script to get the time from the
network (via ntp or rdate), but I'm wondering if somebody else has solved
this in a better way. Any ideas?
Thanks,
Joe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-embedded] Getting network time early in boot
2011-03-30 2:06 [gentoo-embedded] Getting network time early in boot Joe Sapp
@ 2011-03-30 4:47 ` Mike Frysinger
2011-03-30 13:59 ` Ed W
2011-03-30 8:59 ` Wolfgang Denk
1 sibling, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2011-03-30 4:47 UTC (permalink / raw
To: gentoo-embedded
On Tue, Mar 29, 2011 at 10:06 PM, Joe Sapp wrote:
> I've got a board with no RTC so there are some problems during boot.
> Currently there's a hack in the udev init script to get the time from the
> network (via ntp or rdate), but I'm wondering if somebody else has solved
> this in a better way. Any ideas?
add your own init.d script, mark it "before udev', and add it to boot runlevel ?
-mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-embedded] Getting network time early in boot
2011-03-30 4:47 ` Mike Frysinger
@ 2011-03-30 13:59 ` Ed W
2011-03-30 14:21 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Ed W @ 2011-03-30 13:59 UTC (permalink / raw
To: gentoo-embedded
On 30/03/2011 05:47, Mike Frysinger wrote:
> On Tue, Mar 29, 2011 at 10:06 PM, Joe Sapp wrote:
>> I've got a board with no RTC so there are some problems during boot.
>> Currently there's a hack in the udev init script to get the time from the
>> network (via ntp or rdate), but I'm wondering if somebody else has solved
>> this in a better way. Any ideas?
>
> add your own init.d script, mark it "before udev', and add it to boot runlevel ?
You would still have the problem that you can't run it until at least
after you start network of course?
Some people might not know of /etc/init.d/swclock. It writes the time
at shutdown and restores *that* old time on bootup. For some scenarios
that might get you a time close to reality... (eg if you just want to
check stuff like "has this file changed" and avoid "clock moved
backwards" kind of issues)
Good luck
Ed W
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-embedded] Getting network time early in boot
2011-03-30 13:59 ` Ed W
@ 2011-03-30 14:21 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-03-30 14:21 UTC (permalink / raw
To: gentoo-embedded
On Wed, Mar 30, 2011 at 9:59 AM, Ed W wrote:
> On 30/03/2011 05:47, Mike Frysinger wrote:
>> On Tue, Mar 29, 2011 at 10:06 PM, Joe Sapp wrote:
>>> I've got a board with no RTC so there are some problems during boot.
>>> Currently there's a hack in the udev init script to get the time from the
>>> network (via ntp or rdate), but I'm wondering if somebody else has solved
>>> this in a better way. Any ideas?
>>
>> add your own init.d script, mark it "before udev', and add it to boot runlevel ?
>
> You would still have the problem that you can't run it until at least
> after you start network of course?
that depends on how the board comes up. if the boot loader provides
network settings to the kernel (autoconfig), it might be up. or if
people have an initramfs that brings things up.
> Some people might not know of /etc/init.d/swclock. It writes the time
> at shutdown and restores *that* old time on bootup. For some scenarios
> that might get you a time close to reality... (eg if you just want to
> check stuff like "has this file changed" and avoid "clock moved
> backwards" kind of issues)
that can be useful depending on the system needs. i tend to forget about it ;).
-mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-embedded] Getting network time early in boot
2011-03-30 2:06 [gentoo-embedded] Getting network time early in boot Joe Sapp
2011-03-30 4:47 ` Mike Frysinger
@ 2011-03-30 8:59 ` Wolfgang Denk
2011-03-31 11:55 ` Joe Sapp
1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2011-03-30 8:59 UTC (permalink / raw
To: gentoo-embedded, Joe Sapp
Dear Joe Sapp,
In message <4D92902B.5000300@gentoo.org> you wrote:
>
> I've got a board with no RTC so there are some problems during boot.
> Currently there's a hack in the udev init script to get the time from the
> network (via ntp or rdate), but I'm wondering if somebody else has solved
> this in a better way. Any ideas?
If your board uses U-Boot as boot loader, you can enable SNTP support
in U-Boot and get and set the time already there, before you even boot
into Linux.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"Faith: not *wanting* to know what is true." - Friedrich Nietzsche
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-embedded] Getting network time early in boot
2011-03-30 8:59 ` Wolfgang Denk
@ 2011-03-31 11:55 ` Joe Sapp
0 siblings, 0 replies; 6+ messages in thread
From: Joe Sapp @ 2011-03-31 11:55 UTC (permalink / raw
To: gentoo-embedded
On 03/30/2011 04:59 AM, Wolfgang Denk wrote:
> Dear Joe Sapp,
>
> In message <4D92902B.5000300@gentoo.org> you wrote:
>>
>> I've got a board with no RTC so there are some problems during boot.
>> Currently there's a hack in the udev init script to get the time from the
>> network (via ntp or rdate), but I'm wondering if somebody else has solved
>> this in a better way. Any ideas?
>
> If your board uses U-Boot as boot loader, you can enable SNTP support
> in U-Boot and get and set the time already there, before you even boot
> into Linux.
It does use U-Boot, so maybe a combination of this and swclock (from
sys-apps/openrc) is the most reliable way to set the time for my application.
Thanks all for the ideas.
Joe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-31 12:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 2:06 [gentoo-embedded] Getting network time early in boot Joe Sapp
2011-03-30 4:47 ` Mike Frysinger
2011-03-30 13:59 ` Ed W
2011-03-30 14:21 ` Mike Frysinger
2011-03-30 8:59 ` Wolfgang Denk
2011-03-31 11:55 ` Joe Sapp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox