diff options
author | Jens Rehsack <sno@netbsd.org> | 2019-04-18 16:08:42 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-26 10:09:08 +0100 |
commit | 67886623d9728f2bd370fb55cea5ab39bcc429c1 (patch) | |
tree | 743b54a9c163f593730279792bb430063a5d8121 /meta/classes | |
parent | c814947e03943c305226f17686f34b0c62450680 (diff) | |
download | poky-67886623d9728f2bd370fb55cea5ab39bcc429c1.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: fae400b225827400bf32380a7d599d3b2969db55)
Signed-off-by: Jens Rehsack <sno@netbsd.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/kernel-module-split.bbclass | 20 |
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') |