summaryrefslogtreecommitdiffstats
path: root/meta/classes/linux-kernel-base.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/linux-kernel-base.bbclass')
-rw-r--r--meta/classes/linux-kernel-base.bbclass32
1 files changed, 32 insertions, 0 deletions
diff --git a/meta/classes/linux-kernel-base.bbclass b/meta/classes/linux-kernel-base.bbclass
new file mode 100644
index 0000000..4f2b0a4
--- /dev/null
+++ b/meta/classes/linux-kernel-base.bbclass
@@ -0,0 +1,32 @@
1# parse kernel ABI version out of <linux/version.h>
2def get_kernelversion(p):
3 import re
4
5 fn = p + '/include/linux/utsrelease.h'
6 if not os.path.isfile(fn):
7 # after 2.6.33-rc1
8 fn = p + '/include/generated/utsrelease.h'
9 if not os.path.isfile(fn):
10 fn = p + '/include/linux/version.h'
11
12 import re
13 try:
14 f = open(fn, 'r')
15 except IOError:
16 return None
17
18 l = f.readlines()
19 f.close()
20 r = re.compile("#define UTS_RELEASE \"(.*)\"")
21 for s in l:
22 m = r.match(s)
23 if m:
24 return m.group(1)
25 return None
26
27def linux_module_packages(s, d):
28 suffix = ""
29 return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split()))
30
31# that's all
32