Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Makeing /dev/rtc1 accessible as soon as possible - how?
Date: Sun, 25 Aug 2013 04:54:59
Message-Id: 20130825045451.GA25561@solfire
In Reply to: Re: [gentoo-user] Makeing /dev/rtc1 accessible as soon as possible - how? by William Kenworthy
1 William Kenworthy <billk@×××××××××.au> [13-08-25 06:32]:
2 > or if you have an initramfs do it there before control is passed to the
3 > OS. You may also be able to set rtc0 to the current time in the
4 > initramfs as well.
5 >
6 > BillK
7 >
8 >
9 >
10 > On 25/08/13 12:18, Mark David Dumlao wrote:
11 > > Which runlevel did you put your script on?
12 > > You probably want it on sysinit, rather than default.
13 > >
14 > > Also, you can put rc_before= and rc_after= in the corresponding
15 > > /etc/conf.d/ file and make sure it runs before your syslog but after
16 > > your sysfs.
17 > >
18 > > On Sun, Aug 25, 2013 at 12:04 PM, <meino.cramer@×××.de> wrote:
19 > >> Hi,
20 > >>
21 > >> There are two RTCs in my system:
22 > >> /dev/rtc0 and /dev/rtc1
23 > >>
24 > >> rtc0 is not powered by a battery and forgets time/date
25 > >> with system shutdown and rtc1 is a I2C-rtc (DS3231) which
26 > >> is powered by a battery. It is extremly accurate in comparison
27 > >> with rtc0.
28 > >>
29 > >> rtc0 is accessible with system boot - rtc1 is not (current state).
30 > >>
31 > >> To make rtc1 completly know to the system, I have to do a
32 > >> echo ds3231 0x68 >! /sys/bus/i2c/devices/i2c-1/new_device
33 > >> hwclock -f /dev/rtc1 -s
34 > >> in beforehand.
35 > >>
36 > >> I wrote a script for /etc/init.d, which does exactly this, and
37 > >> the system login screen shows the correct tome/date information
38 > >> even without ntp-client (the system should become independantly
39 > >> from lan/internet). The script was added to the boot service
40 > >> and executed after dev and modules.
41 > >>
42 > >> The kernel is configured to use /dev/rtc1 and the driver for the
43 > >> ds1307, which also handles the ds3231, is included into the kernel
44 > >> (no module).
45 > >>
46 > >> But it seems, that setting the system time this way is too late,
47 > >> since there are still (for example) log files under /var/log
48 > >> with a timestamp of the 1.1.1970.
49 > >>
50 > >> Are there any other way to make rtc1 known and accessible earlier
51 > >> to the system as the hack via a script in /etc/init.d ?
52 > >>
53 > >> Thank you very much in advance for any help!
54 > >> Best regards,
55 > >> mcc
56 > >>
57 > >>
58 > >>
59 > >>
60 > >
61 > >
62 > >
63 >
64 >
65
66 Hi Mark, hi William,
67
68 the script ds3231 in /etc/init.d is -- according to rc-update --
69 set as folows:
70
71 ds3231 | boot
72
73 There is no corresponding file in /etc/conf.d since the script
74 onlu consist of two commands (see previous posting). There is no
75 initramfs.
76
77 Since hwclock needs /dev/rtc1 to work, the script cannot be executed
78 before /dev/. is up.
79
80 Is there an text/tutorial/... or such somewhere on the net, which
81 shows the sequence, in which the usual services/scripts in /etc/init.d
82 get started/executed while the system boots?
83
84 Best regads,
85 mcc

Replies

Subject Author
Re: [gentoo-user] Makeing /dev/rtc1 accessible as soon as possible - how? Mark David Dumlao <madumlao@×××××.com>