2017-01-22 17:22:34 +00:00
|
|
|
#! @BUILD_SHEBANG@
|
2013-04-30 15:41:32 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
. "@builddir@/grub-core/modinfo.sh"
|
|
|
|
|
|
|
|
# FIXME: OpenBIOS on sparc64 doesn't implement RTC
|
|
|
|
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Compare RTC with interval timer.
|
|
|
|
# Not 100% proper but should check that timer is running ok
|
|
|
|
dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell`
|
2017-01-23 11:31:36 +00:00
|
|
|
dt1="$(date -u -d "$(echo "$dt" | head -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)"
|
|
|
|
dt2="$(date -u -d "$(echo "$dt" | tail -n 1 | sed 's, [A-Z][a-z]*$,,')" +%s)"
|
2013-04-30 15:41:32 +00:00
|
|
|
|
2016-01-08 15:22:47 +00:00
|
|
|
# Ignore QEMU bug
|
|
|
|
if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
2013-04-30 15:41:32 +00:00
|
|
|
if [ $((dt2 - dt1)) -gt 11 ] || [ $((dt2 - dt1)) -lt 9 ]; then
|
|
|
|
echo "Interval not in range $dt2-$dt1 != 10"
|
|
|
|
exit 1
|
|
|
|
fi
|