summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorJens Rehsack <sno@netbsd.org>2019-04-18 16:08:42 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-12 09:13:39 +0100
commite58f74d27145f3188ac96c223a525b123f246a5c (patch)
tree4b2f96cc548f8dba17bf3834b3a4dc8f53a16408 /meta/classes
parent5280cacb56cca9801448c9dab532450b8e5051bc (diff)
downloadpoky-e58f74d27145f3188ac96c223a525b123f246a5c.tar.gz
kernel-module-split.bbclass: support CONFIG_MODULE_COMPRESS=y
In case, kernel config enables compressed modules, support of splitting via split_kernel_module_packages won't find any module. So, first expand module pattern regex to recognize compressed modules and then objcopy on temporary extacted to extract module information. (From OE-Core rev: 499e830fad1c109f6c009d6ceb2256ced19e4452) Signed-off-by: Jens Rehsack <sno@netbsd.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/kernel-module-split.bbclass20
1 files changed, 18 insertions, 2 deletions
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index e8d3eb5105..221022b7bc 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -44,9 +44,23 @@ python split_kernel_module_packages () {
44 def extract_modinfo(file): 44 def extract_modinfo(file):
45 import tempfile, subprocess 45 import tempfile, subprocess
46 tempfile.tempdir = d.getVar("WORKDIR") 46 tempfile.tempdir = d.getVar("WORKDIR")
47 compressed = re.match( r'.*\.([xg])z$', file)
47 tf = tempfile.mkstemp() 48 tf = tempfile.mkstemp()
48 tmpfile = tf[1] 49 tmpfile = tf[1]
49 cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile) 50 if compressed:
51 tmpkofile = tmpfile + ".ko"
52 if compressed.group(1) == 'g':
53 cmd = "gunzip -dc %s > %s" % (file, tmpkofile)
54 subprocess.check_call(cmd, shell=True)
55 elif compressed.group(1) == 'x':
56 cmd = "xz -dc %s > %s" % (file, tmpkofile)
57 subprocess.check_call(cmd, shell=True)
58 else:
59 msg = "Cannot decompress '%s'" % file
60 raise msg
61 cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", tmpkofile, tmpfile)
62 else:
63 cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile)
50 subprocess.check_call(cmd, shell=True) 64 subprocess.check_call(cmd, shell=True)
51 # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'ö') 65 # errors='replace': Some old kernel versions contain invalid utf-8 characters in mod descriptions (like 0xf6, 'ö')
52 f = open(tmpfile, errors='replace') 66 f = open(tmpfile, errors='replace')
@@ -54,6 +68,8 @@ python split_kernel_module_packages () {
54 f.close() 68 f.close()
55 os.close(tf[0]) 69 os.close(tf[0])
56 os.unlink(tmpfile) 70 os.unlink(tmpfile)
71 if compressed:
72 os.unlink(tmpkofile)
57 vals = {} 73 vals = {}
58 for i in l: 74 for i in l:
59 m = modinfoexp.match(i) 75 m = modinfoexp.match(i)
@@ -133,7 +149,7 @@ python split_kernel_module_packages () {
133 kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" 149 kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
134 kernel_version = d.getVar("KERNEL_VERSION") 150 kernel_version = d.getVar("KERNEL_VERSION")
135 151
136 module_regex = r'^(.*)\.k?o$' 152 module_regex = r'^(.*)\.k?o(?:\.[xg]z)?$'
137 153
138 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX') 154 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
139 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') 155 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')