Browse Source

More robust RT kernel detection

This commit replaces previous method of realtime kernel detection. The last method relied on the version name of the kernel, and it was successful only if the last chunk of the name after the last hyphen contained one of three possible values:  ("rt", "realtime", "lowlatency"). But as explained in issue falkTX/Cadence#125 the version name can be convoluted and might not comply with the detection mechanism standard as imposed by cadence. E.g. a kernel with name "3.13.0-44-lowlatency" would pass the test whilst another realtime kernel with name "4.4-6.dmz.1-liquorix-amd64" would not. Also, kernel names can be easily changed and appending "rt" to a name would not make it "rt capable". To solve this, it is proposed to change the detection method to rely on coreutil's "uname -a", which obtains information from the built kernel and outputs two strings related to RT: PREEMPT_RT or PREEMPT. The method presented here takes advantage of this and improves RT kernel detection.
pull/325/head
neyuru GitHub 3 years ago
parent
commit
4c3309ee16
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 16 deletions
  1. +25
    -16
      src/cadence.py

+ 25
- 16
src/cadence.py View File

@@ -470,6 +470,7 @@ class CadenceSystemCheck_kernel(CadenceSystemCheck):
self.name = self.tr("Current kernel")

uname3 = os.uname()[2]
uname4 = getoutput("uname -a").strip().split()

versionInt = []
versionStr = uname3.split("-",1)[0]
@@ -484,28 +485,36 @@ class CadenceSystemCheck_kernel(CadenceSystemCheck):

self.result = versionStr + " "

if "-" not in uname3:
self.icon = self.ICON_WARN
self.result += self.tr("Vanilla")
self.moreInfo = None
if "PREEMPT" in uname4 or "PREEMPT_RT" in uname4:
self.icon = self.ICON_OK

else:
if uname3.endswith("-pae"):
kernelType = uname3.split("-")[-2].lower()
self.result += kernelType.title() + " (PAE)"
if "PREEMPT" in uname4:
self.moreInfo = self.tr("Be sure to properly configure your kernel.")
self.result += self.tr("PREEMPT")
else:
kernelType = uname3.split("-")[-1].lower()
self.result += kernelType.title()

if kernelType in ("rt", "realtime") or (kernelType == "lowlatency" and versionInt >= [2, 6, 39]):
self.icon = self.ICON_OK
self.moreInfo = None
elif versionInt >= [2, 6, 39]:
self.result += self.tr("PREEMPT_RT")

else:
if versionInt >= [2, 6, 11]:
#Linux kernel versions 2.6.11 and up can be patched for PREEMPT_RT and
#versions 2.6.13 and up can be configured for CONFIG_PREEMPT
# sources
# https://wiki.linuxfoundation.org/realtime/preempt_rt_versions
# https://cateee.net/lkddb/web-lkddb/PREEMPT.html
self.icon = self.ICON_WARN
self.moreInfo = None
self.moreInfo = self.tr("RT may be available if compiling this version w/CONFIG_PREEMPT or patching this kernel w/CONFIG_PREEMPT_RT.")

if "-" not in uname3:
if uname3.endswith("-pae"):
kernelType = uname3.split("-")[-2].lower()
self.result += kernelType.title() + self.tr(" Vanilla (PAE)")
else:
kernelType = uname3.split("-")[-1].lower()
self.result += kernelType.title() + self.tr(" Vanilla")
else:
self.icon = self.ICON_ERROR
self.moreInfo = None
self.moreInfo = self.tr("No realtime options for this version of kernel.")

def initSystemChecks():
if LINUX:


Loading…
Cancel
Save