Skip to contentSkip to conversation

initscripts: added save-rtc to runlevel S

PATCH In review [email protected] 2 participants 6 messages Jan 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initscripts: added save-rtc to runlevel S

From: "Felipe F. Tonello" <[email protected]>

It is necessary to add save-rtc.sh to runlevel S so the system is updated when it boots up.

---
 meta/recipes-core/initscripts/initscripts_1.0.bb |    1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/initscripts/initscripts_1.0.bb +1 -0
index 39be9a8..24fa940 100644
@@ -113,6 +113,7 @@ do_install () {
 	ln -sf		../init.d/umountfs	${D}${sysconfdir}/rc0.d/S40umountfs
 	# udev will run at S55 if installed
 	ln -sf		../init.d/halt		${D}${sysconfdir}/rc0.d/S90halt
+	ln -sf		../init.d/save-rtc.sh	${D}${sysconfdir}/rcS.d/S25save-rtc.sh
 	ln -sf		../init.d/save-rtc.sh	${D}${sysconfdir}/rc0.d/S25save-rtc.sh
 	ln -sf		../init.d/save-rtc.sh	${D}${sysconfdir}/rc6.d/S25save-rtc.sh
 	ln -sf		../init.d/banner.sh	${D}${sysconfdir}/rcS.d/S02banner.sh
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · On 01/09/2013 08:18 AM, [email protected] wrote:

From: "Felipe F. Tonello" <[email protected]>

It is necessary to add save-rtc.sh to runlevel S so the system is updated when it boots up.

Hi ftonello,
What do you mean by "system is updated"?

Besides, this patch should be sent to oe-core.

Cheers,
Chen Qi

Quoted 17 lines
---
  meta/recipes-core/initscripts/initscripts_1.0.bb |    1 +
  1 file changed, 1 insertion(+)
meta/recipes-core/initscripts/initscripts_1.0.bb +1 -0
index 39be9a8..24fa940 100644
@@ -113,6 +113,7 @@ do_install () {
  	ln -sf		../init.d/umountfs	${D}${sysconfdir}/rc0.d/S40umountfs
  	# udev will run at S55 if installed
  	ln -sf		../init.d/halt		${D}${sysconfdir}/rc0.d/S90halt
+	ln -sf		../init.d/save-rtc.sh	${D}${sysconfdir}/rcS.d/S25save-rtc.sh
  	ln -sf		../init.d/save-rtc.sh	${D}${sysconfdir}/rc0.d/S25save-rtc.sh
  	ln -sf		../init.d/save-rtc.sh	${D}${sysconfdir}/rc6.d/S25save-rtc.sh
  	ln -sf		../init.d/banner.sh	${D}${sysconfdir}/rcS.d/S02banner.sh
#2 lore raw

Hi Chen,

Quoted 7 lines · ChenQi
Quoted 4 lines · On 01/09/2013 08:18 AM, [email protected] wrote:

From: "Felipe F. Tonello" <[email protected]>

It is necessary to add save-rtc.sh to runlevel S so the system is updated when it boots up.

Hi ftonello,
What do you mean by "system is updated"?

I meant system clock.

What is happening now is that when you turn off the device, without system halt, the next time the device is booted up the system clock is not in sync with the rtc.

Quoted 2 lines

Besides, this patch should be sent to oe-core.

Ok.

Felipe

#3 lore raw
Quoted 6 lines · Felipe Ferreri Tonello

Hi Chen,

Quoted 3 lines · ChenQi
Quoted 2 lines · On 01/09/2013 08:18 AM, [email protected] wrote:

From: "Felipe F. Tonello" <[email protected]>

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is necessary to add save-rtc.sh to runlevel S so the system is updated when it boots up.

Hi ftonello,
What do you mean by "system is updated"?

I meant system clock.

What is happening now is that when you turn off the device, without system halt, the next time the device is booted up the system clock is not in sync with the rtc.

Hi Felipe,

I'm sorry, but I really don't see why this patch works.
Below is my understanding for the system clock, hardware clock and /etc/timestamp.
(The file name 'save-rtc.sh' is somewhat misleading, 'save-timestamp.sh' would be a more reasonable one.)

/etc/timestamp is used to provide a reasonable reference for system time. The initial contents in this file is the building time of the image.

The system clock should always be in sync with the rtc as long as the /etc/init.d/hwclock.sh is present, whose main purpose is to sync system clock and hardware clock. No matter whether the system is shutdown normally or crashes, the system clock is according to the hardware clock by hwclock.sh.

"
Also, if the value stored in /etc/timestamp is newer [at all] than the current system time, set the system clock from the stored value, down to the minute, not just the day. "

To be clearer, here's a code snippet from bootmisc.sh:
"
# Set the system clock from hardware clock
# If the timestamp is more recent than the current time,

# use the timestamp instead.
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
if test -e /etc/timestamp
then
        SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M`
        read TIMESTAMP < /etc/timestamp
        if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
                date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
                test -x /etc/init.d/hwclock.sh && 
/etc/init.d/hwclock.sh stop
        fi
fi

"

Cheers,
Chen Qi

Quoted 11 lines
Quoted 2 lines

Besides, this patch should be sent to oe-core.

Ok.

Felipe
_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

#4 lore raw

Hi Chen,

Thank you for your answer.

Quoted 25 lines · ChenQi
Quoted 9 lines · Felipe Ferreri Tonello

Hi Chen,

Quoted 6 lines · ChenQi
Quoted 5 lines · On 01/09/2013 08:18 AM, [email protected] wrote:

From: "Felipe F. Tonello" <[email protected]>

It is necessary to add save-rtc.sh to runlevel S so the system is updated when
it boots up.

Quoted 7 lines
Quoted 2 lines

Hi ftonello,
What do you mean by "system is updated"?

I meant system clock.

What is happening now is that when you turn off the device, without system halt, the next time the device is booted up the system clock is not in sync with the rtc.

Hi Felipe,

I'm sorry, but I really don't see why this patch works. Below is my understanding for the system clock, hardware clock and /etc/timestamp.
(The file name 'save-rtc.sh' is somewhat misleading, 'save-timestamp.sh' would be a more reasonable one.)

Quoted 8 lines

/etc/timestamp is used to provide a reasonable reference for system time. The initial contents in this file is the building time of the image.

The system clock should always be in sync with the rtc as long as the /etc/init.d/hwclock.sh is present, whose main purpose is to sync system clock and hardware clock.
No matter whether the system is shutdown normally or crashes, the system clock is according to the hardware clock by hwclock.sh.

Is there anything special to enable hwclock.sh?

I understand what you say, but here that patch was the only way to have system clock (down to minutes, also, or even seconds, don't recall) sync up with the rtc.

Btw, this patch I did few months ago. So I don't remember exactly what was happening.

Do you know by the top of your mind how is this process? Because, as I remember, save-rtc.sh was never been called. I'm not sure.

Felipe

#5 lore raw
In reply to Felipe Ferreri Tonello

"the system clock is according to the hardware clock by hwclock.sh. "

====>

"the system clock is set according to the hardware clock by hwclock.sh at system boot time. "

Quoted 24 lines · Felipe Ferreri Tonello

Hi Chen,

Quoted 7 lines · ChenQi
Quoted 4 lines · On 01/09/2013 08:18 AM, [email protected] wrote:

From: "Felipe F. Tonello" <[email protected]>

It is necessary to add save-rtc.sh to runlevel S so the system is updated when it boots up.

Hi ftonello,
What do you mean by "system is updated"?

I meant system clock.

What is happening now is that when you turn off the device, without system halt, the next time the device is booted up the system clock is not in sync with the rtc.

Quoted 2 lines

Besides, this patch should be sent to oe-core.

Ok.

Felipe
_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky