From 69938209ed0ce1047565f3947c90b432d35c831a Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 27 Jan 2017 16:27:06 -0600 Subject: Prevent leap second from being cancelled during the leap second. --- .../linux-3.12-time-leap-second-v3.patch | 26 ++++++++++++++++++++++ recipes-kernel/linux/linux_3.12.27.bb | 14 +++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-time-leap-second-v3.patch diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-time-leap-second-v3.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-time-leap-second-v3.patch new file mode 100644 index 0000000..1c329a2 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-time-leap-second-v3.patch @@ -0,0 +1,26 @@ +From: https://patchwork.kernel.org/patch/5819751/ +Having observed leap second failing to change the clock after receiving the +message kernel: Clock: inserting leap second 23:59:60 UTC +in the kernel log this patch seemed promising. The pupose is to lock +out adjtimex changes during leap second, to prevent adjtimex from cancelling +leap second. +=========================================================================== +From Prarit Bhargava - Feb. 20, 2015, 2:12 p.m. +I think setting it in the middle of the leap second should be a NOOP. We all +know how fragile this code has been in the past and allowing a state transition +at that particular time isn't a good idea given the outcome that the state may +remain TIME_INS. +diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c +index 28bf91c..6ff5cd5 100644 +--- a/kernel/time/ntp.c ++++ b/kernel/time/ntp.c +@@ -535,7 +535,8 @@ void ntp_notify_cmos_timer(void) { } + static inline void process_adj_status(struct timex *txc, struct timespec64 *ts) + { + if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) { +- time_state = TIME_OK; ++ if (time_state != TIME_OOP) ++ time_state = TIME_OK; + time_status = STA_UNSYNC; + /* restart PPS frequency calibration */ + pps_reset_freq_interval(); diff --git a/recipes-kernel/linux/linux_3.12.27.bb b/recipes-kernel/linux/linux_3.12.27.bb index 1d82e66..e266d41 100644 --- a/recipes-kernel/linux/linux_3.12.27.bb +++ b/recipes-kernel/linux/linux_3.12.27.bb @@ -2,7 +2,7 @@ inherit kernel # mts class to build dtb and append to kernel image inherit linux-append-dtb -PR = "r12" +PR = "r13" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" @@ -28,6 +28,7 @@ COMMON_PATCHES = " \ file://linux-3.12.27-USB-option-reduce-interrupt-urb-logging-verbosity.patch \ file://linux-3.12-pps-gpio.patch \ file://linux-3.12-cadence-macb.patch \ + file://linux-3.12-time-leap-second-v3.patch \ " SRC_URI_append_mtcdt = "\ @@ -52,6 +53,17 @@ SRC_URI[sha256sum] = "2014c55257dda311779359d6b42931079a687c154777cc528c44e25f26 COMPATIBLE_MACHINE = "(mtcdt|mtcap)" DTB_APPEND_mtcdt = "mtcdt" DTB_APPEND_mtcap = "mtcap" +do_patch_append() { + # Makefile location + makefl="${S}" + "/Makefile" + # String to find: EXTRAVERSION = + original="'^(.*EXTRAVERSION[[:space:]]*=)[[:space:]]*'" + # Update for string Copy variable = and set to PR version + upd="'\\1 " + "${PR}" + "'" + # Use sed to write the data to the file. + print "Setting EXTRAVERSION to ${PR}\n" + os.system("sed -ri -e s/" + original + "/" + upd + "/ " + makefl) +} # disable this on purpose for dev purposes do_rm_work() { -- cgit v1.2.3