From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-embedded+bounces-4007-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QkfjA-0001SQ-BO
	for garchives@archives.gentoo.org; Sat, 23 Jul 2011 17:11:00 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 33CB321C140;
	Sat, 23 Jul 2011 17:10:47 +0000 (UTC)
Received: from mail-ew0-f53.google.com (mail-ew0-f53.google.com [209.85.215.53])
	by pigeon.gentoo.org (Postfix) with ESMTP id 4752A21C0AE
	for <gentoo-embedded@lists.gentoo.org>; Sat, 23 Jul 2011 17:10:35 +0000 (UTC)
Received: by ewy8 with SMTP id 8so2513364ewy.40
        for <gentoo-embedded@lists.gentoo.org>; Sat, 23 Jul 2011 10:10:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=mime-version:from:date:message-id:subject:to:content-type;
        bh=3hQ+31wGfuRoqhl16S6yfCSxunCTG1+JI69LGTllijk=;
        b=cslrUr/fDLf1r4mmuZtjCccRLx6uS+SdIjrobKskzRGyaB5ONwoR/8uRbyIjSjRjrX
         NZnpmsFPejpKG1OmBXvvaAonCeaFAmLZVqOXVT3Mw++xcrkDjzNc/Oj6d3QyyKf7PQuN
         Y5JJq/57iQZ6dlL5D6PhyCcaMfwmF34gFsB0k=
Received: by 10.213.9.210 with SMTP id m18mr1151767ebm.73.1311441033243; Sat,
 23 Jul 2011 10:10:33 -0700 (PDT)
Precedence: bulk
List-Post: <mailto:gentoo-embedded@lists.gentoo.org>
List-Help: <mailto:gentoo-embedded+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-embedded+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-embedded+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-embedded.gentoo.org>
X-BeenThere: gentoo-embedded@lists.gentoo.org
Reply-to: gentoo-embedded@lists.gentoo.org
MIME-Version: 1.0
Received: by 10.213.14.1 with HTTP; Sat, 23 Jul 2011 10:10:13 -0700 (PDT)
From: Christopher Friedt <chrisfriedt@gmail.com>
Date: Sat, 23 Jul 2011 13:10:13 -0400
Message-ID: <CAF4BF-S452UcQNbJZ2ZZ=0mwvG+8BmauN1xhrVhaaJcDXNqJCw@mail.gmail.com>
Subject: [gentoo-embedded] sysvinit: sanetime for boards without an rtc?
To: gentoo-embedded@lists.gentoo.org
Content-Type: multipart/mixed; boundary=0015174c1abeee2b3b04a8bfa8a8
X-Archives-Salt: 
X-Archives-Hash: d0641c1eedcd7acb095f50c978815027

--0015174c1abeee2b3b04a8bfa8a8
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

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.

...
=A0* One of the files in /etc/{conf.d,init.d} or /etc/rc.conf
=A0* has a modification time in the future!
=A0* One of the files in /etc/{conf.d,init.d} or /etc/rc.conf
=A0* 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.

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

 =A0 [ !! ]
...

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.

--0015174c1abeee2b3b04a8bfa8a8
Content-Type: application/octet-stream; name="add-sanetime-to-sbin-rc.patch"
Content-Disposition: attachment; filename="add-sanetime-to-sbin-rc.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gqgtwtcv0

LS0tIC9zYmluL3JjX29yaWcJMjAxMS0wNy0yMyAxMjo1Mjo0MC45MDg4ODUyNzcgLTA0MDAKKysr
IC9zYmluL3JjCTIwMTEtMDctMjMgMTI6NTI6NTEuMjc2MDcwMzY4IC0wNDAwCkBAIC0xNjYsNyAr
MTY2LDcgQEAKIAkJCUNSSVRJQ0FMX1NFUlZJQ0VTPSIke0NSSVRJQ0FMX1NFUlZJQ0VTfSAke3gj
IyovfSIKIAkJZG9uZQogCWVsc2UKLQkJQ1JJVElDQUxfU0VSVklDRVM9ImNoZWNrcm9vdCBtb2R1
bGVzIGNoZWNrZnMgbG9jYWxtb3VudCBjbG9jayBib290bWlzYyIKKwkJQ1JJVElDQUxfU0VSVklD
RVM9ImNoZWNrcm9vdCBtb2R1bGVzIGNoZWNrZnMgbG9jYWxtb3VudCBzYW5ldGltZSBjbG9jayBi
b290bWlzYyIKIAlmaQogCiAJZXhwb3J0IENSSVRJQ0FMX1NFUlZJQ0VTCg==
--0015174c1abeee2b3b04a8bfa8a8
Content-Type: application/octet-stream; 
	name="add-sanetime-to-etc-init.d-clock.patch"
Content-Disposition: attachment; 
	filename="add-sanetime-to-etc-init.d-clock.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gqgtx9yc1

LS0tIC9ldGMvaW5pdC5kL2Nsb2NrX29yaWcJMjAxMS0wNy0yMyAxMjo1ODowNy40NDc5NDU5NTIg
LTA0MDAKKysrIC9ldGMvaW5pdC5kL2Nsb2NrCTIwMTEtMDctMjMgMTI6NTk6MjkuMDcyOTQ0NzQ1
IC0wNDAwCkBAIC01LDcgKzUsNyBAQAogb3B0cz0ic2F2ZSIKIAogZGVwZW5kKCkgewotCW5lZWQg
bG9jYWxtb3VudAorCW5lZWQgc2FuZXRpbWUgbG9jYWxtb3VudAogfQogCiBzZXR1cG9wdHMoKSB7
CkBAIC03OSw3ICs3OSw4IEBACiAJc2V0dXBvcHRzCiAKIAlpZiBbWyAke2Zha2VpdH0gLW5lIDEg
JiYgLWUgL3Byb2MvbW9kdWxlcyAmJiAhIC1lIC9kZXYvcnRjIF1dIDsgdGhlbgotCQltb2Rwcm9i
ZSBydGMgJj4gL2Rldi9udWxsIHx8IG1vZHByb2JlIGdlbnJ0YyAmPiAvZGV2L251bGwKKwkJbW9k
cHJvYmUgcnRjICY+IC9kZXYvbnVsbCB8fCBtb2Rwcm9iZSBnZW5ydGMgJj4gL2Rldi9udWxsIFwK
KwkJCXx8IGZha2VpdD0xCiAJZmkKIAogCWViZWdpbiAiU2V0dGluZyBzeXN0ZW0gY2xvY2sgdXNp
bmcgdGhlIGhhcmR3YXJlIGNsb2NrIFske1RCTFVSQn1dIgo=
--0015174c1abeee2b3b04a8bfa8a8
Content-Type: application/octet-stream; name=sanetime
Content-Disposition: attachment; filename=sanetime
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gqgtxhhb2

IyEvc2Jpbi9ydW5zY3JpcHQKIyBDb3B5cmlnaHQgMTk5OS0yMDExIEdlbnRvbyBGb3VuZGF0aW9u
CiMgRGlzdHJpYnV0ZWQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMg
TGljZW5zZSB2MgoKIyBnZXQgdGhpcyBudW1iZXIgd2l0aCAnZGF0ZSArJXMnIC0gaXQncyBqdXN0
IGEgZmFsbGJhY2sgc2FuZXRpbWUKIyBidXQgcmVhbGx5IGFueXRoaW5nIGlzIGJldHRlciB0aGFu
IHRoZSBlcG9jaApTQU5FVElNRT0iMTMxMDQxMDI3OSIKU0FORVRJTUVfRklMRT0vZXRjL3NhbmV0
aW1lCgpkZXBlbmQoKSB7CgluZWVkIGxvY2FsbW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