[oe] [PATCH] init-scripts: introduce DONTUSETIMESTAMP variable in bootmisc.sh
Koen Kooi
k.kooi at student.utwente.nl
Wed Oct 6 17:30:55 UTC 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06-10-10 20:14, Petr Štetiar wrote:
> This variable is useful on systems with battery backed RTC. Imagine, that the
> board is shut down and then switched on after, for example three days.
> Althought the value in RTC is correct, this scripts sets system time with the
> wrong values.
So you shut it down at 20101003 and boot it at 20101006, that should
give you roughly:
SYSTEMDATE=`date "+%Y%m%d"` -> 20101006
TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4)
substr($0,1,4);}'` -> 20101003
NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)` -> 0
So why is your rtc having a date older than the shutdown date?
regards,
Koen
>
> Signed-off-by: Petr Štetiar <ynezz at true.cz>
> ---
> recipes/initscripts/initscripts-1.0/bootmisc.sh | 15 +++++++++------
> recipes/initscripts/initscripts_1.0.bb | 2 +-
> 2 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/recipes/initscripts/initscripts-1.0/bootmisc.sh b/recipes/initscripts/initscripts-1.0/bootmisc.sh
> index d19477b..6abefcd 100755
> --- a/recipes/initscripts/initscripts-1.0/bootmisc.sh
> +++ b/recipes/initscripts/initscripts-1.0/bootmisc.sh
> @@ -69,12 +69,15 @@ fi
> test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
> if test -e /etc/timestamp
> then
> - SYSTEMDATE=`date "+%Y%m%d"`
> - TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4) substr($0,1,4);}'`
> - NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)`
> - if [ $NEEDUPDATE -eq 1 ]; then
> - date `cat /etc/timestamp`
> - /etc/init.d/hwclock.sh stop
> + if test "$DONTUSETIMESTAMP" != no
> + then
> + SYSTEMDATE=`date "+%Y%m%d"`
> + TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4) substr($0,1,4);}'`
> + NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)`
> + if [ $NEEDUPDATE -eq 1 ]; then
> + date `cat /etc/timestamp`
> + /etc/init.d/hwclock.sh stop
> + fi
> fi
> fi
> : exit 0
> diff --git a/recipes/initscripts/initscripts_1.0.bb b/recipes/initscripts/initscripts_1.0.bb
> index cc60624..3987c60 100644
> --- a/recipes/initscripts/initscripts_1.0.bb
> +++ b/recipes/initscripts/initscripts_1.0.bb
> @@ -4,7 +4,7 @@ PRIORITY = "required"
> DEPENDS = "makedevs"
> RDEPENDS_${PN} = "makedevs"
> LICENSE = "GPL"
> -PR = "r124"
> +PR = "r125"
>
> SRC_URI = "file://functions \
> file://halt \
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
iD8DBQFMrLJOMkyGM64RGpERAr5QAJ45x3QEvOpxYGWwO2xpqqcqhLE4SQCfWySh
rKzUepwOYIYCXcK3PPiOuzQ=
=V/Ap
-----END PGP SIGNATURE-----
More information about the Openembedded-devel
mailing list