summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-module-split.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/kernel-module-split.bbclass')
-rw-r--r--meta/classes/kernel-module-split.bbclass73
1 files changed, 1 insertions, 72 deletions
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index db0ad3367a..08d226276e 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -36,12 +36,6 @@ python split_kernel_module_packages () {
36 import re 36 import re
37 37
38 modinfoexp = re.compile("([^=]+)=(.*)") 38 modinfoexp = re.compile("([^=]+)=(.*)")
39 kerverrexp = re.compile('^(.*-hh.*)[\.\+].*$')
40 depmodpat0 = re.compile("^(.*\.k?o):..*$")
41 depmodpat1 = re.compile("^(.*\.k?o):\s*(.*\.k?o)\s*$")
42 depmodpat2 = re.compile("^(.*\.k?o):\s*(.*\.k?o)\s*\\\$")
43 depmodpat3 = re.compile("^\t(.*\.k?o)\s*\\\$")
44 depmodpat4 = re.compile("^\t(.*\.k?o)\s*$")
45 39
46 def extract_modinfo(file): 40 def extract_modinfo(file):
47 import tempfile, subprocess 41 import tempfile, subprocess
@@ -63,68 +57,6 @@ python split_kernel_module_packages () {
63 vals[m.group(1)] = m.group(2) 57 vals[m.group(1)] = m.group(2)
64 return vals 58 return vals
65 59
66 def parse_depmod():
67
68 dvar = d.getVar('PKGD', True)
69
70 kernelver = d.getVar('KERNEL_VERSION', True)
71 kernelver_stripped = kernelver
72 m = kerverrexp.match(kernelver)
73 if m:
74 kernelver_stripped = m.group(1)
75 staging_kernel_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
76 system_map_file = "%s/boot/System.map-%s" % (dvar, kernelver)
77 if not os.path.exists(system_map_file):
78 system_map_file = "%s/System.map-%s" % (staging_kernel_dir, kernelver)
79 if not os.path.exists(system_map_file):
80 bb.fatal("System.map-%s does not exist in '%s/boot' nor STAGING_KERNEL_BUILDDIR '%s'" % (kernelver, dvar, staging_kernel_dir))
81
82 cmd = "depmod -n -a -b %s -F %s %s" % (dvar, system_map_file, kernelver_stripped)
83 f = os.popen(cmd, 'r')
84
85 deps = {}
86 line = f.readline()
87 while line:
88 if not depmodpat0.match(line):
89 line = f.readline()
90 continue
91 m1 = depmodpat1.match(line)
92 if m1:
93 deps[m1.group(1)] = m1.group(2).split()
94 else:
95 m2 = depmodpat2.match(line)
96 if m2:
97 deps[m2.group(1)] = m2.group(2).split()
98 line = f.readline()
99 m3 = depmodpat3.match(line)
100 while m3:
101 deps[m2.group(1)].extend(m3.group(1).split())
102 line = f.readline()
103 m3 = depmodpat3.match(line)
104 m4 = depmodpat4.match(line)
105 deps[m2.group(1)].extend(m4.group(1).split())
106 line = f.readline()
107 f.close()
108 return deps
109
110 def get_dependencies(file, pattern, format):
111 # file no longer includes PKGD
112 file = file.replace(d.getVar('PKGD', True) or '', '', 1)
113 # instead is prefixed with /lib/modules/${KERNEL_VERSION}
114 file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
115
116 if file in module_deps:
117 dependencies = []
118 for i in module_deps[file]:
119 m = re.match(pattern, os.path.basename(i))
120 if not m:
121 continue
122 on = legitimize_package_name(m.group(1))
123 dependency_pkg = format % on
124 dependencies.append(dependency_pkg)
125 return dependencies
126 return []
127
128 def frob_metadata(file, pkg, pattern, format, basename): 60 def frob_metadata(file, pkg, pattern, format, basename):
129 vals = extract_modinfo(file) 61 vals = extract_modinfo(file)
130 62
@@ -179,9 +111,7 @@ python split_kernel_module_packages () {
179 on = legitimize_package_name(dep) 111 on = legitimize_package_name(dep)
180 dependency_pkg = format % on 112 dependency_pkg = format % on
181 modinfo_deps.append(dependency_pkg) 113 modinfo_deps.append(dependency_pkg)
182 depmod_deps = get_dependencies(file, pattern, format) 114 for dep in modinfo_deps:
183 all_deps = list(set(modinfo_deps + depmod_deps))
184 for dep in all_deps:
185 if not dep in rdepends: 115 if not dep in rdepends:
186 rdepends[dep] = [] 116 rdepends[dep] = []
187 d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False)) 117 d.setVar('RDEPENDS_' + pkg, bb.utils.join_deps(rdepends, commasep=False))
@@ -189,7 +119,6 @@ python split_kernel_module_packages () {
189 # Avoid automatic -dev recommendations for modules ending with -dev. 119 # Avoid automatic -dev recommendations for modules ending with -dev.
190 d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1) 120 d.setVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', 1)
191 121
192 module_deps = parse_depmod()
193 module_regex = '^(.*)\.k?o$' 122 module_regex = '^(.*)\.k?o$'
194 123
195 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX', True) 124 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX', True)