Gentoo Archives: gentoo-embedded

From: Christopher Friedt <chrisfriedt@×××××.com>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] sysvinit: sanetime for boards without an rtc?
Date: Sat, 23 Jul 2011 17:11:00
Message-Id: CAF4BF-S452UcQNbJZ2ZZ=0mwvG+8BmauN1xhrVhaaJcDXNqJCw@mail.gmail.com
Hi folks,

I have a couple of boards that ship by default without RTC devices and
boot time always incurs the following nasty messages in multiplicity.

...
 * One of the files in /etc/{conf.d,init.d} or /etc/rc.conf
 * has a modification time in the future!
 * One of the files in /etc/{conf.d,init.d} or /etc/rc.conf
 * has a modification time in the future!
...

A very simple solution was be to maintain an /etc/sanetime file that
would set a time other than the epoch at boot. Something within the
last day, month, year, or decade even ;-)

There's a fallback sanetime in /etc/init.d/sanetime just in case
/etc/sanetime doesn't exist, and it works naturally because time is
monotonically increasing (last I checked).

Also, it would seem that /etc/clock doesn't fail gracefully when there
is no rtc, even when there are provisions to 'fakeit' for other
reasons.

...
 * Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.Can
not access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
 * Failed to set clock You will need to set the clock yourself

   [ !! ]
...

It was just a matter of adding an /etc/init.d/sanetime script,
slightly patching /etc/init.d/clock & /sbin/rc (AFAIK this only works
for sysvinit, not openrc).

See the attached files.

Cheers,

C

PS: I was going to file a bug report, but it seems that the
certificate for bugs.gentoo.org has become invalid ATM.

Attachments

File name MIME type
add-sanetime-to-sbin-rc.patch application/octet-stream
add-sanetime-to-etc-init.d-clock.patch application/octet-stream
sanetime application/octet-stream

Replies